brk-code

trio の API リファレンス

trio (python-trio/trio) の公開 API 156 件 —— クラス 38、関数 48、メソッド 70。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: python-trio/trio

種別件数
クラス38
関数48
メソッド70

API 一覧

methodsrc.trio._abc.AsyncResource.aclose() -> None
Close this resource, possibly blocking.
classsrc.trio._abc.Channel
A standard interface for interacting with bidirectional channels.
classsrc.trio._abc.Clock
The interface for custom run loop clocks.
methodsrc.trio._abc.Clock.current_time() -> float
Return the current time, according to this clock.
methodsrc.trio._abc.Clock.deadline_to_sleep_time(deadline:float) -> float
Compute the real time until the given deadline.
methodsrc.trio._abc.Clock.start_clock() -> None
Do any setup this clock might need.
classsrc.trio._abc.Instrument
The interface for run loop instrumentation.
methodsrc.trio._abc.Instrument.after_io_wait(timeout:float) -> None
Called after handling pending I/O.
methodsrc.trio._abc.Instrument.after_run() -> None
Called just before :func:`trio.run` returns.
methodsrc.trio._abc.Instrument.after_task_step(task:Task) -> None
Called when we return to the main run loop after a task has yielded.
methodsrc.trio._abc.Instrument.before_io_wait(timeout:float) -> None
Called before blocking to wait for I/O readiness.
methodsrc.trio._abc.Instrument.before_run() -> None
Called at the beginning of :func:`trio.run`.
methodsrc.trio._abc.Instrument.before_task_step(task:Task) -> None
Called immediately before we resume running the given task.
methodsrc.trio._abc.Instrument.task_exited(task:Task) -> None
Called when the given task exits.
methodsrc.trio._abc.Instrument.task_scheduled(task:Task) -> None
Called when the given task becomes runnable.
methodsrc.trio._abc.Instrument.task_spawned(task:Task) -> None
Called when the given task is created.
classsrc.trio._abc.Listener
A standard interface for listening for incoming connections.
classsrc.trio._abc.ReceiveStream
A standard interface for receiving data on a byte stream.
methodsrc.trio._abc.SendChannel.send(value:SendType) -> None
Attempt to send an object through the channel, blocking if necessary.
classsrc.trio._abc.SendStream
A standard interface for sending data on a byte stream.
methodsrc.trio._abc.SendStream.send_all(data:bytes | bytearray | memoryview) -> None
Sends the given data through the stream, blocking if necessary.
classsrc.trio._channel.MemoryReceiveChannel
A memory channel endpoint for receiving Python objects.
methodsrc.trio._channel.MemoryReceiveChannel.aclose() -> None
Close this receive channel object asynchronously.
methodsrc.trio._channel.MemoryReceiveChannel.clone() -> MemoryReceiveChannel[ReceiveType]
Clone this receive channel object.
methodsrc.trio._channel.MemoryReceiveChannel.close() -> None
Close this receive channel object synchronously.
classsrc.trio._channel.MemorySendChannel
A memory channel endpoint for sending Python objects.
methodsrc.trio._channel.MemorySendChannel.aclose() -> None
Close this send channel object asynchronously.
methodsrc.trio._channel.MemorySendChannel.clone() -> MemorySendChannel[SendType]
Clone this send channel object.
methodsrc.trio._channel.MemorySendChannel.close() -> None
Close this send channel object synchronously.
methodsrc.trio._channel.MemorySendChannel.send(value:SendType) -> None
See `SendChannel.send <trio.abc.SendChannel.send>`.
classsrc.trio._core._exceptions.WouldBlock
Raised by ``X_nowait`` functions if ``X`` would block.
funcsrc.trio._core._generated_io_epoll.notify_closing(fd:int | _HasFileNo) -> None
Notify waiters of the given object that it will be closed.
funcsrc.trio._core._generated_io_epoll.wait_readable(fd:int | _HasFileNo) -> None
Block until the kernel reports that the given object is readable.
funcsrc.trio._core._generated_io_epoll.wait_writable(fd:int | _HasFileNo) -> None
Block until the kernel reports that the given object is writable.
funcsrc.trio._core._generated_io_kqueue.notify_closing(fd:int | _HasFileNo) -> None
Notify waiters of the given object that it will be closed.
funcsrc.trio._core._generated_io_windows.notify_closing(handle:Handle | int | _HasFileNo) -> None
Notify waiters of the given object that it will be closed.
funcsrc.trio._core._generated_run.current_clock() -> Clock
Returns the current :class:`~trio.abc.Clock`.
funcsrc.trio._core._generated_run.current_root_task() -> Task | None
Returns the current root :class:`Task`.
funcsrc.trio._core._generated_run.reschedule(task:Task, next_send:outcome.Outcome[object]=_NO_SEND) -> None
Reschedule the given task with the given :class:`outcome.Outcome`.
funcsrc.trio._core._generated_run.spawn_system_task(async_fn:Callable[[Unpack[PosArgT]], Awaitable[object]], *name:object=None, *context:contextvars.Context | None=None, *args:Unpack[PosArgT]) -> Task
Spawn a "system" task.
funcsrc.trio._core._generated_run.wait_all_tasks_blocked(cushion:float=0.0) -> None
Block until there are no runnable tasks.
classsrc.trio._core._instrumentation.Instruments
A collection of `trio.abc.Instrument` organized by hook.
methodsrc.trio._core._instrumentation.Instruments.call(hookname:str, *args:object) -> None
Call hookname(*args) on each applicable instrument.
funcsrc.trio._core._ki.disable_ki_protection(f:_T_supports_code) -> _T_supports_code
Decorator to disable KI protection.
funcsrc.trio._core._ki.enable_ki_protection(f:_T_supports_code) -> _T_supports_code
Decorator to enable KI protection.
classsrc.trio._core._local.RunVar
The run-local variant of a context variable.
methodsrc.trio._core._local.RunVar.get(default:T | type[_NoValue]=_NoValue) -> T
Gets the value of this :class:`RunVar` for the current run call.
methodsrc.trio._core._local.RunVar.set(value:T) -> RunVarToken[T]
Sets the value of this :class:`RunVar` for this current run call.
classsrc.trio._core._mock_clock.MockClock
A user-controllable clock suitable for writing tests.
methodsrc.trio._core._mock_clock.MockClock.jump(seconds:float) -> None
Manually advance the clock by the given number of seconds.
classsrc.trio._core._parking_lot.ParkingLot
A fair wait queue with cancellation and requeuing.
methodsrc.trio._core._parking_lot.ParkingLot.break_lot(task:Task | None=None) -> None
Break this lot, with ``task`` noted as the task that broke it.
methodsrc.trio._core._parking_lot.ParkingLot.unpark(*count:int | float=1) -> list[Task]
Unpark one or more tasks.
methodsrc.trio._core._parking_lot.ParkingLot.unpark_all() -> list[Task]
Unpark all parked tasks.
funcsrc.trio._core._parking_lot.add_parking_lot_breaker(task:Task, lot:ParkingLot) -> None
Register a task as a breaker for a lot.
funcsrc.trio._core._parking_lot.remove_parking_lot_breaker(task:Task, lot:ParkingLot) -> None
Deregister a task as a breaker for a lot.
methodsrc.trio._core._run.CancelScope.cancel(reason:str | None=None) -> None
Cancels this scope immediately.
methodsrc.trio._core._run.CancelScope.cancel_called() -> bool
Readonly :class:`bool`.
methodsrc.trio._core._run.CancelScope.deadline() -> float
Read-write, :class:`float`.
methodsrc.trio._core._run.CancelScope.is_relative() -> bool | None
Returns None after entering.
methodsrc.trio._core._run.CancelScope.relative_deadline() -> float
Read-write, :class:`float`.
methodsrc.trio._core._run.CancelScope.shield() -> bool
Read-write, :class:`bool`, default :data:`False`.
classsrc.trio._core._run.Deadlines
A container of deadlined cancel scopes.
classsrc.trio._core._run.Nursery
A context which may be used to spawn (or cancel) child tasks.
methodsrc.trio._core._run.Nursery.start(async_fn:Callable[..., Awaitable[object]], *name:object=None, *args:object) -> Any
Creates and initializes a child task.
classsrc.trio._core._run.NurseryManager
Nursery context manager.
classsrc.trio._core._run.RunStatistics
An object containing run-loop-level debugging information.
methodsrc.trio._core._run.Runner.current_clock() -> Clock
Returns the current :class:`~trio.abc.Clock`.
methodsrc.trio._core._run.Runner.current_root_task() -> Task | None
Returns the current root :class:`Task`.
methodsrc.trio._core._run.Runner.spawn_system_task(async_fn:Callable[[Unpack[PosArgT]], Awaitable[object]], *name:object=None, *context:contextvars.Context | None=None, *args:Unpack[PosArgT]) -> Task
Spawn a "system" task.
methodsrc.trio._core._run.Runner.wait_all_tasks_blocked(cushion:float=0.0) -> None
Block until there are no runnable tasks.
methodsrc.trio._core._run.Task.child_nurseries() -> list[Nursery]
The nurseries this task contains.
funcsrc.trio._core._run.checkpoint() -> None
A pure :ref:`checkpoint <checkpoints>`.
funcsrc.trio._core._run.current_task() -> Task
Return the :class:`Task` object representing the current task.
funcsrc.trio._core._run.in_trio_run() -> bool
Check whether we are in a Trio run.
funcsrc.trio._core._run.in_trio_task() -> bool
Check whether we are in a Trio task.
funcsrc.trio._core._tests.type_tests.nursery_start.check_start_soon(nursery:Nursery) -> None
start_soon() functionality.
funcsrc.trio._core._tests.type_tests.nursery_start.task_pos_or_kw(value:str, task_status:TaskStatus[int]) -> None
Check a function which doesn't use the *-syntax works.
funcsrc.trio._core._tests.type_tests.nursery_start.task_requires_start(*task_status:TaskStatus[str]) -> None
Check a function requiring start() to be used.
funcsrc.trio._core._traps.cancel_shielded_checkpoint() -> None
Introduce a schedule point, but not a cancel point.
funcsrc.trio._core._traps.wait_task_rescheduled(abort_func:Callable[[RaiseCancelT], Abort]) -> Any
Put the current task to sleep, with cancellation support.
classsrc.trio._core._unbounded_queue.UnboundedQueueStatistics
An object containing debugging information.
funcsrc.trio._core._windows_cffi.handle_array(count:int) -> HandleArray
Make an array of handles.
classsrc.trio._deprecate.TrioDeprecationWarning
Warning emitted if you use deprecated Trio functionality.
classsrc.trio._dtls.DTLSChannel
A DTLS connection.
methodsrc.trio._dtls.DTLSChannel.aclose() -> None
Close this connection, but asynchronously.
methodsrc.trio._dtls.DTLSChannel.close() -> None
Close this connection.
methodsrc.trio._dtls.DTLSChannel.do_handshake(*initial_retransmit_timeout:float=1.0) -> None
Perform the handshake.
methodsrc.trio._dtls.DTLSChannel.send(data:bytes) -> None
Send a packet of data, securely.
classsrc.trio._dtls.DTLSEndpoint
A DTLS endpoint.
methodsrc.trio._dtls.DTLSEndpoint.close() -> None
Close this socket, and all associated DTLS connections.
methodsrc.trio._dtls.DTLSEndpoint.connect(address:tuple[str, int], ssl_context:SSL.Context) -> DTLSChannel
Initiate an outgoing DTLS connection.
methodsrc.trio._highlevel_socket.SocketListener.accept() -> SocketStream
Accept an incoming connection.
methodsrc.trio._highlevel_socket.SocketListener.aclose() -> None
Close this listener and its underlying socket.
funcsrc.trio._signals.get_pending_signal_count(rec:AsyncIterator[int]) -> int
Helper for tests, not public or otherwise used.
funcsrc.trio._signals.open_signal_receiver(*signals:signal.Signals | int) -> Generator[AsyncIterator[int], None, None]
A context manager for catching signals.
methodsrc.trio._socket.SocketType.is_readable() -> bool
Return True if the socket is readable.
funcsrc.trio._socket.fromshare(info:bytes) -> SocketType
Like :func:`socket.fromshare`, but returns a Trio socket object.
funcsrc.trio._socket.getnameinfo(sockaddr:tuple[str, int] | tuple[str, int, int, int], flags:int) -> tuple[str, str]
Look up a name given a numeric address.
funcsrc.trio._socket.getprotobyname(name:str) -> int
Look up a protocol number by name.
funcsrc.trio._socket.set_custom_hostname_resolver(hostname_resolver:HostnameResolver | None) -> HostnameResolver | None
Set a custom hostname resolver.
funcsrc.trio._socket.set_custom_socket_factory(socket_factory:SocketFactory | None) -> SocketFactory | None
Set a custom socket object factory.
classsrc.trio._ssl.SSLListener
A :class:`~trio.abc.Listener` for SSL/TLS-encrypted servers.
methodsrc.trio._ssl.SSLListener.aclose() -> None
Close the transport listener.
classsrc.trio._ssl.SSLStream
Encrypted communication using SSL/TLS.
methodsrc.trio._ssl.SSLStream.do_handshake() -> None
Ensure that the initial handshake has completed.
methodsrc.trio._ssl.SSLStream.send_all(data:bytes | bytearray | memoryview) -> None
Encrypt some data and then send it on the underlying transport.
classsrc.trio._subprocess.GeneralProcessArgs
Arguments shared between all runs.
classsrc.trio._subprocess.HasFileno
Represents any file-like object that has a file descriptor.
classsrc.trio._subprocess.Process
A child process.
methodsrc.trio._subprocess.Process.kill() -> None
Immediately terminate the process.
methodsrc.trio._subprocess.Process.send_signal(sig:signal.Signals | int) -> None
Send signal ``sig`` to the process.
methodsrc.trio._subprocess.Process.terminate() -> None
Terminate the process, politely if possible.
methodsrc.trio._subprocess.Process.wait() -> int
Block until the process exits.
classsrc.trio._subprocess.UnixProcessArgs3_10
Arguments shared between all Unix runs.
classsrc.trio._subprocess.UnixProcessArgs3_11
Arguments shared between all Unix runs on 3.11+.
classsrc.trio._subprocess.UnixRunProcessArgs
Arguments for run_process on Unix with 3.11+
classsrc.trio._subprocess.UnixRunProcessMixin
Arguments unique to run_process on Unix.
classsrc.trio._subprocess.WindowsProcessArgs
Arguments shared between all Windows runs.
funcsrc.trio._subprocess.open_process(command:StrOrBytesPath | Sequence[StrOrBytesPath], *stdin:int | HasFileno | None=None, **kwargs:Unpack[WindowsProcessArgs]) -> trio.Process
Execute a child program in a new process.
funcsrc.trio._subprocess_platform.wait_child_exiting(process:_subprocess.Process) -> None
Block until the child process managed by ``process`` is exiting.
classsrc.trio._sync.CapacityLimiterStatistics
An object containing debugging information.
methodsrc.trio._sync.Condition.acquire() -> None
Acquire the underlying lock, blocking if necessary.
methodsrc.trio._sync.Condition.acquire_nowait() -> None
Attempt to acquire the underlying lock, without blocking.
methodsrc.trio._sync.Condition.locked() -> bool
Check whether the underlying lock is currently held.
methodsrc.trio._sync.Condition.notify(n:int=1) -> None
Wake one or more tasks that are blocked in :meth:`wait`.
methodsrc.trio._sync.Condition.notify_all() -> None
Wake all tasks that are currently blocked in :meth:`wait`.
methodsrc.trio._sync.Condition.release() -> None
Release the underlying lock.
methodsrc.trio._sync.Condition.statistics() -> ConditionStatistics
Return an object containing debugging information.
classsrc.trio._sync.ConditionStatistics
An object containing debugging information for a Condition.
methodsrc.trio._sync.Event.is_set() -> bool
Return the current value of the internal flag.
methodsrc.trio._sync.Event.statistics() -> EventStatistics
Return an object containing debugging information.
methodsrc.trio._sync.Event.wait() -> None
Block until the internal flag value becomes True.
classsrc.trio._sync.EventStatistics
An object containing debugging information.
classsrc.trio._sync.LockStatistics
An object containing debugging information for a Lock.
methodsrc.trio._sync.Semaphore.max_value() -> int | None
The maximum allowed value.
methodsrc.trio._sync.Semaphore.statistics() -> ParkingLotStatistics
Return an object containing debugging information.
methodsrc.trio._sync.Semaphore.value() -> int
The current value of the semaphore.
funcsrc.trio._tests.type_tests.path.operator_checks(text:str, tpath:trio.Path, ppath:pathlib.Path) -> None
Verify operators produce the right results.
funcsrc.trio._threads.wait_all_threads_completed() -> None
Wait until no threads are still running tasks.
funcsrc.trio._timeouts.sleep(seconds:float) -> None
Pause execution of the current task for the given number of seconds.
funcsrc.trio._timeouts.sleep_until(deadline:float) -> None
Pause execution of the current task until the given time.
funcsrc.trio._tools.gen_exports.get_public_methods(tree:ast.AST) -> Iterator[ast.FunctionDef | ast.AsyncFunctionDef]
Return a list of methods marked as public.
funcsrc.trio._tools.gen_exports.is_public(node:ast.AST) -> TypeGuard[ast.FunctionDef | ast.AsyncFunctionDef]
Check if the AST node has a _public decorator
funcsrc.trio._tools.gen_exports.run_black(file:File, source:str) -> tuple[bool, str]
Run black on the specified file.
funcsrc.trio._tools.gen_exports.run_linters(file:File, source:str) -> str
Format the specified file using black and ruff.
funcsrc.trio._tools.gen_exports.run_ruff(file:File, source:str) -> tuple[bool, str]
Run ruff on the specified file.
classsrc.trio._tools.mypy_annotate.Result
Accumulated results, used as a dict key to deduplicate.
funcsrc.trio._tools.mypy_annotate.export(results:dict[Result, list[str]]) -> None
Display the collected results.
funcsrc.trio._tools.mypy_annotate.main(argv:list[str]) -> None
Look for error messages, and convert the format.
funcsrc.trio._tools.sync_requirements.update_requirements(requirements:Path, version_data:dict[str, str]) -> bool
Return if updated requirements file.
classsrc.trio._util.NoPublicConstructor
Metaclass that ensures a private constructor.
funcsrc.trio._util.is_main_thread() -> bool
Attempt to reliably check if we are in the main thread.
funcsrc.trio._wait_for_object.WaitForMultipleObjects_sync(*handles:int | CData) -> None
Wait for any of the given Windows handles to be signaled.
funcsrc.trio._wait_for_object.WaitForSingleObject(obj:int | CData) -> None
Async and cancellable variant of WaitForSingleObject.
classsrc.trio._windows_pipes.PipeReceiveStream
Represents a receive stream over an os.pipe object.

この情報について

掲載しているシグネチャは python-trio/trio の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る