Skip to content

Commit 26f6cfe

Browse files
committed
Resolve open questions, mainly moving toward not using the hook for them.
1 parent 0a0f1ee commit 26f6cfe

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

mypy/checkmember.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -786,36 +786,30 @@ def analyze_class_attribute_access(itype: Instance,
786786

787787
return apply_class_attr_hook(mx, hook, result)
788788
elif isinstance(node.node, Var):
789-
# TODO RIGHT NOW NOMERGE - is it okay to not modify this?
790789
mx.not_ready_callback(name, mx.context)
791790
return AnyType(TypeOfAny.special_form)
792791

793792
if isinstance(node.node, TypeVarExpr):
794-
# TODO RIGHT NOW NOMERGE - is it okay to not modify this?
795793
mx.msg.fail(message_registry.CANNOT_USE_TYPEVAR_AS_EXPRESSION.format(
796794
info.name, name), mx.context)
797795
return AnyType(TypeOfAny.from_error)
798796

799797
if isinstance(node.node, TypeInfo):
800-
assert False, "TODO RIGHT NOW NOMERGE - No tests hit this, how to trigger?"
801-
return apply_class_attr_hook(mx, hook, type_object_type(node.node, mx.builtin_type))
798+
return type_object_type(node.node, mx.builtin_type)
802799

803800
if isinstance(node.node, MypyFile):
804801
# Reference to a module object.
805-
assert False, "TODO RIGHT NOW NOMERGE - No tests hit this, how to trigger?"
806-
return apply_class_attr_hook(mx, hook, mx.builtin_type('types.ModuleType'))
802+
return mx.builtin_type('types.ModuleType')
807803

808804
if (isinstance(node.node, TypeAlias) and
809805
isinstance(get_proper_type(node.node.target), Instance)):
810-
return apply_class_attr_hook(mx, hook, instance_alias_type(node.node, mx.builtin_type))
806+
return instance_alias_type(node.node, mx.builtin_type)
811807

812808
if is_decorated:
813809
assert isinstance(node.node, Decorator)
814810
if node.node.type:
815-
assert False, "TODO RIGHT NOW NOMERGE - No tests hit this, how to trigger?"
816811
return apply_class_attr_hook(mx, hook, node.node.type)
817812
else:
818-
# TODO RIGHT NOW NOMERGE - is it okay to not modify this?
819813
mx.not_ready_callback(name, mx.context)
820814
return AnyType(TypeOfAny.from_error)
821815
else:

test-data/unit/check-custom-plugin.test

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -801,21 +801,3 @@ class Cls:
801801
[file mypy.ini]
802802
\[mypy]
803803
plugins=<ROOT>/test-data/unit/plugins/class_attr_hook.py
804-
805-
[case testClassAttrPluginAliasRef]
806-
# flags: --config-file tmp/mypy.ini
807-
808-
from typing import Generic, TypeVar, Type
809-
810-
T = TypeVar('T')
811-
class G(Generic[T]):
812-
pass
813-
814-
class Cls:
815-
attr = G[int]
816-
817-
x: Type[Cls]
818-
reveal_type(x.attr) # N: Revealed type is 'builtins.int'
819-
[file mypy.ini]
820-
\[mypy]
821-
plugins=<ROOT>/test-data/unit/plugins/class_attr_hook.py

0 commit comments

Comments
 (0)