| 8 | |
| 9 | |
| 10 | class WidthUnit(NamedTuple): |
| 11 | width: Union[int, float] |
| 12 | unit: str = "px" |
| 13 | |
| 14 | @property |
| 15 | def parsedWidth(self) -> Union[int, float]: |
| 16 | return self.width |
| 17 | |
| 18 | def __str__(self) -> str: |
| 19 | return f'{self.width}{self.unit}' |
| 20 | |
| 21 | |
| 22 | unitRegex = re.compile(r'[\d.,]*(\D*)$') |