-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
Are you reporting a bug, or opening a feature request?
I believe I found a bug in mypy (as far as I understand what's going on, this is not a typeshed issue).
The code
# my_file.py
from importlib import import_module
import os
settings_module_path = os.getenv('PRODUCTION_SETTINGS_MODULE')
settings = import_module(settings_module_path)
if settings and hasattr(settings, 'LOGGING'):
log_config = settings.LOGGINGBehaviour
$ mypy
my_file.py:8: error: Module has no attribute "LOGGING"Expected behavior
No mypy error. Especially, when the attribute is explicitly asserted to be there (analogically as with narrowing types using isinstance()).
Versions
Python 3.6.5
mypy==0.600
Metadata
Metadata
Assignees
Labels
No labels