mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Add types.ModuleType.__doc__ (#12918)
This commit is contained in:
@@ -337,6 +337,13 @@ class ModuleType:
|
||||
__package__: str | None
|
||||
__path__: MutableSequence[str]
|
||||
__spec__: ModuleSpec | None
|
||||
# N.B. Although this is the same type as `builtins.object.__doc__`,
|
||||
# it is deliberately redeclared here. Most symbols declared in the namespace
|
||||
# of `types.ModuleType` are available as "implicit globals" within a module's
|
||||
# namespace, but this is not true for symbols declared in the namespace of `builtins.object`.
|
||||
# Redeclaring `__doc__` here helps some type checkers understand that `__doc__` is available
|
||||
# as an implicit global in all modules, similar to `__name__`, `__file__`, `__spec__`, etc.
|
||||
__doc__: str | None
|
||||
def __init__(self, name: str, doc: str | None = ...) -> None: ...
|
||||
# __getattr__ doesn't exist at runtime,
|
||||
# but having it here in typeshed makes dynamic imports
|
||||
|
||||
Reference in New Issue
Block a user