Simplify and correct many numeric unions (#7906)

Unblocks PyCQA/flake8-pyi#222
This commit is contained in:
Alex Waygood
2022-05-21 15:25:00 +01:00
committed by GitHub
parent 7576805aee
commit 76a4bd796b
17 changed files with 30 additions and 26 deletions

View File

@@ -13,13 +13,13 @@ class _Acquire_ReturnProxy:
) -> None: ...
class BaseFileLock:
def __init__(self, lock_file: str, timeout: float | int | str = ...) -> None: ...
def __init__(self, lock_file: str, timeout: float | str = ...) -> None: ...
@property
def lock_file(self) -> str: ...
@property
def timeout(self) -> float: ...
@timeout.setter
def timeout(self, value: int | str | float) -> None: ... # type: ignore
def timeout(self, value: str | float) -> None: ... # type: ignore
@property
def is_locked(self) -> bool: ...
def acquire(self, timeout: float | None = ..., poll_intervall: float = ...) -> _Acquire_ReturnProxy: ...

View File

@@ -28,7 +28,7 @@ class MockSpan(Span):
@property
def context(self) -> SpanContext: ...
def set_operation_name(self: Self, operation_name: str) -> Self: ...
def set_tag(self: Self, key: str, value: str | bool | int | float) -> Self: ...
def set_tag(self: Self, key: str, value: str | bool | float) -> Self: ...
def log_kv(self: Self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ...
def set_baggage_item(self: Self, key: str, value: str) -> Self: ...

View File

@@ -17,7 +17,7 @@ class Span:
def tracer(self) -> Tracer: ...
def set_operation_name(self: Self, operation_name: str) -> Self: ...
def finish(self, finish_time: float | None = ...) -> None: ...
def set_tag(self: Self, key: str, value: str | bool | int | float) -> Self: ...
def set_tag(self: Self, key: str, value: str | bool | float) -> Self: ...
def log_kv(self: Self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ...
def set_baggage_item(self: Self, key: str, value: str) -> Self: ...
def get_baggage_item(self, key: str) -> str | None: ...

View File

@@ -10,7 +10,7 @@ from google.protobuf.message import Message
_T = TypeVar("_T")
_K = TypeVar("_K", bound=bool | int | str)
_ScalarV = TypeVar("_ScalarV", bound=bool | int | float | str | bytes)
_ScalarV = TypeVar("_ScalarV", bound=bool | float | str | bytes)
_MessageV = TypeVar("_MessageV", bound=Message)
_M = TypeVar("_M")

View File

@@ -8,7 +8,7 @@ from google.protobuf.message import Message
_ContainerMessageT = TypeVar("_ContainerMessageT", bound=Message)
_ExtenderMessageT = TypeVar(
"_ExtenderMessageT",
bound=Message | RepeatedScalarFieldContainer[Any] | RepeatedCompositeFieldContainer[Any] | bool | int | float | str | bytes,
bound=Message | RepeatedScalarFieldContainer[Any] | RepeatedCompositeFieldContainer[Any] | bool | float | str | bytes,
)
class _ExtensionFieldDescriptor(FieldDescriptor, Generic[_ContainerMessageT, _ExtenderMessageT]): ...

View File

@@ -69,7 +69,7 @@ paMacCoreStreamInfo: PaMacCoreStreamInfo
# Auxiliary types
_ChannelMap: TypeAlias = Sequence[int]
_PaHostApiInfo: TypeAlias = Mapping[str, str | int]
_PaDeviceInfo: TypeAlias = Mapping[str, str | int | float]
_PaDeviceInfo: TypeAlias = Mapping[str, str | float]
_StreamCallback: TypeAlias = Callable[[bytes | None, int, Mapping[str, float], int], tuple[bytes | None, int]]
def get_format_from_width(width: int, unsigned: bool = ...) -> int: ...

View File

@@ -31,14 +31,14 @@ class Lock:
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> bool | None: ...
def acquire(
self, blocking: bool | None = ..., blocking_timeout: None | int | float = ..., token: str | bytes | None = ...
self, blocking: bool | None = ..., blocking_timeout: float | None = ..., token: str | bytes | None = ...
) -> bool: ...
def do_acquire(self, token: str | bytes) -> bool: ...
def locked(self) -> bool: ...
def owned(self) -> bool: ...
def release(self) -> None: ...
def do_release(self, expected_token: str | bytes) -> None: ...
def extend(self, additional_time: int | float, replace_ttl: bool = ...) -> bool: ...
def do_extend(self, additional_time: int | float, replace_ttl: bool) -> bool: ...
def extend(self, additional_time: float, replace_ttl: bool = ...) -> bool: ...
def do_extend(self, additional_time: float, replace_ttl: bool) -> bool: ...
def reacquire(self) -> bool: ...
def do_reacquire(self) -> bool: ...

View File

@@ -237,7 +237,7 @@ class Repr(expr):
value: expr
class Num(expr):
n: int | float | complex
n: complex
class Str(expr):
s: str | bytes

View File

@@ -252,7 +252,7 @@ class Call(expr):
keywords: list[keyword]
class Num(expr):
n: float | int | complex
n: complex
class Str(expr):
s: str