mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-01 17:13:24 +08:00
Make name and value read-only for Enums (#6576)
This commit is contained in:
@@ -92,8 +92,16 @@ if sys.version_info >= (3, 11):
|
||||
EnumType = EnumMeta
|
||||
|
||||
class Enum(metaclass=EnumMeta):
|
||||
name: str
|
||||
value: Any
|
||||
if sys.version_info >= (3, 11):
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def value(self) -> Any: ...
|
||||
else:
|
||||
@types.DynamicClassAttribute
|
||||
def name(self) -> str: ...
|
||||
@types.DynamicClassAttribute
|
||||
def value(self) -> Any: ...
|
||||
_name_: str
|
||||
_value_: Any
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
@@ -83,6 +83,8 @@ distutils.command.bdist_packager # It exists in docs as package name but not in
|
||||
distutils.version.Version._cmp # class should have declared this
|
||||
distutils.version.Version.parse # class should have declared this
|
||||
email.headerregistry.BaseHeader.max_count # docs say subclasses should have this property
|
||||
enum.Enum.name # A special property that exists at runtime, but stubtest can't detect https://github.com/python/typeshed/pull/6576#issuecomment-992538677
|
||||
enum.Enum.value # A special property that exists at runtime, but stubtest can't detect https://github.com/python/typeshed/pull/6576#issuecomment-992538677
|
||||
http.HTTPStatus.description # set in __new__
|
||||
http.HTTPStatus.phrase # set in __new__
|
||||
http.client.HTTPConnection.response_class # the actual type at runtime is abc.ABCMeta
|
||||
|
||||
Reference in New Issue
Block a user