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

Method __ge__

Lib/pagebot/toolbox/units.py:784–807  ·  view source on GitHub ↗

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

(self, u)

Source from the content-addressed store, hash-verified

782 return False
783
784 def __ge__(self, u):
785 """Answers the boolean result how self compares to rendered u.
786
787 >>> u = pt(20)
788 >>> u >= 20
789 True
790 >>> u >= 21
791 False
792 >>> u >= pt(20) # Compare with different unit instances of same class
793 True
794 >>> u >= mm(2) # Compare with unit instance of different class.
795 True
796 >>> u >= mm(200) # Compare with unit instance of different class.
797 False
798 >>> u >= [] # All other situations are not matching
799 False
800 """
801 if isinstance(u, (int, float)): # One is a scalar, just compare
802 return self.rv >= u
803 if isUnit(u):
804 if isinstance(u, self.__class__):
805 return self.rv >= u.rv
806 return self.pt >= u.pt # Incompatible unit types, compare via points
807 return False
808
809 def __gt__(self, u):
810 """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