mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-03 10:03:32 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Optional, Sequence, Tuple, Union, overload
|
||||
from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Sequence, Tuple, overload
|
||||
|
||||
_NDArray = Any # FIXME: no typings for numpy arrays
|
||||
|
||||
@@ -47,8 +47,8 @@ class Client:
|
||||
name: str,
|
||||
use_exact_name: bool = ...,
|
||||
no_start_server: bool = ...,
|
||||
servername: Optional[str] = ...,
|
||||
session_id: Optional[str] = ...,
|
||||
servername: str | None = ...,
|
||||
session_id: str | None = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@@ -78,13 +78,13 @@ class Client:
|
||||
def midi_inports(self) -> Ports: ...
|
||||
@property
|
||||
def midi_outports(self) -> Ports: ...
|
||||
def owns(self, port: Union[str, Port]) -> bool: ...
|
||||
def owns(self, port: str | Port) -> bool: ...
|
||||
def activate(self) -> None: ...
|
||||
def deactivate(self, ignore_errors: bool = ...) -> None: ...
|
||||
def cpu_load(self) -> float: ...
|
||||
def close(self, ignore_errors: bool = ...) -> None: ...
|
||||
def connect(self, source: Union[str, Port], destination: Union[str, Port]) -> None: ...
|
||||
def disconnect(self, source: Union[str, Port], destination: Union[str, Port]) -> None: ...
|
||||
def connect(self, source: str | Port, destination: str | Port) -> None: ...
|
||||
def disconnect(self, source: str | Port, destination: str | Port) -> None: ...
|
||||
def transport_start(self) -> None: ...
|
||||
def transport_stop(self) -> None: ...
|
||||
@property
|
||||
@@ -106,20 +106,20 @@ class Client:
|
||||
def set_samplerate_callback(self, callback: Callable[[int], None]) -> None: ...
|
||||
def set_client_registration_callback(self, callback: Callable[[str, bool], None]) -> None: ...
|
||||
def set_port_registration_callback(
|
||||
self, callback: Optional[Callable[[Port, bool], None]] = ..., only_available: bool = ...
|
||||
self, callback: Callable[[Port, bool], None] | None = ..., only_available: bool = ...
|
||||
) -> None: ...
|
||||
def set_port_connect_callback(
|
||||
self, callback: Optional[Callable[[Port, Port, bool], None]] = ..., only_available: bool = ...
|
||||
self, callback: Callable[[Port, Port, bool], None] | None = ..., only_available: bool = ...
|
||||
) -> None: ...
|
||||
def set_port_rename_callback(
|
||||
self, callback: Optional[Callable[[Port, str, str], None]] = ..., only_available: bool = ...
|
||||
self, callback: Callable[[Port, str, str], None] | None = ..., only_available: bool = ...
|
||||
) -> None: ...
|
||||
def set_graph_order_callback(self, callback: Callable[[], None]) -> None: ...
|
||||
def set_xrun_callback(self, callback: Callable[[float], None]) -> None: ...
|
||||
def set_sync_callback(self, callback: Optional[Callable[[int, _JackPositionT], None]]) -> None: ...
|
||||
def set_sync_callback(self, callback: Callable[[int, _JackPositionT], None] | None) -> None: ...
|
||||
def release_timebase(self) -> None: ...
|
||||
def set_timebase_callback(
|
||||
self, callback: Optional[Callable[[int, int, _JackPositionT, bool], None]] = ..., conditional: bool = ...
|
||||
self, callback: Callable[[int, int, _JackPositionT, bool], None] | None = ..., conditional: bool = ...
|
||||
) -> bool: ...
|
||||
def set_property_change_callback(self, callback: Callable[[int, str, int], None]) -> None: ...
|
||||
def get_uuid_for_client_name(self, name: str) -> str: ...
|
||||
@@ -137,9 +137,9 @@ class Client:
|
||||
can_monitor: bool = ...,
|
||||
is_terminal: bool = ...,
|
||||
) -> List[Port]: ...
|
||||
def set_property(self, subject: Union[int, str], key: str, value: Union[str, bytes], type: str = ...) -> None: ...
|
||||
def remove_property(self, subject: Union[int, str], key: str) -> None: ...
|
||||
def remove_properties(self, subject: Union[int, str]) -> int: ...
|
||||
def set_property(self, subject: int | str, key: str, value: str | bytes, type: str = ...) -> None: ...
|
||||
def remove_property(self, subject: int | str, key: str) -> None: ...
|
||||
def remove_properties(self, subject: int | str) -> int: ...
|
||||
def remove_all_properties(self) -> None: ...
|
||||
|
||||
class Port:
|
||||
@@ -181,9 +181,9 @@ class OwnPort(Port):
|
||||
def number_of_connections(self) -> int: ...
|
||||
@property
|
||||
def connections(self) -> List[Port]: ...
|
||||
def is_connected_to(self, port: Union[str, Port]) -> bool: ...
|
||||
def connect(self, port: Union[str, Port]) -> None: ...
|
||||
def disconnect(self, other: Optional[Union[str, Port]] = ...) -> None: ...
|
||||
def is_connected_to(self, port: str | Port) -> bool: ...
|
||||
def connect(self, port: str | Port) -> None: ...
|
||||
def disconnect(self, other: str | Port | None = ...) -> None: ...
|
||||
def unregister(self) -> None: ...
|
||||
def get_buffer(self) -> _CBufferType: ...
|
||||
def get_array(self) -> _NDArray: ...
|
||||
@@ -198,7 +198,7 @@ class OwnMidiPort(MidiPort, OwnPort):
|
||||
def lost_midi_events(self) -> int: ...
|
||||
def incoming_midi_events(self) -> Generator[Tuple[int, _CBufferType], None, None]: ...
|
||||
def clear_buffer(self) -> None: ...
|
||||
def write_midi_event(self, time: int, event: Union[bytes, Sequence[int], _CBufferType]) -> None: ...
|
||||
def write_midi_event(self, time: int, event: bytes | Sequence[int] | _CBufferType) -> None: ...
|
||||
def reserve_midi_event(self, time: int, size: int) -> _CBufferType: ...
|
||||
|
||||
class Ports:
|
||||
@@ -213,7 +213,7 @@ class RingBuffer:
|
||||
def __init__(self, size: int) -> None: ...
|
||||
@property
|
||||
def write_space(self) -> int: ...
|
||||
def write(self, data: Union[bytes, Iterable[int], _CBufferType]) -> int: ...
|
||||
def write(self, data: bytes | Iterable[int] | _CBufferType) -> int: ...
|
||||
@property
|
||||
def write_buffers(self) -> Tuple[_CBufferType, _CBufferType]: ...
|
||||
def write_advance(self, size: int) -> None: ...
|
||||
@@ -225,7 +225,7 @@ class RingBuffer:
|
||||
def read_buffers(self) -> Tuple[_CBufferType, _CBufferType]: ...
|
||||
def read_advance(self, size: int) -> None: ...
|
||||
def mlock(self) -> None: ...
|
||||
def reset(self, size: Optional[int] = ...) -> None: ...
|
||||
def reset(self, size: int | None = ...) -> None: ...
|
||||
@property
|
||||
def size(self) -> int: ...
|
||||
|
||||
@@ -265,14 +265,14 @@ class TransportState:
|
||||
|
||||
class CallbackExit(Exception): ...
|
||||
|
||||
def get_property(subject: Union[int, str], key: str) -> Optional[Tuple[bytes, str]]: ...
|
||||
def get_properties(subject: Union[int, str]) -> Dict[str, Tuple[bytes, str]]: ...
|
||||
def get_property(subject: int | str, key: str) -> Tuple[bytes, str] | None: ...
|
||||
def get_properties(subject: int | str) -> Dict[str, Tuple[bytes, str]]: ...
|
||||
def get_all_properties() -> Dict[str, Dict[str, Tuple[bytes, str]]]: ...
|
||||
def position2dict(pos: _JackPositionT) -> Dict[str, Any]: ...
|
||||
def version() -> Tuple[int, int, int, int]: ...
|
||||
def version_string() -> str: ...
|
||||
def client_name_size() -> int: ...
|
||||
def port_name_size() -> int: ...
|
||||
def set_error_function(callback: Optional[Callable[[str], None]] = ...) -> None: ...
|
||||
def set_info_function(callback: Optional[Callable[[str], None]] = ...) -> None: ...
|
||||
def set_error_function(callback: Callable[[str], None] | None = ...) -> None: ...
|
||||
def set_info_function(callback: Callable[[str], None] | None = ...) -> None: ...
|
||||
def client_pid(name: str) -> int: ...
|
||||
|
||||
Reference in New Issue
Block a user