h2non/filetype.py

Access to types module blocked by assignment

bjd183 opened this issue · 0 comments

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?