Skip to content

Fix module has no attribute type errors#211

Merged
saghul merged 2 commits intosaghul:masterfrom
Dreamsorcerer:patch-1
Apr 4, 2025
Merged

Fix module has no attribute type errors#211
saghul merged 2 commits intosaghul:masterfrom
Dreamsorcerer:patch-1

Conversation

@Dreamsorcerer
Copy link
Contributor

A type checker like mypy can't tell what attributes exist on the module when they are created dynamically. This results in loads of type errors, such as:

aiodns/__init__.py:28:29: error: Module has no attribute "QUERY_TYPE_A" 
[attr-defined]
    query_type_map = {'A'     : pycares.QUERY_TYPE_A,
                                ^~~~~~~~~~~~~~~~~~~~

Proposal is to just duplicate everything in the __any__ like nearly all other projects do.

@Dreamsorcerer Dreamsorcerer changed the title Fix module has not attribute type errors Fix module has no attribute type errors Mar 18, 2025
@saghul
Copy link
Owner

saghul commented Apr 4, 2025

Sorry I missed this PR. The CI seems unhappy.

@Dreamsorcerer
Copy link
Contributor Author

Wait, _cares isn't a package...?

@Dreamsorcerer
Copy link
Contributor Author

OK, done it the more repetitive way..

@saghul saghul merged commit 68e301a into saghul:master Apr 4, 2025
26 checks passed
@saghul
Copy link
Owner

saghul commented Apr 4, 2025

Thank you! Do you have any work pending or shall I cut a new release?

@Dreamsorcerer
Copy link
Contributor Author

That's it. Will work on aiodns as soon as this is up.

@Dreamsorcerer Dreamsorcerer deleted the patch-1 branch April 4, 2025 19:45
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.

2 participants