File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
from typing import AsyncGenerator
2
+ from typing import Optional
2
3
3
4
import anyio
4
5
@@ -12,8 +13,8 @@ class SocketListener(IPCListener):
12
13
13
14
endpoint : str
14
15
15
- def __init__ (self , endpoint : str ):
16
- self .endpoint = endpoint
16
+ def __init__ (self , endpoint : Optional [ str ] ):
17
+ self .endpoint = endpoint if endpoint is not None else "/tmp/eval.sock"
17
18
18
19
async def listen (self ) -> AsyncGenerator [IPCClient , None ]:
19
20
async with await anyio .create_unix_listener (self .endpoint ) as listener :
Original file line number Diff line number Diff line change 1
1
from typing import AsyncGenerator
2
+ from typing import Optional
2
3
3
4
import anyio
4
5
import pywintypes
@@ -13,8 +14,8 @@ class NamedPipeListener(IPCListener):
13
14
14
15
endpoint : str
15
16
16
- def __init__ (self , endpoint : str ):
17
- self .endpoint = endpoint
17
+ def __init__ (self , endpoint : Optional [ str ] = None ):
18
+ self .endpoint = endpoint if endpoint is not None else r"\\.\pipe\eval"
18
19
19
20
async def listen (self ) -> AsyncGenerator [IPCClient , None ]:
20
21
while True :
Original file line number Diff line number Diff line change 9
9
from .stream_io import StreamServer
10
10
11
11
12
- def default_ipc_listener_factory (endpoint : str ) -> IPCListener :
12
+ def default_ipc_listener_factory (endpoint : Optional [ str ] ) -> IPCListener :
13
13
if sys .platform == "win32" :
14
14
from .ipc_listener_windows import NamedPipeListener
15
15
@@ -27,7 +27,7 @@ class IPCServer(StreamServer):
27
27
28
28
def __init__ (
29
29
self ,
30
- endpoint : str ,
30
+ endpoint : Optional [ str ] = None ,
31
31
handler : Optional [RpcHandler ] = None ,
32
32
listener_factory = default_ipc_listener_factory ,
33
33
):
You can’t perform that action at this time.
0 commit comments