Make getattr() parameters positional-only (#6235)

This commit is contained in:
Alex Waygood
2021-11-04 17:28:33 +00:00
committed by GitHub
parent 26f2c702d3
commit 4cbc657167

View File

@@ -1041,16 +1041,16 @@ class filter(Iterator[_T], Generic[_T]):
def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode
@overload
def getattr(__o: object, name: str) -> Any: ...
def getattr(__o: object, __name: str) -> Any: ...
# While technically covered by the last overload, spelling out the types for None and bool
# help mypy out in some tricky situations involving type context (aka bidirectional inference)
@overload
def getattr(__o: object, name: str, __default: None) -> Any | None: ...
def getattr(__o: object, __name: str, __default: None) -> Any | None: ...
@overload
def getattr(__o: object, name: str, __default: bool) -> Any | bool: ...
def getattr(__o: object, __name: str, __default: bool) -> Any | bool: ...
@overload
def getattr(__o: object, name: str, __default: _T) -> Any | _T: ...
def getattr(__o: object, __name: str, __default: _T) -> Any | _T: ...
def globals() -> dict[str, Any]: ...
def hasattr(__obj: object, __name: str) -> bool: ...
def hash(__obj: object) -> int: ...