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

Function to_milliseconds

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

Source from the content-addressed store, hash-verified

81
82
83def to_milliseconds(
84 timeout # type: Union[timedelta, float, int]
85) -> int:
86 if timeout and not isinstance(timeout, (timedelta, float, int)):
87 raise InvalidArgumentException(message=("Excepted timeout to be of type "
88 f"Union[timedelta, float, int] instead of {timeout}"))
89 if not timeout:
90 total_us = 0
91 elif isinstance(timeout, timedelta):
92 total_us = int(timeout.total_seconds() * 1e3)
93 else:
94 total_us = int(timeout * 1e3)
95
96 return total_us
97
98
99THIRTY_DAYS_IN_SECONDS = 30 * 24 * 60 * 60

Callers 2

timeoutMethod · 0.90
timeoutMethod · 0.90

Calls 1

Tested by

no test coverage detected