(value: StrBytesIntFloat, native_expected_type: str)
| 64 | |
| 65 | |
| 66 | def get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: |
| 67 | if isinstance(value, (int, float)): |
| 68 | return value |
| 69 | try: |
| 70 | return float(value) |
| 71 | except ValueError: |
| 72 | return None |
| 73 | except TypeError: |
| 74 | raise TypeError(f'invalid type; expected {native_expected_type}, string, bytes, int or float') |
| 75 | |
| 76 | |
| 77 | def from_unix_seconds(seconds: Union[int, float]) -> datetime: |
no outgoing calls
no test coverage detected