in source/idea/idea-data-model/src/ideadatamodel/common/common_model.py [0:0]
def __gt__(self, other: Optional[Union['SocaMemoryUnit', str]]):
if other is None:
return True
if isinstance(other, str):
other = SocaMemoryUnit(other)
if not isinstance(other, SocaMemoryUnit):
return True
# if any one of them is TiB, it is definitely greater
if self.value == SocaMemoryUnit.TiB and other.value != SocaMemoryUnit.TiB:
return True
elif other.value == SocaMemoryUnit.TiB:
return False
# neither of them is TiB
# if any one of them is TB, it is definitely greater
if self.value == SocaMemoryUnit.TB and other.value != SocaMemoryUnit.TB:
return True
elif other.value == SocaMemoryUnit.TB:
return False
# neither of them is TB
# if any one of them is GiB, it is definitely greater
if self.value == SocaMemoryUnit.GiB and other.value != SocaMemoryUnit.GiB:
return True
elif other.value == SocaMemoryUnit.GiB:
return False
# neither of them is GiB
# if any one of them is GB, it is definitely greater
if self.value == SocaMemoryUnit.GB and other.value != SocaMemoryUnit.GB:
return True
elif other.value == SocaMemoryUnit.GB:
return False
# neither of them is GB
# if any one of them is MiB, it is definitely greater
if self.value == SocaMemoryUnit.MiB and other.value != SocaMemoryUnit.MiB:
return True
elif other.value == SocaMemoryUnit.MiB:
return False
# neither of them is MiB
# if any one of them is MB, it is definitely greater
if self.value == SocaMemoryUnit.MB and other.value != SocaMemoryUnit.MB:
return True
elif other.value == SocaMemoryUnit.MB:
return False
# neither of them is MB
# if any one of them is KiB, it is definitely greater
if self.value == SocaMemoryUnit.KiB and other.value != SocaMemoryUnit.KiB:
return True
elif other.value == SocaMemoryUnit.KiB:
return False
# neither of them is KiB
# if any one of them is KB, it is definitely greater
if self.value == SocaMemoryUnit.KB and other.value != SocaMemoryUnit.KB:
return True
elif other.value == SocaMemoryUnit.KB:
return False
# neither of them is KiB
# they're both bytes
return False