Skip to content

Commit

Permalink
Changed acquire_timeout to class __call__ method
Browse files Browse the repository at this point in the history
  • Loading branch information
jtc42 authored Jun 24, 2020
1 parent e6a313d commit b7d1594
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/labthings/core/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, timeout=None, name=None):
self.name = name

@contextmanager
def acquire_timeout(self, timeout, blocking=True):
def __call__(self, timeout=sentinel, blocking=True):
result = self.acquire(timeout=timeout, blocking=blocking)
yield result
if result:
Expand Down Expand Up @@ -91,7 +91,7 @@ def __init__(self, locks, timeout=None):
self.timeout = timeout

@contextmanager
def acquire_timeout(self, timeout, blocking=True):
def __call__(self, timeout=sentinel, blocking=True):
result = self.acquire(timeout=timeout, blocking=blocking)
yield result
if result:
Expand Down

0 comments on commit b7d1594

Please sign in to comment.