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

Access to types module blocked by assignment #165

Open
bjd183 opened this issue Oct 12, 2023 · 0 comments
Open

Access to types module blocked by assignment #165

bjd183 opened this issue Oct 12, 2023 · 0 comments

Comments

@bjd183
Copy link

bjd183 commented Oct 12, 2023

https://github.com/h2non/filetype.py/blob/b5e2d926e1c2031239927659dbfbfeb7eb35596b/filetype/filetype.py#L9C1-L10C1

As currently written, assignment of TYPES to the module variable types blocks access to the submodule named types. This effectively blocks all programmatic access to the types submodule that contains class definitions for the matchers. This makes it impossible to subclass existing Type definitions.

I would like to update the mimetype for fonts that currently use a deprecated value without redefining the header. Python complains:

class Woff(FontMixin, filetype.types.font.Woff):
                          ^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'font'

filetype.types is no longer accessible as a submodule because it has been overwritten with a list!

Is there a need for filetype.types == filetype.TYPES?

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

No branches or pull requests

1 participant