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

Fix tqdm #1629

Merged
merged 3 commits into from
Aug 29, 2023
Merged

Fix tqdm #1629

merged 3 commits into from
Aug 29, 2023

Conversation

NielsRogge
Copy link
Contributor

Fixes #1603

Comment on lines 134 to 140
def __delattr__(self, attr):
"""fix for https://github.com/huggingface/huggingface_hub/issues/1603"""
try:
del self.__dict__[attr]
except KeyError:
if attr != "_lock":
raise AttributeError(attr)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to use the "real" underlying __delattr__ and raise the default exception generated by it instead of creating a new AttributeError(attr) that is less verbose.

Suggested change
def __delattr__(self, attr):
"""fix for https://github.com/huggingface/huggingface_hub/issues/1603"""
try:
del self.__dict__[attr]
except KeyError:
if attr != "_lock":
raise AttributeError(attr)
def __delattr__(self, attr: str) -> None:
"""Fix for https://github.com/huggingface/huggingface_hub/issues/1603"""
try:
super().__delattr__(attr)
except AttributeError:
if attr != "_lock":
raise

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 29, 2023

The documentation is not available anymore as the PR was closed or merged.

@Wauplin
Copy link
Contributor

Wauplin commented Aug 29, 2023

Thanks for taking care of it @NielsRogge. I made an update to your fix and will now merge it.

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.

AttributeError: type object 'tqdm' has no attribute '_lock'
3 participants