(v, *args, **kwargs)
| 998 | # Mm |
| 999 | |
| 1000 | def mm(v, *args, **kwargs): |
| 1001 | u = None |
| 1002 | if args: # If there are more arguments, bind them together in a list. |
| 1003 | v = [v]+list(args) |
| 1004 | if isinstance(v, (tuple, list)): |
| 1005 | u = [] |
| 1006 | for uv in v: |
| 1007 | u.append(mm(uv)) |
| 1008 | u = tuple(u) |
| 1009 | elif isinstance(v, (int, float)): |
| 1010 | u = Mm(v) |
| 1011 | elif isUnit(v): |
| 1012 | u = Mm() # New Mm and convert via pt |
| 1013 | u.pt = v.pt |
| 1014 | elif isinstance(v, str): |
| 1015 | v = v.strip().lower() |
| 1016 | if v.endswith(Mm.UNIT): |
| 1017 | v = asNumberOrNone(v[:-2]) |
| 1018 | if v is not None: |
| 1019 | u = Mm(v) |
| 1020 | else: # Something else, try again. |
| 1021 | u = mm(units(v)) |
| 1022 | return u |
| 1023 | |
| 1024 | class Mm(Unit): |
| 1025 | """Answers the millimetre instance. |
no test coverage detected