Skip to content

Commit 6395bc4

Browse files
committed
Treat NotImplemented as a singleton type
1 parent 66f83ea commit 6395bc4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

mypy/typeops.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from mypy.state import state
3535
from mypy.types import (
3636
ELLIPSIS_TYPE_NAMES,
37+
NOT_IMPLEMENTED_TYPE_NAMES,
3738
AnyType,
3839
CallableType,
3940
ExtraAttrs,
@@ -996,8 +997,10 @@ def is_singleton_identity_type(typ: ProperType) -> bool:
996997
if isinstance(typ, NoneType):
997998
return True
998999
if isinstance(typ, Instance):
999-
return (typ.type.is_enum and len(typ.type.enum_members) == 1) or (
1000-
typ.type.fullname in ELLIPSIS_TYPE_NAMES
1000+
return (
1001+
(typ.type.is_enum and len(typ.type.enum_members) == 1)
1002+
or (typ.type.fullname in ELLIPSIS_TYPE_NAMES)
1003+
or (typ.type.fullname in NOT_IMPLEMENTED_TYPE_NAMES)
10011004
)
10021005
if isinstance(typ, LiteralType):
10031006
return typ.is_enum_literal() or isinstance(typ.value, bool)

0 commit comments

Comments
 (0)