Skip to content

mypy: enable no_implicit_reexport#702

Open
lazka wants to merge 2 commits intoquodlibet:mainfrom
lazka:more-no-implicit-reexport
Open

mypy: enable no_implicit_reexport#702
lazka wants to merge 2 commits intoquodlibet:mainfrom
lazka:more-no-implicit-reexport

Conversation

@lazka
Copy link
Member

@lazka lazka commented Jan 17, 2026

Either explicitely "re-export" (I whish there was a nicer way, as renaming
also falls under this) or change the imports to import from the source.

flake8 doesn't understand this, so just disable the warning of unused vars
there. Maybe ruff will be smarter there.

Fixes #699

lazka added 2 commits January 16, 2026 16:40
So we can enable no-implicit-reexport, which gets onyl detected on
re-export use, such as in the test suite.
Either explicitely "re-export" (I which there was a nicer way, as renaming
also falls under this) or change the imports to import from the source.

flake8 doesn't understand this, so just disable the warning of unused vars
there. Maybe ruff will be smarter there.

Fixes quodlibet#699

from mutagen import StreamInfo
from mutagen.apev2 import APEv2File, error, delete
from mutagen.apev2 import APEv2File, error as error, delete
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the as error needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Without it we get:

tests/test_wavpack.py:4: error: Module "mutagen.wavpack" does not explicitly export attribute "error"  [attr-defined]
Found 1 error in 1 file (checked 108 source files)

suggestions welcome.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, yes. Somewhat makes sense. Wouldn't the alternative be to put it into __all__? Otherwise yes, if mypy is happy with the as definition it should be fine.

from ._util import ID3EncryptionUnsupportedError as ID3EncryptionUnsupportedError, \
ID3JunkFrameError as ID3JunkFrameError, ID3BadUnsynchData as ID3BadUnsynchData, \
ID3BadCompressedData as ID3BadCompressedData, ID3TagError as ID3TagError, \
ID3Warning as ID3Warning, BitPaddedInt as _BitPaddedIntForPicard
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we could get rid of the BitPaddedInt export here. As I see it this was added for compatibility with Picard before version 1.4 (https://tickets.metabrainz.org/browse/PICARD-833) ten years ago. Picard isn't using this import anymore since that time, and I think we don't need to expect the next mutagen version to be compatible with that old Picard versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good, thanks for investigating

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.

typing: enable no-implicit-reexport

2 participants