(v, *args, **kwargs)
| 1331 | # Inch |
| 1332 | |
| 1333 | def inch(v, *args, **kwargs): |
| 1334 | u = None |
| 1335 | if args: # If there are more arguments, bind them together in a list. |
| 1336 | v = [v]+list(args) |
| 1337 | if isinstance(v, (tuple, list)): |
| 1338 | u = [] |
| 1339 | for uv in v: |
| 1340 | u.append(inch(uv)) |
| 1341 | u = tuple(u) |
| 1342 | elif isinstance(v, (int, float)): |
| 1343 | return Inch(v) |
| 1344 | elif isUnit(v): |
| 1345 | u = Inch() # New Inch and convert via pt |
| 1346 | u.pt = v.pt |
| 1347 | elif isinstance(v, str): |
| 1348 | v = v.strip().lower() |
| 1349 | if v.endswith(Inch.UNITC): # "-character |
| 1350 | v = asNumberOrNone(v[:-1]) |
| 1351 | if v is not None: |
| 1352 | u = Inch(v) |
| 1353 | elif v.endswith(Inch.UNIT): |
| 1354 | v = asNumberOrNone(v[:-4]) |
| 1355 | if v is not None: |
| 1356 | u = Inch(v) |
| 1357 | else: # Something else, recursively try again. |
| 1358 | u = inch(units(v)) |
| 1359 | return u |
| 1360 | |
| 1361 | class Inch(Unit): |
| 1362 | """Inch 72 * the base unit size of all PageBot measures. |
no test coverage detected