开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

source-code-analysis/python3.8.1

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
python3.8.1
/
Doc
/
library
/
asyncio-llapi-index.rst
python3.8.1
/
Doc
/
library
/
asyncio-llapi-index.rst
asyncio-llapi-index.rst 13.90 KB
一键复制 编辑 原始数据 按行查看 历史
zhangweibo 提交于 2021年11月16日 09:46 +08:00 . git init
.. currentmodule:: asyncio


Low-level API Index

This page lists all low-level asyncio APIs.

Obtaining the Event Loop

:func:`asyncio.get_running_loop` The preferred function to get the running event loop.
:func:`asyncio.get_event_loop` Get an event loop instance (current or via the policy).
:func:`asyncio.set_event_loop` Set the event loop as current via the current policy.
:func:`asyncio.new_event_loop` Create a new event loop.

Examples

Event Loop Methods

See also the main documentation section about the :ref:`event loop methods <asyncio-event-loop>`.

Lifecycle

:meth:`loop.run_until_complete` Run a Future/Task/awaitable until complete.
:meth:`loop.run_forever` Run the event loop forever.
:meth:`loop.stop` Stop the event loop.
:meth:`loop.close` Close the event loop.
:meth:`loop.is_running()` Return True if the event loop is running.
:meth:`loop.is_closed()` Return True if the event loop is closed.
await :meth:`loop.shutdown_asyncgens` Close asynchronous generators.

Debugging

:meth:`loop.set_debug` Enable or disable the debug mode.
:meth:`loop.get_debug` Get the current debug mode.

Scheduling Callbacks

:meth:`loop.call_soon` Invoke a callback soon.
:meth:`loop.call_later` Invoke a callback after the given time.
:meth:`loop.call_at` Invoke a callback at the given time.

Thread/Process Pool

await :meth:`loop.run_in_executor` Run a CPU-bound or other blocking function in a :mod:`concurrent.futures` executor.

Tasks and Futures

:meth:`loop.create_task` Schedule coroutine as a :class:`Task`.

DNS

await :meth:`loop.getaddrinfo` Asynchronous version of :meth:`socket.getaddrinfo`.
await :meth:`loop.getnameinfo` Asynchronous version of :meth:`socket.getnameinfo`.

Networking and IPC

await :meth:`loop.create_connection` Open a TCP connection.
await :meth:`loop.create_server` Create a TCP server.
await :meth:`loop.create_unix_connection` Open a Unix socket connection.
await :meth:`loop.create_unix_server` Create a Unix socket server.
await :meth:`loop.connect_accepted_socket` Wrap a :class:`~socket.socket` into a (transport, protocol) pair.
await :meth:`loop.create_datagram_endpoint` Open a datagram (UDP) connection.
await :meth:`loop.sendfile` Send a file over a transport.
await :meth:`loop.start_tls` Upgrade an existing connection to TLS.
await :meth:`loop.connect_read_pipe` Wrap a read end of a pipe into a (transport, protocol) pair.
await :meth:`loop.connect_write_pipe` Wrap a write end of a pipe into a (transport, protocol) pair.

Sockets

await :meth:`loop.sock_recv` Receive data from the :class:`~socket.socket`.
await :meth:`loop.sock_recv_into` Receive data from the :class:`~socket.socket` into a buffer.
:meth:`loop.add_reader` Start watching a file descriptor for read availability.
:meth:`loop.remove_reader` Stop watching a file descriptor for read availability.
:meth:`loop.add_writer` Start watching a file descriptor for write availability.
:meth:`loop.remove_writer` Stop watching a file descriptor for write availability.

Unix Signals

Subprocesses

:meth:`loop.subprocess_exec` Spawn a subprocess.
:meth:`loop.subprocess_shell` Spawn a subprocess from a shell command.

Error Handling

:meth:`loop.call_exception_handler` Call the exception handler.
:meth:`loop.set_exception_handler` Set a new exception handler.
:meth:`loop.get_exception_handler` Get the current exception handler.
:meth:`loop.default_exception_handler` The default exception handler implementation.

Examples

Transports

All transports implement the following methods:

:meth:`transport.is_closing() <BaseTransport.is_closing>` Return True if the transport is closing or is closed.
:meth:`transport.get_extra_info() <BaseTransport.get_extra_info>` Request for information about the transport.

Transports that can receive data (TCP and Unix connections, pipes, etc). Returned from methods like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_read_pipe`, etc:

Read Transports

:meth:`transport.is_reading() <ReadTransport.is_reading>` Return True if the transport is receiving.

Transports that can Send data (TCP and Unix connections, pipes, etc). Returned from methods like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_write_pipe`, etc:

Write Transports

:meth:`transport.write_eof() <WriteTransport.write_eof>` Close and send EOF after flushing buffered data.
:meth:`transport.abort() <WriteTransport.abort>` Close the transport immediately.
:meth:`transport.get_write_buffer_size() <WriteTransport.get_write_buffer_size>` Return high and low water marks for write flow control.
:meth:`transport.set_write_buffer_limits() <WriteTransport.set_write_buffer_limits>` Set new high and low water marks for write flow control.

Transports returned by :meth:`loop.create_datagram_endpoint`:

Datagram Transports

:meth:`transport.abort() <DatagramTransport.abort>` Close the transport immediately.

Low-level transport abstraction over subprocesses. Returned by :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell`:

Subprocess Transports

:meth:`transport.get_pipe_transport() <SubprocessTransport.get_pipe_transport>` Return the transport for the requested communication pipe (stdin, stdout, or stderr).
:meth:`transport.close() <SubprocessTransport.close>` Kill the subprocess and close all pipes.

Protocols

Protocol classes can implement the following callback methods:

callback :meth:`connection_made() <BaseProtocol.connection_made>` Called when a connection is made.
callback :meth:`connection_lost() <BaseProtocol.connection_lost>` Called when the connection is lost or closed.
callback :meth:`pause_writing() <BaseProtocol.pause_writing>` Called when the transport's buffer goes over the high water mark.
callback :meth:`resume_writing() <BaseProtocol.resume_writing>` Called when the transport's buffer drains below the low water mark.

Streaming Protocols (TCP, Unix Sockets, Pipes)

callback :meth:`data_received() <Protocol.data_received>` Called when some data is received.
callback :meth:`eof_received() <Protocol.eof_received>` Called when an EOF is received.

Buffered Streaming Protocols

callback :meth:`get_buffer() <BufferedProtocol.get_buffer>` Called to allocate a new receive buffer.
callback :meth:`buffer_updated() <BufferedProtocol.buffer_updated>` Called when the buffer was updated with the received data.
callback :meth:`eof_received() <BufferedProtocol.eof_received>` Called when an EOF is received.

Datagram Protocols

callback :meth:`datagram_received() <DatagramProtocol.datagram_received>` Called when a datagram is received.
callback :meth:`error_received() <DatagramProtocol.error_received>` Called when a previous send or receive operation raises an :class:`OSError`.

Subprocess Protocols

callback :meth:`pipe_data_received() <SubprocessProtocol.pipe_data_received>` Called when the child process writes data into its stdout or stderr pipe.
callback :meth:`pipe_connection_lost() <SubprocessProtocol.pipe_connection_lost>` Called when one of the pipes communicating with the child process is closed.
callback :meth:`process_exited() <SubprocessProtocol.process_exited>` Called when the child process has exited.

Event Loop Policies

Policies is a low-level mechanism to alter the behavior of functions like :func:`asyncio.get_event_loop`. See also the main :ref:`policies section <asyncio-policies>` for more details.

Accessing Policies

:meth:`asyncio.get_event_loop_policy` Return the current process-wide policy.
:meth:`asyncio.set_event_loop_policy` Set a new process-wide policy.
:class:`AbstractEventLoopPolicy` Base class for policy objects.
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/python_sourcecode/python3.8.1.git
git@gitee.com:python_sourcecode/python3.8.1.git
python_sourcecode
python3.8.1
python3.8.1
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /