summaryrefslogtreecommitdiff
path: root/decorator_utils.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-02-03 14:18:37 -0800
committerScott Gasch <[email protected]>2022-02-03 14:18:37 -0800
commit713a609bd19d491de03debf8a4a6ddf2540b13dc (patch)
tree6593978162d3c11c3a54e44a770aded4abc79704 /decorator_utils.py
parenteb1c6392095947b3205c4d52cd9b1507e6cd776b (diff)
Change settings in flake8 and black.
Diffstat (limited to 'decorator_utils.py')
-rw-r--r--decorator_utils.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/decorator_utils.py b/decorator_utils.py
index a5c5afe..68a9d69 100644
--- a/decorator_utils.py
+++ b/decorator_utils.py
@@ -148,9 +148,7 @@ def rate_limited(n_calls: int, *, per_period_in_seconds: float = 1.0) -> Callabl
logger.debug(f'@{time.time()}> calling it...')
ret = func(*args, **kargs)
last_invocation_timestamp[0] = time.time()
- logger.debug(
- f'@{time.time()}> Last invocation <- {last_invocation_timestamp[0]}'
- )
+ logger.debug(f'@{time.time()}> Last invocation <- {last_invocation_timestamp[0]}')
cv.notify()
return ret
@@ -290,9 +288,7 @@ class _SingletonWrapper:
def __call__(self, *args, **kwargs):
"""Returns a single instance of decorated class"""
- logger.debug(
- f"@singleton returning global instance of {self.__wrapped__.__name__}"
- )
+ logger.debug(f"@singleton returning global instance of {self.__wrapped__.__name__}")
if self._instance is None:
self._instance = self.__wrapped__(*args, **kwargs)
return self._instance
@@ -594,9 +590,7 @@ class _Timeout(object):
self.__limit = kwargs.pop("timeout", self.__limit)
self.__queue = multiprocessing.Queue(1)
args = (self.__queue, self.__function) + args
- self.__process = multiprocessing.Process(
- target=_target, args=args, kwargs=kwargs
- )
+ self.__process = multiprocessing.Process(target=_target, args=args, kwargs=kwargs)
self.__process.daemon = True
self.__process.start()
if self.__limit is not None:
@@ -693,9 +687,7 @@ def timeout(
@functools.wraps(function)
def new_function(*args, **kwargs):
- timeout_wrapper = _Timeout(
- function, timeout_exception, error_message, seconds
- )
+ timeout_wrapper = _Timeout(function, timeout_exception, error_message, seconds)
return timeout_wrapper(*args, **kwargs)
return new_function