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

Function isUnit

Lib/pagebot/toolbox/units.py:293–306  ·  view source on GitHub ↗

Answers if u is an instance of Unit. >>> isUnit(pt(20)) True >>> isUnit(pt(20, 21)) False >>> isUnit(2) False

(u)

Source from the content-addressed store, hash-verified

291 return False
292
293def isUnit(u):
294 """Answers if u is an instance of Unit.
295
296 >>> isUnit(pt(20))
297 True
298 >>> isUnit(pt(20, 21))
299 False
300 >>> isUnit(2)
301 False
302 """
303 # FIXME:
304 # isinstance(u, Unit) # Does not seem to work correctly for units created
305 # in other sources, such as A4.
306 return hasattr(u, 'v') and hasattr(u, 'g') and hasattr(u, 'base')
307
308def uRound(u, *args):
309 """Answers the list with rounded units (and all of the other items in the

Callers 15

_set_paddingMethod · 0.90
getLineHeightFunction · 0.90
_set_bordersMethod · 0.90
isUnitsFunction · 0.85
uRoundFunction · 0.85
classOfFunction · 0.85
__eq__Method · 0.85
__ne__Method · 0.85
__le__Method · 0.85
__lt__Method · 0.85
__ge__Method · 0.85
__gt__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected