Use Incomplete instead of Any in __getattr__ (#8903)

This commit is contained in:
Nikita Sobolev
2022-10-15 20:54:21 +03:00
committed by GitHub
parent ed4bc2b2e6
commit ce4668a132
64 changed files with 157 additions and 132 deletions

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,4 +1,5 @@
import optparse
from _typeshed import Incomplete
from collections.abc import Iterable, Mapping
from configparser import RawConfigParser
from typing import Any, ClassVar
@@ -70,9 +71,9 @@ class OptionParser(optparse.OptionParser, SettingsSpec):
*args,
**kwargs,
) -> None: ...
def __getattr__(self, name: str) -> Any: ... # incomplete
def __getattr__(self, name: str) -> Incomplete: ...
class ConfigParser(RawConfigParser):
def __getattr__(self, name: str) -> Any: ... # incomplete
def __getattr__(self, name: str) -> Incomplete: ...
class ConfigDeprecationWarning(DeprecationWarning): ...

View File

@@ -1,4 +1,11 @@
from _typeshed import OpenBinaryModeReading, OpenBinaryModeWriting, OpenTextModeReading, OpenTextModeWriting, SupportsWrite
from _typeshed import (
Incomplete,
OpenBinaryModeReading,
OpenBinaryModeWriting,
OpenTextModeReading,
OpenTextModeWriting,
SupportsWrite,
)
from re import Pattern
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -64,7 +71,7 @@ class FileInput(Input):
class FileOutput(Output):
mode: ClassVar[OpenTextModeWriting | OpenBinaryModeWriting]
def __getattr__(self, name: str) -> Any: ... # incomplete
def __getattr__(self, name: str) -> Incomplete: ...
class BinaryFileOutput(FileOutput): ...

View File

@@ -1,4 +1,5 @@
from typing import Any, Protocol
from _typeshed import Incomplete
from typing import Protocol
from docutils.utils import Reporter
@@ -9,6 +10,6 @@ class _LanguageModule(Protocol):
class LanguageImporter:
def __call__(self, language_code: str, reporter: Reporter | None = ...) -> _LanguageModule: ...
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
get_language: LanguageImporter

View File

@@ -1,5 +1,5 @@
import xml.dom.minidom
from _typeshed import Self
from _typeshed import Incomplete, Self
from abc import abstractmethod
from collections.abc import Callable, Generator, Iterable, Sequence
from typing import Any, ClassVar, Protocol, TypeVar, overload
@@ -102,7 +102,7 @@ class Element(Node):
def deepcopy(self: Self) -> Self: ...
def pformat(self, indent: str = ..., level: int = ...) -> str: ...
def astext(self) -> str: ...
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
class Text(Node, str):
tagname: ClassVar[str]
@@ -128,10 +128,10 @@ class document(Root, Structural, Element):
def deepcopy(self: Self) -> Self: ...
def pformat(self, indent: str = ..., level: int = ...) -> str: ...
def astext(self) -> str: ...
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
class NodeVisitor:
def __init__(self, document: document): ...
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -29,6 +30,6 @@ class Directive:
state: states.RSTState,
state_machine: states.RSTStateMachine,
) -> None: ...
def __getattr__(self, name: str) -> Any: ... # incomplete
def __getattr__(self, name: str) -> Incomplete: ...
def convert_directive_function(directive_fn): ...

View File

@@ -1,4 +1,4 @@
from typing import Any
from _typeshed import Incomplete
from docutils.languages import _LanguageModule
from docutils.nodes import document
@@ -9,4 +9,4 @@ def register_directive(name: str, directive: type[Directive]) -> None: ...
def directive(
directive_name: str, language_module: _LanguageModule, document: document
) -> tuple[type[Directive] | None, list[SystemMessage]]: ...
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any
from typing_extensions import TypeAlias
@@ -16,4 +17,4 @@ def register_local_role(name: str, role_fn: _RoleFn) -> None: ...
def role(
role_name: str, language_module: _LanguageModule, lineno: int, reporter: Reporter
) -> tuple[_RoleFn | None, list[SystemMessage]]: ...
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,6 +1,6 @@
from typing import Any
from _typeshed import Incomplete
class Inliner:
def __init__(self) -> None: ...
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,14 +1,14 @@
from typing import Any
from _typeshed import Incomplete
from docutils.nodes import Node, document
class Transform:
def __init__(self, document: document, startnode: Node | None = ...): ...
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
class Transformer:
def __init__(self, document: document): ...
def add_transform(self, transform_class: type[Transform], priority: int | None = ..., **kwargs) -> None: ...
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,7 +1,7 @@
import optparse
from _typeshed import Incomplete
from builtins import list as _list # alias to avoid name clashes with fields named list
from collections.abc import Iterable
from typing import Any
from typing_extensions import Literal, TypeAlias
from docutils import ApplicationError
@@ -28,7 +28,7 @@ class Reporter:
source: str
report_level: _SystemMessageLevel
halt_level: _SystemMessageLevel
def __getattr__(self, __name: str) -> Any: ... # incomplete
def __getattr__(self, __name: str) -> Incomplete: ...
class SystemMessage(ApplicationError):
level: _SystemMessageLevel
@@ -36,4 +36,4 @@ class SystemMessage(ApplicationError):
def new_reporter(source_path: str, settings: optparse.Values) -> Reporter: ...
def new_document(source_path: str, settings: optparse.Values | None = ...) -> document: ...
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -1,3 +1,3 @@
from typing import Any
from _typeshed import Incomplete
def __getattr__(name: str) -> Any: ... # incomplete
def __getattr__(name: str) -> Incomplete: ...