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

Error with code [attr-defined] when type ignoring the entire file #9449

Closed
sh1ma opened this issue Sep 16, 2020 · 2 comments
Closed

Error with code [attr-defined] when type ignoring the entire file #9449

sh1ma opened this issue Sep 16, 2020 · 2 comments
Labels

Comments

@sh1ma
Copy link

sh1ma commented Sep 16, 2020

Hello! I want judge if this is a bug.

Directory tree

helloworld
├── __init__.py
└── a.py

a.py

# type: ignore


class Something:
    pass

__init__.py

from .a import Something

mypy output

❯ mypy helloworld
helloworld/__init__.py:1: error: Module 'helloworld.a' has no attribute 'Something'
Found 1 error in 1 file (checked 2 source files)

However, when I removed # type: ignore on the first line of a.py

mypy output

❯ mypy helloworld
Success: no issues found in 2 source files

Is this a bug?

Thank you!

@sh1ma sh1ma added the question label Sep 16, 2020
@gvanrossum
Copy link
Member

No, it's as designed. The special marker # type: ignore at the top of a file means the file is not processed at all.

@dpinol
Copy link

dpinol commented Nov 30, 2021

Related to #9318

observingClouds added a commit to observingClouds/slkspec that referenced this issue Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants