Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ea29612b
Commit
ea29612b
authored
Nov 30, 2013
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asyncio: Use Interface instead of ABC. Fixes issue 19726.
parent
cf183fd2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
Lib/asyncio/events.py
Lib/asyncio/events.py
+2
-2
Lib/asyncio/protocols.py
Lib/asyncio/protocols.py
+4
-4
Lib/asyncio/transports.py
Lib/asyncio/transports.py
+5
-5
No files found.
Lib/asyncio/events.py
View file @
ea29612b
...
@@ -234,7 +234,7 @@ class AbstractEventLoop:
...
@@ -234,7 +234,7 @@ class AbstractEventLoop:
protocol_factory should instantiate object with Protocol interface.
protocol_factory should instantiate object with Protocol interface.
pipe is file-like object already switched to nonblocking.
pipe is file-like object already switched to nonblocking.
Return pair (transport, protocol), where transport support
Return pair (transport, protocol), where transport support
ReadTransport
ABC
"""
ReadTransport
interface.
"""
# The reason to accept file-like object instead of just file descriptor
# The reason to accept file-like object instead of just file descriptor
# is: we need to own pipe and close it at transport finishing
# is: we need to own pipe and close it at transport finishing
# Can got complicated errors if pass f.fileno(),
# Can got complicated errors if pass f.fileno(),
...
@@ -247,7 +247,7 @@ class AbstractEventLoop:
...
@@ -247,7 +247,7 @@ class AbstractEventLoop:
protocol_factory should instantiate object with BaseProtocol interface.
protocol_factory should instantiate object with BaseProtocol interface.
Pipe is file-like object already switched to nonblocking.
Pipe is file-like object already switched to nonblocking.
Return pair (transport, protocol), where transport support
Return pair (transport, protocol), where transport support
WriteTransport
ABC
"""
WriteTransport
interface.
"""
# The reason to accept file-like object instead of just file descriptor
# The reason to accept file-like object instead of just file descriptor
# is: we need to own pipe and close it at transport finishing
# is: we need to own pipe and close it at transport finishing
# Can got complicated errors if pass f.fileno(),
# Can got complicated errors if pass f.fileno(),
...
...
Lib/asyncio/protocols.py
View file @
ea29612b
...
@@ -4,7 +4,7 @@ __all__ = ['Protocol', 'DatagramProtocol']
...
@@ -4,7 +4,7 @@ __all__ = ['Protocol', 'DatagramProtocol']
class
BaseProtocol
:
class
BaseProtocol
:
"""
ABC for base protocol clas
s.
"""
Common base class for protocol interface
s.
Usually user implements protocols that derived from BaseProtocol
Usually user implements protocols that derived from BaseProtocol
like Protocol or ProcessProtocol.
like Protocol or ProcessProtocol.
...
@@ -59,7 +59,7 @@ class BaseProtocol:
...
@@ -59,7 +59,7 @@ class BaseProtocol:
class
Protocol
(
BaseProtocol
):
class
Protocol
(
BaseProtocol
):
"""
ABC representing a
protocol.
"""
Interface for stream
protocol.
The user should implement this interface. They can inherit from
The user should implement this interface. They can inherit from
this class but don't need to. The implementations here do
this class but don't need to. The implementations here do
...
@@ -95,7 +95,7 @@ class Protocol(BaseProtocol):
...
@@ -95,7 +95,7 @@ class Protocol(BaseProtocol):
class
DatagramProtocol
(
BaseProtocol
):
class
DatagramProtocol
(
BaseProtocol
):
"""
ABC representing a
datagram protocol."""
"""
Interface for
datagram protocol."""
def
datagram_received
(
self
,
data
,
addr
):
def
datagram_received
(
self
,
data
,
addr
):
"""Called when some datagram is received."""
"""Called when some datagram is received."""
...
@@ -108,7 +108,7 @@ class DatagramProtocol(BaseProtocol):
...
@@ -108,7 +108,7 @@ class DatagramProtocol(BaseProtocol):
class
SubprocessProtocol
(
BaseProtocol
):
class
SubprocessProtocol
(
BaseProtocol
):
"""
ABC representing a
protocol for subprocess calls."""
"""
Interface for
protocol for subprocess calls."""
def
pipe_data_received
(
self
,
fd
,
data
):
def
pipe_data_received
(
self
,
fd
,
data
):
"""Called when the subprocess writes data into stdout/stderr pipe.
"""Called when the subprocess writes data into stdout/stderr pipe.
...
...
Lib/asyncio/transports.py
View file @
ea29612b
...
@@ -4,7 +4,7 @@ __all__ = ['ReadTransport', 'WriteTransport', 'Transport']
...
@@ -4,7 +4,7 @@ __all__ = ['ReadTransport', 'WriteTransport', 'Transport']
class
BaseTransport
:
class
BaseTransport
:
"""Base
ABC
for transports."""
"""Base
class
for transports."""
def
__init__
(
self
,
extra
=
None
):
def
__init__
(
self
,
extra
=
None
):
if
extra
is
None
:
if
extra
is
None
:
...
@@ -27,7 +27,7 @@ class BaseTransport:
...
@@ -27,7 +27,7 @@ class BaseTransport:
class
ReadTransport
(
BaseTransport
):
class
ReadTransport
(
BaseTransport
):
"""
ABC
for read-only transports."""
"""
Interface
for read-only transports."""
def
pause_reading
(
self
):
def
pause_reading
(
self
):
"""Pause the receiving end.
"""Pause the receiving end.
...
@@ -47,7 +47,7 @@ class ReadTransport(BaseTransport):
...
@@ -47,7 +47,7 @@ class ReadTransport(BaseTransport):
class
WriteTransport
(
BaseTransport
):
class
WriteTransport
(
BaseTransport
):
"""
ABC
for write-only transports."""
"""
Interface
for write-only transports."""
def
set_write_buffer_limits
(
self
,
high
=
None
,
low
=
None
):
def
set_write_buffer_limits
(
self
,
high
=
None
,
low
=
None
):
"""Set the high- and low-water limits for write flow control.
"""Set the high- and low-water limits for write flow control.
...
@@ -115,7 +115,7 @@ class WriteTransport(BaseTransport):
...
@@ -115,7 +115,7 @@ class WriteTransport(BaseTransport):
class
Transport
(
ReadTransport
,
WriteTransport
):
class
Transport
(
ReadTransport
,
WriteTransport
):
"""
ABC
representing a bidirectional transport.
"""
Interface
representing a bidirectional transport.
There may be several implementations, but typically, the user does
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
not implement new transports; rather, the platform provides some
...
@@ -137,7 +137,7 @@ class Transport(ReadTransport, WriteTransport):
...
@@ -137,7 +137,7 @@ class Transport(ReadTransport, WriteTransport):
class
DatagramTransport
(
BaseTransport
):
class
DatagramTransport
(
BaseTransport
):
"""
ABC
for datagram (UDP) transports."""
"""
Interface
for datagram (UDP) transports."""
def
sendto
(
self
,
data
,
addr
=
None
):
def
sendto
(
self
,
data
,
addr
=
None
):
"""Send data to the transport.
"""Send data to the transport.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment