diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 00:02:52 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 00:02:52 +0100 |
| commit | 9d4323861f0e3a69018f0b7ad00a99b0e6663835 (patch) | |
| tree | eaba0f6409b8719642f7f6419d6000502a44e67d /asyncio | |
| parent | f139962e14cf85658af3b563adbeb7fbde07c864 (diff) | |
| download | trollius-git-9d4323861f0e3a69018f0b7ad00a99b0e6663835.tar.gz | |
Truncate to 80 columns
Diffstat (limited to 'asyncio')
| -rw-r--r-- | asyncio/base_events.py | 4 | ||||
| -rw-r--r-- | asyncio/coroutines.py | 12 | ||||
| -rw-r--r-- | asyncio/selector_events.py | 7 | ||||
| -rw-r--r-- | asyncio/tasks.py | 2 | ||||
| -rw-r--r-- | asyncio/test_support.py | 15 | ||||
| -rw-r--r-- | asyncio/unix_events.py | 3 | ||||
| -rw-r--r-- | asyncio/windows_events.py | 3 | ||||
| -rw-r--r-- | asyncio/windows_utils.py | 7 |
8 files changed, 31 insertions, 22 deletions
diff --git a/asyncio/base_events.py b/asyncio/base_events.py index ac885a8..35c8d74 100644 --- a/asyncio/base_events.py +++ b/asyncio/base_events.py @@ -201,8 +201,8 @@ class BaseEventLoop(events.AbstractEventLoop): """Create socket transport.""" raise NotImplementedError - def _make_ssl_transport(self, rawsock, protocol, sslcontext, waiter=None, *, - server_side=False, server_hostname=None, + def _make_ssl_transport(self, rawsock, protocol, sslcontext, waiter=None, + *, server_side=False, server_hostname=None, extra=None, server=None): """Create SSL transport.""" raise NotImplementedError diff --git a/asyncio/coroutines.py b/asyncio/coroutines.py index c28de95..a1b2875 100644 --- a/asyncio/coroutines.py +++ b/asyncio/coroutines.py @@ -182,14 +182,18 @@ def _format_coroutine(coro): and not inspect.isgeneratorfunction(coro.func)): filename, lineno = events._get_function_source(coro.func) if coro.gi_frame is None: - coro_repr = '%s() done, defined at %s:%s' % (coro_name, filename, lineno) + coro_repr = ('%s() done, defined at %s:%s' + % (coro_name, filename, lineno)) else: - coro_repr = '%s() running, defined at %s:%s' % (coro_name, filename, lineno) + coro_repr = ('%s() running, defined at %s:%s' + % (coro_name, filename, lineno)) elif coro.gi_frame is not None: lineno = coro.gi_frame.f_lineno - coro_repr = '%s() running at %s:%s' % (coro_name, filename, lineno) + coro_repr = ('%s() running at %s:%s' + % (coro_name, filename, lineno)) else: lineno = coro.gi_code.co_firstlineno - coro_repr = '%s() done, defined at %s:%s' % (coro_name, filename, lineno) + coro_repr = ('%s() done, defined at %s:%s' + % (coro_name, filename, lineno)) return coro_repr diff --git a/asyncio/selector_events.py b/asyncio/selector_events.py index 2e7364b..69b649c 100644 --- a/asyncio/selector_events.py +++ b/asyncio/selector_events.py @@ -55,8 +55,8 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): return _SelectorSocketTransport(self, sock, protocol, waiter, extra, server) - def _make_ssl_transport(self, rawsock, protocol, sslcontext, waiter=None, *, - server_side=False, server_hostname=None, + def _make_ssl_transport(self, rawsock, protocol, sslcontext, waiter=None, + *, server_side=False, server_hostname=None, extra=None, server=None): return _SelectorSslTransport( self, rawsock, protocol, sslcontext, waiter, @@ -484,7 +484,8 @@ class _SelectorTransport(transports._FlowControlMixin, info.append('read=idle') polling = _test_selector_event(self._loop._selector, - self._sock_fd, selectors.EVENT_WRITE) + self._sock_fd, + selectors.EVENT_WRITE) if polling: state = 'polling' else: diff --git a/asyncio/tasks.py b/asyncio/tasks.py index 9aebffd..8fc5bea 100644 --- a/asyncio/tasks.py +++ b/asyncio/tasks.py @@ -68,7 +68,7 @@ class Task(futures.Future): return {t for t in cls._all_tasks if t._loop is loop} def __init__(self, coro, *, loop=None): - assert coroutines.iscoroutine(coro), repr(coro) # Not a coroutine function! + assert coroutines.iscoroutine(coro), repr(coro) super().__init__(loop=loop) if self._source_traceback: del self._source_traceback[-1] diff --git a/asyncio/test_support.py b/asyncio/test_support.py index 7a58cc0..3da4755 100644 --- a/asyncio/test_support.py +++ b/asyncio/test_support.py @@ -209,12 +209,13 @@ def bind_port(sock, host=HOST): if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM: if hasattr(socket, 'SO_REUSEADDR'): if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1: - raise TestFailed("tests should never set the SO_REUSEADDR " \ + raise TestFailed("tests should never set the SO_REUSEADDR " "socket option on TCP/IP sockets!") if hasattr(socket, 'SO_REUSEPORT'): try: - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: - raise TestFailed("tests should never set the SO_REUSEPORT " \ + reuse = sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) + if reuse == 1: + raise TestFailed("tests should never set the SO_REUSEPORT " "socket option on TCP/IP sockets!") except OSError: # Python's socket module was compiled using modern headers @@ -256,8 +257,8 @@ def requires_mac_ver(*min_version): return decorator def _requires_unix_version(sysname, min_version): - """Decorator raising SkipTest if the OS is `sysname` and the version is less - than `min_version`. + """Decorator raising SkipTest if the OS is `sysname` and the version is + less than `min_version`. For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if the FreeBSD version is less than 7.2. @@ -283,8 +284,8 @@ def _requires_unix_version(sysname, min_version): return decorator def requires_freebsd_version(*min_version): - """Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is - less than `min_version`. + """Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version + is less than `min_version`. For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD version is less than 7.2. diff --git a/asyncio/unix_events.py b/asyncio/unix_events.py index d1461fd..91e43cf 100644 --- a/asyncio/unix_events.py +++ b/asyncio/unix_events.py @@ -69,7 +69,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): """ if (coroutines.iscoroutine(callback) or coroutines.iscoroutinefunction(callback)): - raise TypeError("coroutines cannot be used with add_signal_handler()") + raise TypeError("coroutines cannot be used " + "with add_signal_handler()") self._check_signal(sig) self._check_closed() try: diff --git a/asyncio/windows_events.py b/asyncio/windows_events.py index d7feb1a..9d496f2 100644 --- a/asyncio/windows_events.py +++ b/asyncio/windows_events.py @@ -424,7 +424,8 @@ class IocpProactor: else: return windows_utils.PipeHandle(handle) - return self._register(ov, None, finish_connect_pipe, wait_for_post=True) + return self._register(ov, None, finish_connect_pipe, + wait_for_post=True) def wait_for_handle(self, handle, timeout=None): """Wait for a handle. diff --git a/asyncio/windows_utils.py b/asyncio/windows_utils.py index c6e4bc9..b475812 100644 --- a/asyncio/windows_utils.py +++ b/asyncio/windows_utils.py @@ -36,15 +36,16 @@ else: def socketpair(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0): """A socket pair usable as a self-pipe, for Windows. - Origin: https://gist.github.com/4325783, by Geert Jansen. Public domain. + Origin: https://gist.github.com/4325783, by Geert Jansen. + Public domain. """ if family == socket.AF_INET: host = '127.0.0.1' elif family == socket.AF_INET6: host = '::1' else: - raise ValueError("Only AF_INET and AF_INET6 socket address families " - "are supported") + raise ValueError("Only AF_INET and AF_INET6 socket address " + "families are supported") if type != socket.SOCK_STREAM: raise ValueError("Only SOCK_STREAM socket type is supported") if proto != 0: |
