-
Notifications
You must be signed in to change notification settings - Fork 766
fix tqdm_class argument of subclass of tqdm #3111
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
fix tqdm_class argument of subclass of tqdm #3111
Conversation
/cc @hanouticelina |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
thanks for aligning the type hint! indeed the parameter can be a type object that is either base_tqdm
itself or a subclass of base_tqdm
or None
. So Optional[type[base_tqdm]]
is more accurrate
@@ -44,7 +44,7 @@ def snapshot_download( | |||
allow_patterns: Optional[Union[List[str], str]] = None, | |||
ignore_patterns: Optional[Union[List[str], str]] = None, | |||
max_workers: int = 8, | |||
tqdm_class: Optional[base_tqdm] = None, | |||
tqdm_class: Optional[type[base_tqdm]] = None, |
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.
tqdm_class: Optional[type[base_tqdm]] = None, | |
tqdm_class: Optional[Type[base_tqdm]] = None, |
and import Type from typing to make it work with python 3.8 (generic types was introduced in Python 3.9)
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.
Done. CI should be green later.
353b3ea
to
9b270dd
Compare
9b270dd
to
43d7f0b
Compare
@bot /style |
Style fixes have been applied. View the workflow run here. |
@hanouticelina sorry for the interrupt, when can this PR be released in a new version? |
According to the doc of
tqdm_class
argument,tqdm_class
should accept any class that are subclass oftqdm
.