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

--untyped-calls-exclude should consider inheritance #16651

Open
bersbersbers opened this issue Dec 12, 2023 · 0 comments
Open

--untyped-calls-exclude should consider inheritance #16651

bersbersbers opened this issue Dec 12, 2023 · 0 comments
Labels
bug mypy got something wrong

Comments

@bersbersbers
Copy link

bersbersbers commented Dec 12, 2023

Bug Report

I think it would make sense to use --untyped-calls-exclude based on the defining class of an untyped function. However, that is not currently possible.

Related: #16653

To Reproduce

class Super:
    def draw(self):
        ...

class Class(Super):
    ...

Class().draw()

Expected Behavior

mypy --no-incremental --disallow-untyped-calls --untyped-calls-exclude=bug.Super bug.py

gives no error.

Actual Behavior

bug.py:8: error: Call to untyped function "draw" in typed context  [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)

I can use --untyped-calls-exclude=bug.Class to work around this, but when inheriting from a class from an untyped library, it makes more sense to exclude the actual culprit and avoid false negatives (namely, other functions correctly typed in Class).

Your Environment

  • Mypy version used: 1.7.1.
  • Mypy command-line flags: see above
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.12.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant