mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
expose asyncio.open_unix_connection if it exists (#879)
Also fix the one other place where hasattr() is used (which PEP 484 doesn't support).
This commit is contained in:
committed by
Guido van Rossum
parent
f9d6218ab7
commit
06074e1e02
@@ -1,5 +1,6 @@
|
||||
"""The asyncio package, tracking PEP 3156."""
|
||||
|
||||
import socket
|
||||
import sys
|
||||
from typing import Type
|
||||
|
||||
@@ -85,6 +86,11 @@ from asyncio.locks import (
|
||||
|
||||
if sys.version_info < (3, 5):
|
||||
from asyncio.queues import JoinableQueue as JoinableQueue
|
||||
if sys.platform != 'win32':
|
||||
from asyncio.streams import (
|
||||
open_unix_connection as open_unix_connection,
|
||||
start_unix_server as start_unix_server,
|
||||
)
|
||||
|
||||
# TODO: It should be possible to instantiate these classes, but mypy
|
||||
# currently disallows this.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import socket
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, Optional, Tuple
|
||||
|
||||
from . import coroutines
|
||||
@@ -38,7 +38,7 @@ def start_server(
|
||||
**kwds: Any
|
||||
) -> Generator[Any, None, events.AbstractServer]: ...
|
||||
|
||||
if hasattr(socket, 'AF_UNIX'):
|
||||
if sys.platform != 'win32':
|
||||
@coroutines.coroutine
|
||||
def open_unix_connection(
|
||||
path: str = ...,
|
||||
|
||||
Reference in New Issue
Block a user