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

Allow manual updates #65

Merged
merged 8 commits into from
May 20, 2024
Merged

Allow manual updates #65

merged 8 commits into from
May 20, 2024

Conversation

garrettmflynn
Copy link
Collaborator

This PR makes the TQDMProgressSubscriber class compatible with manual updates to the tqdm class, as used in hdmf-dev/hdmf#1110.

@garrettmflynn garrettmflynn self-assigned this May 15, 2024
@CodyCBakerPhD
Copy link
Member

Since this is the first PR after initial release, should probably include a CHANGELOG entry

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -31,7 +31,7 @@ def on_progress_update(progress_update: dict):
"""
self.announce(message=dict(**progress_update, **additional_metadata))

return TQDMProgressSubscriber(iterable=iterable, on_progress_update=on_progress_update, **tqdm_kwargs)
return TQDMProgressSubscriber(*tqdm_args, on_progress_update=on_progress_update, **tqdm_kwargs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return TQDMProgressSubscriber(*tqdm_args, on_progress_update=on_progress_update, **tqdm_kwargs)
return TQDMProgressSubscriber(*tqdm_args, *, on_progress_update=on_progress_update, **tqdm_kwargs)

Actually, to match the statement in the CHANGELOG (required), need this star here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem acceptable when instantiating a class. Is this where you meant to put this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, meant in the init

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already handled by the *tqdm_args argument, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, * says 'everything to the right of this position is required to be a keyword argument only'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* by itself that is, *args just unpacks a list of ordered unnamed positional values to the signature

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I guess you're right, if it sees *args it imposes keyword only to the right of that

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0e61338) to head (f6e9a8f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #65   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines           73        72    -1     
=========================================
- Hits            73        72    -1     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/tqdm_publisher/_handler.py 100.00% <100.00%> (ø)
src/tqdm_publisher/_publisher.py 100.00% <100.00%> (ø)
src/tqdm_publisher/_subscriber.py 100.00% <100.00%> (ø)
src/tqdm_publisher/testing.py 100.00% <ø> (ø)

@CodyCBakerPhD CodyCBakerPhD merged commit 8ab8504 into main May 20, 2024
14 checks passed
@CodyCBakerPhD CodyCBakerPhD deleted the manual_updates branch May 20, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants