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

--check-untyped-defs required to check any imported class init #8775

Closed
kyprifog opened this issue May 4, 2020 · 2 comments
Closed

--check-untyped-defs required to check any imported class init #8775

kyprifog opened this issue May 4, 2020 · 2 comments

Comments

@kyprifog
Copy link

kyprifog commented May 4, 2020

Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues

Please provide more information to help us understand the issue:

  • Are you reporting a bug, or opening a feature request?
  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
  • What is the actual behavior/output?
  • What is the behavior/output you expect?
  • What are the versions of mypy and Python you are using?
    Do you see the same issue after installing mypy from Git master?
  • What are the mypy flags you are using? (For example --strict-optional)
  • If mypy crashed with a traceback, please paste
    the full traceback below.

Bug?

Using the default example found here for classes:
https://mypy.readthedocs.io/en/stable/class_basics.html#class-basics

I get the same result, however if I import A into another class "--check-untyped-defs" is required to detect the same errors.

@emmatyping
Copy link
Collaborator

Could you clarify what you mean by "Import A into another class"? Also you probably are running into https://mypy.readthedocs.io/en/stable/common_issues.html#no-errors-reported-for-obviously-wrong-code

@kyprifog
Copy link
Author

kyprifog commented May 5, 2020

Sorry my wording was bad, I meant, if A is invoked from an import. I think I found the issue though, I had:

[mypy]
ignore_missing_imports = True

Which I intended to apply to only external exports, I didn't realize this applied to all imports within the same project so it was treating it like Any. Removing this line I got

b/b.py:1: error: Cannot find implementation or library stub for module named 'a'

which I presume means it was being treated as Any

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

No branches or pull requests

2 participants