Skip to content
Closed
Prev Previous commit
Next Next commit
manual fixes
  • Loading branch information
Akuli committed Dec 16, 2021
commit c1ac28543759e6481a0a5eddf459b86b7a348176
2 changes: 1 addition & 1 deletion stdlib/calendar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sys
from time import struct_time
from typing import Any, Iterable, Optional, Sequence, Tuple

_LocaleType = Tuple[Optional[str], Optional[str]]
_LocaleType = Tuple[str | None, str | None]

class IllegalMonthError(ValueError):
def __init__(self, month: int) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/email/message.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _T = TypeVar("_T")
_PayloadType = List[Message] | str | bytes
_CharsetType = Charset | str | None
_ParamsType = str | None | Tuple[str, str | None, str]
_ParamType = str | Tuple[Optional[str], Optional[str], str]
_ParamType = str | Tuple[str | None, str | None, str]
_HeaderType = Any

class Message:
Expand Down
2 changes: 1 addition & 1 deletion stdlib/email/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sys
from email.charset import Charset
from typing import Optional, Tuple, Union, overload

_ParamType = str | Tuple[Optional[str], Optional[str], str]
_ParamType = str | Tuple[str | None, str | None, str]
_PDTZ = Tuple[int, int, int, int, int, int, int, int, int, int | None]

def quote(str: str) -> str: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/netrc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class NetrcParseError(Exception):
def __init__(self, msg: str, filename: StrOrBytesPath | None = ..., lineno: int | None = ...) -> None: ...

# (login, account, password) tuple
_NetrcTuple = Tuple[str, Optional[str], Optional[str]]
_NetrcTuple = Tuple[str, str | None, str | None]

class netrc:
hosts: dict[str, _NetrcTuple]
Expand Down
13 changes: 2 additions & 11 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -773,17 +773,8 @@ def execlpe(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoRetur
# Not separating out PathLike[str] and PathLike[bytes] here because it doesn't make much difference
# in practice, and doing so would explode the number of combinations in this already long union.
# All these combinations are necessary due to list being invariant.
_ExecVArgs = Union[
Tuple[StrOrBytesPath, ...],
List[bytes],
List[str],
List[PathLike[Any]],
List[bytes | str],
List[bytes | PathLike[Any]],
List[str | PathLike[Any]],
List[bytes | str | PathLike[Any]],
]
_ExecEnv = Mapping[bytes, Union[bytes, str]] | Mapping[str, Union[bytes, str]]
_ExecVArgs = Tuple[StrOrBytesPath, ...]| List[bytes]| List[str]| List[PathLike[Any]]| List[bytes | str]| List[bytes | PathLike[Any]]| List[str | PathLike[Any]]| List[bytes | str | PathLike[Any]]
_ExecEnv = Mapping[bytes, bytes | str] | Mapping[str, bytes | str]

def execv(__path: StrOrBytesPath, __argv: _ExecVArgs) -> NoReturn: ...
def execve(path: _FdOrAnyPath, argv: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
Expand Down
8 changes: 1 addition & 7 deletions stdlib/pickle.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,7 @@ class PickleError(Exception): ...
class PicklingError(PickleError): ...
class UnpicklingError(PickleError): ...

_reducedtype = Union[
str,
Tuple[Callable[..., Any], Tuple[Any, ...]],
Tuple[Callable[..., Any], Tuple[Any, ...], Any],
Tuple[Callable[..., Any], Tuple[Any, ...], Any, Iterator[Any] | None],
Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]], Optional[Iterator[Any]]],
]
_reducedtype = str | Tuple[Callable[..., Any], Tuple[Any, ...]] | Tuple[Callable[..., Any], Tuple[Any, ...], Any] | Tuple[Callable[..., Any], Tuple[Any, ...], Any, Iterator[Any] | None]| Tuple[Callable[..., Any], Tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None]

class Pickler:
fast: bool
Expand Down
23 changes: 11 additions & 12 deletions stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,21 @@ _CanvasItemId = int
_Color = str # typically '#rrggbb', '#rgb' or color names.
_Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options'
_Cursor = str | Tuple[str] | Tuple[str, str] | Tuple[str, str, str] | Tuple[str, str, str, str] # manual page: Tk_GetCursor
_EntryValidateCommand = Union[
Callable[[], bool], str, List[str], Tuple[str, ...]
] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P']
_GridIndex = Union[int, str, Literal["all"]]
# Example: entry['invalidcommand'] = [entry.register(print), '%P']
_EntryValidateCommand = Callable[[], bool]| str| List[str]| Tuple[str, ...]
_GridIndex = int | str| Literal["all"]
_ImageSpec = _Image | str # str can be from e.g. tkinter.image_names()
_Padding = Union[
_ScreenUnits,
Tuple[_ScreenUnits],
Tuple[_ScreenUnits, _ScreenUnits],
Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits],
Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits],
]
_Padding = (
_ScreenUnits
|Tuple[_ScreenUnits]
|Tuple[_ScreenUnits, _ScreenUnits]
|Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits]
|Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits]
)
_Relief = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] # manual page: Tk_GetRelief
_ScreenUnits = str | float # manual page: Tk_GetPixels
_XYScrollCommand = str | Callable[[float, float], Any] # -xscrollcommand and -yscrollcommand in 'options' manual page
_TakeFocusValue = Union[int, Literal[""], Callable[[str], bool | None]] # -takefocus in manual page named 'options'
_TakeFocusValue = int | Literal[""] | Callable[[str], bool | None] # -takefocus in manual page named 'options'

class EventType(str, Enum):
Activate: str
Expand Down
14 changes: 7 additions & 7 deletions stdlib/tkinter/font.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ ROMAN: Literal["roman"]
BOLD: Literal["bold"]
ITALIC: Literal["italic"]

_FontDescription = Union[
_FontDescription = (
# "Helvetica 12"
str,
str
# A font object constructed in Python
Font,
| Font
# ("Helvetica", 12, BOLD)
List[Any],
Tuple[Any, ...],
| List[Any]
| Tuple[Any, ...]
# A font object constructed in Tcl
_tkinter.Tcl_Obj,
]
| _tkinter.Tcl_Obj
)

class _FontDict(TypedDict):
family: str
Expand Down
26 changes: 12 additions & 14 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -638,21 +638,19 @@ class Pattern(Generic[AnyStr]):
# Functions

if sys.version_info >= (3, 7):
_get_type_hints_obj_allowed_types = Union[
object,
Callable[..., Any],
FunctionType,
BuiltinFunctionType,
MethodType,
ModuleType,
WrapperDescriptorType,
MethodWrapperType,
MethodDescriptorType,
]
_get_type_hints_obj_allowed_types = (
object
| Callable[..., Any]
| FunctionType
| BuiltinFunctionType
| MethodType
| ModuleType
| WrapperDescriptorType
| MethodWrapperType
| MethodDescriptorType
)
else:
_get_type_hints_obj_allowed_types = Union[
object, Callable[..., Any], FunctionType, BuiltinFunctionType, MethodType, ModuleType,
]
_get_type_hints_obj_allowed_types = object | Callable[..., Any] | FunctionType | BuiltinFunctionType | MethodType | ModuleType

if sys.version_info >= (3, 9):
def get_type_hints(
Expand Down
4 changes: 1 addition & 3 deletions stubs/Pillow/PIL/Image.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ _Resample = Literal[0, 1, 2, 3, 4, 5]
_Size = Tuple[int, int]
_Box = Tuple[int, int, int, int]

_ConversionMatrix = Union[
Tuple[float, float, float, float], Tuple[float, float, float, float, float, float, float, float, float, float, float, float],
]
_ConversionMatrix = Tuple[float, float, float, float]| Tuple[float, float, float, float, float, float, float, float, float, float, float, float]
_Color = float | Tuple[float, ...]

class _Writeable(SupportsWrite[bytes], Protocol):
Expand Down
2 changes: 1 addition & 1 deletion stubs/pyaudio/pyaudio.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ paMacCoreStreamInfo: PaMacCoreStreamInfo
_ChannelMap = Sequence[int]
_PaHostApiInfo = Mapping[str, str | int]
_PaDeviceInfo = Mapping[str, str | int | float]
_StreamCallback = Callable[[Optional[bytes], int, Mapping[str, float], int], Tuple[Optional[bytes], int]]
_StreamCallback = Callable[[bytes | None, int, Mapping[str, float], int], Tuple[bytes | None, int]]

def get_format_from_width(width: int, unsigned: bool = ...) -> int: ...
def get_portaudio_version() -> int: ...
Expand Down
7 changes: 1 addition & 6 deletions stubs/requests/requests/sessions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ _HooksInput = MutableMapping[Text, Iterable[_Hook] | _Hook]

_ParamsMappingKeyType = Text | bytes | int | float
_ParamsMappingValueType = Text | bytes | int | float | Iterable[Text | bytes | int | float] | None
_Params = Union[
SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType],
Tuple[_ParamsMappingKeyType, _ParamsMappingValueType],
Iterable[Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]],
Text | bytes,
]
_Params = SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType]| Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]| Iterable[Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]]| Text | bytes
_TextMapping = MutableMapping[Text, Text]
_SessionT = TypeVar("_SessionT", bound=Session)

Expand Down