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

Archive.get_item type hint is wrong #196

Open
benoit74 opened this issue Sep 30, 2024 · 5 comments · May be fixed by #198
Open

Archive.get_item type hint is wrong #196

benoit74 opened this issue Sep 30, 2024 · 5 comments · May be fixed by #198
Labels
bug Something isn't working

Comments

@benoit74
Copy link
Collaborator

Archive.get_item type hint suggest that it returns a zimscraperlib.zim.items.Item while in fact it return a libzim.writer.Item.

We should either fix the code (preferably) or the type hint (would be sad)

@benoit74 benoit74 added the bug Something isn't working label Sep 30, 2024
@rgaudin
Copy link
Member

rgaudin commented Sep 30, 2024

Why would it be sad to fix the signature? Is this type useless? If so the issue should be about deleting it rather than this collateral

@benoit74
Copy link
Collaborator Author

The zimscraperlib.zim.items.Item type is useful, so this is why I do not want to fix the signature which is correct. But then the code should really return such an object, and not a libzim.writer.Item.

@benoit74
Copy link
Collaborator Author

The problem is that today I can't use item.mimetype because the type checker complains, and I can't use item.get_mimetype() because it fails at runtime.

@rgaudin
Copy link
Member

rgaudin commented Sep 30, 2024

Ah I thought it was the other way around. Indeed we should return it.

@benoit74
Copy link
Collaborator Author

In fact type hint is wrong, it is a writing item. We should fix type hint with libzim reading item which is sufficient.

@benoit74 benoit74 linked a pull request Sep 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants