Skip to content

Commit

Permalink
Moved slots out of init method
Browse files Browse the repository at this point in the history
  • Loading branch information
auvipy authored Aug 26, 2024
1 parent c870aa5 commit 049f458
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions vine/synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ def all_done():
Note that you cannot add new promises to a barrier after
the barrier is fulfilled.
"""
__slots__ = ( # noqa
'p', 'args', 'kwargs', '_value', 'size',
'ready', 'reason', 'cancelled', 'finalized',
'__weakref__',
# adding '__dict__' to get dynamic assignment
"__dict__",
)

def __init__(self, promises=None, args=None, kwargs=None,
callback=None, size=None):
Expand All @@ -57,14 +64,6 @@ def __init__(self, promises=None, args=None, kwargs=None,
if callback:
self.then(callback)

__slots__ = ( # noqa
'p', 'args', 'kwargs', '_value', 'size',
'ready', 'reason', 'cancelled', 'finalized',
'__weakref__',
# adding '__dict__' to get dynamic assignment
"__dict__",
)

def __call__(self, *args, **kwargs):
if not self.ready and not self.cancelled:
self._value += 1
Expand Down

0 comments on commit 049f458

Please sign in to comment.