MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / to_microseconds

Function to_microseconds

couchbase/_utils.py:67–80  ·  view source on GitHub ↗
(
    timeout  # type: Union[timedelta, float, int]
)

Source from the content-addressed store, hash-verified

65
66
67def 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
83def to_milliseconds(

Callers 2

timeoutMethod · 0.90
timeoutMethod · 0.90

Calls 1

Tested by

no test coverage detected