Skip to content

New setting "user_builtins_name": Ignore specific "name-defined" errors #18936

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

un-pogaz
Copy link

Fixes #18932

Adding a new setting "user_builtins_name" that allow to ignore specific "name-defined" errors.

This setting should be used only if new values have beed defined into the builtins module.

Example of user builtins name:

builtins.__dict__['prints'] = prints = PrefixedPrint()

The function prints can be used anywhere in the project without need to write the import. However, in such case mypy raise a error "name-defined", even if the code is valid. This PR allow to not raise this error. The setting can be defined per modules.

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

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.

New setting "user_builtins_name": Ignore specific "name-defined" errors
1 participant