MCPcopy Create free account
hub / github.com/PageBot/PageBot / __ne__

Method __ne__

Lib/pagebot/toolbox/units.py:711–732  ·  view source on GitHub ↗

Answers the boolean result how self compares to rendered u. >>> u = pt(20) >>> u != 20 False >>> u != 21 True >>> u != pt(20) # Compare with different unit instances of same class False >>> u != mm(20) # Compare with unit instance of d

(self, u)

Source from the content-addressed store, hash-verified

709 return False
710
711 def __ne__(self, u):
712 """Answers the boolean result how self compares to rendered u.
713
714 >>> u = pt(20)
715 >>> u != 20
716 False
717 >>> u != 21
718 True
719 >>> u != pt(20) # Compare with different unit instances of same class
720 False
721 >>> u != mm(20) # Compare with unit instance of different class.
722 True
723 >>> u != [] # All other situations are not matching
724 True
725 """
726 if isinstance(u, (int, float)): # One is a scalar, just compare
727 return self.rv != u
728 if isUnit(u):
729 if isinstance(u, self.__class__):
730 return self.rv != u.rv
731 return self.pt != u.pt # Incompatible unit types, compare via points
732 return True
733
734 def __le__(self, u):
735 """Answers the boolean result how self compares to rendered u.

Callers

nothing calls this directly

Calls 1

isUnitFunction · 0.85

Tested by

no test coverage detected