Style: prefer type[Foo | Bar] over type[Foo] | type[Bar] (#10039)

This commit is contained in:
Alex Waygood
2023-04-13 10:34:53 +01:00
committed by GitHub
parent 084f555793
commit 2279886964
5 changed files with 45 additions and 43 deletions

View File

@@ -129,8 +129,8 @@ def Binary(data: ReadableBuffer) -> memoryview: ...
Decimal = decimal.Decimal
NUMBER: type[int] | type[float] | type[complex]
DATETIME: type[date] | type[time] | type[datetime]
NUMBER: type[int | float | complex]
DATETIME: type[date | time | datetime]
STRING = str
BINARY = memoryview
ROWID = int

View File

@@ -35,16 +35,16 @@ class IAB(BaseIdentifier):
class EUI(BaseIdentifier):
def __init__(
self, addr: EUI | int | str, version: int | None = None, dialect: type[mac_eui48] | type[eui64_base] | None = None
self, addr: EUI | int | str, version: int | None = None, dialect: type[mac_eui48 | eui64_base] | None = None
) -> None: ...
@property
def value(self) -> int: ...
@value.setter
def value(self, value: str | SupportsInt | SupportsIndex) -> None: ...
@property
def dialect(self) -> type[mac_eui48] | type[eui64_base]: ...
def dialect(self) -> type[mac_eui48 | eui64_base]: ...
@dialect.setter
def dialect(self, value: type[mac_eui48] | type[eui64_base] | None) -> None: ...
def dialect(self, value: type[mac_eui48 | eui64_base] | None) -> None: ...
@property
def oui(self) -> OUI: ...
@property
@@ -81,4 +81,4 @@ class EUI(BaseIdentifier):
def ipv6_link_local(self) -> IPAddress: ...
@property
def info(self) -> DictDotLookup: ...
def format(self, dialect: type[mac_eui48] | type[eui64_base] | None = None) -> str: ...
def format(self, dialect: type[mac_eui48 | eui64_base] | None = None) -> str: ...

View File

@@ -26,7 +26,7 @@ class IABIndexParser(Publisher):
def parse(self) -> None: ...
def create_index_from_registry(
registry_fh: BinaryIO | FileDescriptorOrPath, index_path: StrOrBytesPath, parser: type[OUIIndexParser] | type[IABIndexParser]
registry_fh: BinaryIO | FileDescriptorOrPath, index_path: StrOrBytesPath, parser: type[OUIIndexParser | IABIndexParser]
) -> None: ...
def create_indices() -> None: ...
def load_index(index: _INDEX, fp: Iterable[bytes]) -> None: ...

View File

@@ -15,7 +15,7 @@ from .rsa_backend import RSAKey as BackendRSAKey
# then falling back on other imports
# these are all the potential options
AESKey: type[CryptographyAESKey] | None
HMACKey: type[CryptographyHMACKey] | type[NativeHMACKey]
RSAKey: type[CryptographyRSAKey] | type[BackendRSAKey] | None
ECKey: type[CryptographyECKey] | type[ECDSAECKey]
HMACKey: type[CryptographyHMACKey | NativeHMACKey]
RSAKey: type[CryptographyRSAKey | BackendRSAKey] | None
ECKey: type[CryptographyECKey | ECDSAECKey]
get_random_bytes: Callable[[int], bytes]

View File

@@ -43,38 +43,40 @@ class KeymapNotify(rq.Event): ...
_EventClass: TypeAlias = dict[
int,
type[KeyPress]
| type[KeyRelease]
| type[ButtonPress]
| type[ButtonRelease]
| type[MotionNotify]
| type[EnterNotify]
| type[LeaveNotify]
| type[FocusIn]
| type[FocusOut]
| type[KeymapNotify]
| type[Expose]
| type[GraphicsExpose]
| type[NoExpose]
| type[VisibilityNotify]
| type[CreateNotify]
| type[DestroyNotify]
| type[UnmapNotify]
| type[MapNotify]
| type[MapRequest]
| type[ReparentNotify]
| type[ConfigureNotify]
| type[ConfigureRequest]
| type[GravityNotify]
| type[ResizeRequest]
| type[CirculateNotify]
| type[CirculateRequest]
| type[PropertyNotify]
| type[SelectionClear]
| type[SelectionRequest]
| type[SelectionNotify]
| type[ColormapNotify]
| type[ClientMessage]
| type[MappingNotify],
type[
KeyPress
| KeyRelease
| ButtonPress
| ButtonRelease
| MotionNotify
| EnterNotify
| LeaveNotify
| FocusIn
| FocusOut
| KeymapNotify
| Expose
| GraphicsExpose
| NoExpose
| VisibilityNotify
| CreateNotify
| DestroyNotify
| UnmapNotify
| MapNotify
| MapRequest
| ReparentNotify
| ConfigureNotify
| ConfigureRequest
| GravityNotify
| ResizeRequest
| CirculateNotify
| CirculateRequest
| PropertyNotify
| SelectionClear
| SelectionRequest
| SelectionNotify
| ColormapNotify
| ClientMessage
| MappingNotify
],
]
event_class: Final[_EventClass]