(
timeout # type: Union[timedelta, float, int]
)
| 65 | |
| 66 | |
| 67 | def to_microseconds( |
| 68 | timeout # type: Union[timedelta, float, int] |
| 69 | ) -> int: |
| 70 | if timeout and not isinstance(timeout, (timedelta, float, int)): |
| 71 | raise InvalidArgumentException(message=("Excepted timeout to be of type " |
| 72 | f"Union[timedelta, float, int] instead of {timeout}")) |
| 73 | if not timeout: |
| 74 | total_us = 0 |
| 75 | elif isinstance(timeout, timedelta): |
| 76 | total_us = int(timeout.total_seconds() * 1e6) |
| 77 | else: |
| 78 | total_us = int(timeout * 1e6) |
| 79 | |
| 80 | return total_us |
| 81 | |
| 82 | |
| 83 | def to_milliseconds( |
no test coverage detected