(value: StrBytesIntFloat, native_expected_type: str)
| 31 | |
| 32 | |
| 33 | def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: |
| 34 | if isinstance(value, (int, float)): |
| 35 | return value |
| 36 | try: |
| 37 | return float(value) |
| 38 | except ValueError: |
| 39 | return None |
| 40 | except TypeError: |
| 41 | raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None |
| 42 | |
| 43 | |
| 44 | def _from_unix_seconds(seconds: Union[int, float]) -> datetime: |
no outgoing calls
no test coverage detected