-
Notifications
You must be signed in to change notification settings - Fork 22
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
some comments to the SmartQueue #357
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! I've found some minor issues nonetheless.
yapapi/executor/_smartq.py
Outdated
@@ -27,7 +27,16 @@ | |||
Item = TypeVar("Item") | |||
|
|||
|
|||
class Handle(Generic[Item], object): | |||
class Handle( | |||
Generic[Item], object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're here, let's remove this object
, so Python2-ic
yapapi/executor/_smartq.py
Outdated
class Handle(Generic[Item], object): | ||
class Handle( | ||
Generic[Item], object | ||
): # Handling? QueueItem? ConsumedItem? ConsumerItem? ConsumerBinding? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got used to Handle
, it's not that bad. Either way, let's not forget to remove this comment.
yapapi/executor/_smartq.py
Outdated
def __init__(self, items: Iterable[Item]): | ||
""" | ||
:param items: the items to be iterated over | ||
:param retry_cnt: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we drop this argument from __init__()
(I understand that's because it's unused) then let's not add a docstring for it.
yapapi/executor/_smartq.py
Outdated
@@ -126,13 +143,15 @@ async def mark_done(self, handle: Handle[Item]) -> None: | |||
) | |||
|
|||
async def reschedule(self, handle: Handle[Item]) -> None: | |||
"""free the item for reassignment to another consumer""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I we ever run yapapi
code through flake8
it will complain about method docstrings not starting with a capital letter and not ending with a full stop.
yapapi/executor/_smartq.py
Outdated
@@ -178,6 +203,7 @@ def __exit__( | |||
|
|||
@property | |||
def last_item(self) -> Optional[Item]: | |||
"""shouldn't it be called `current_item` ?""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I'd call it current_item
as well.
@azawlocki addressed your comments, pls re-review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
No description provided.