Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved slots out of init method #115

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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__ = (
'p', 'args', 'kwargs', '_value', 'size',
'ready', 'reason', 'cancelled', 'finalized',
'__weakref__',
# adding '__dict__' to get dynamic assignment
"__dict__",
)
auvipy marked this conversation as resolved.
Show resolved Hide resolved

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