Update comments after # type: ignore to be compatible with PEP 484

This commit is contained in:
jack1142
2022-03-28 04:26:34 +02:00
committed by GitHub
parent 0bcb0d0e3c
commit 5ffa3e85de
25 changed files with 68 additions and 68 deletions

View File

@@ -128,7 +128,7 @@ class EnumMeta(type):
attrs['_enum_member_names_'] = member_names
attrs['_enum_value_cls_'] = value_cls
actual_cls = super().__new__(cls, name, bases, attrs)
value_cls._actual_enum_cls_ = actual_cls # type: ignore - Runtime attribute isn't understood
value_cls._actual_enum_cls_ = actual_cls # type: ignore # Runtime attribute isn't understood
return actual_cls
def __iter__(cls) -> Iterator[Any]:
@@ -678,7 +678,7 @@ class AppCommandType(Enum):
def create_unknown_value(cls: Type[E], val: Any) -> E:
value_cls = cls._enum_value_cls_ # type: ignore - This is narrowed below
value_cls = cls._enum_value_cls_ # type: ignore # This is narrowed below
name = f'unknown_{val}'
return value_cls(name=name, value=val)
@@ -690,6 +690,6 @@ def try_enum(cls: Type[E], val: Any) -> E:
"""
try:
return cls._enum_value_map_[val] # type: ignore - All errors are caught below
return cls._enum_value_map_[val] # type: ignore # All errors are caught below
except (KeyError, TypeError, AttributeError):
return create_unknown_value(cls, val)