Skip to content

Commit 266a25f

Browse files
committed
Add missing awaitable return types
This commit updates the typing on the return types for the server callback functions to reflect cases where a coroutine which returns a session is accepted alongside a callable which returns a session or just directly returning a session. Thanks go to Nate Hardison for suggesting a fix for this.
1 parent 6ead910 commit 266a25f

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

asyncssh/server.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,23 @@
3838
from .session import SSHTunTapSession
3939

4040

41-
_NewSession = Union[bool, 'SSHServerSession', SSHServerSessionFactory,
42-
Tuple['SSHServerChannel', 'SSHServerSession'],
43-
Tuple['SSHServerChannel', SSHServerSessionFactory]]
44-
_NewTCPSession = Union[bool, 'SSHTCPSession', SSHSocketSessionFactory,
45-
Tuple['SSHTCPChannel', 'SSHTCPSession'],
46-
Tuple['SSHTCPChannel', SSHSocketSessionFactory]]
47-
_NewUNIXSession = Union[bool, 'SSHUNIXSession', SSHSocketSessionFactory,
48-
Tuple['SSHUNIXChannel', 'SSHUNIXSession'],
49-
Tuple['SSHUNIXChannel', SSHSocketSessionFactory]]
50-
_NewTunTapSession = Union[bool, 'SSHTunTapSession', SSHSocketSessionFactory,
51-
Tuple['SSHTunTapChannel', 'SSHTunTapSession'],
52-
Tuple['SSHTunTapChannel', SSHSocketSessionFactory]]
53-
_NewListener = Union[bool, 'SSHAcceptHandler', SSHListener]
41+
_NewSession = \
42+
Union[bool, MaybeAwait['SSHServerSession'], SSHServerSessionFactory,
43+
Tuple['SSHServerChannel', MaybeAwait['SSHServerSession']],
44+
Tuple['SSHServerChannel', SSHServerSessionFactory]]
45+
_NewTCPSession = \
46+
Union[bool, MaybeAwait['SSHTCPSession'], SSHSocketSessionFactory,
47+
Tuple['SSHTCPChannel', MaybeAwait['SSHTCPSession']],
48+
Tuple['SSHTCPChannel', SSHSocketSessionFactory]]
49+
_NewUNIXSession = \
50+
Union[bool, MaybeAwait['SSHUNIXSession'], SSHSocketSessionFactory,
51+
Tuple['SSHUNIXChannel', MaybeAwait['SSHUNIXSession']],
52+
Tuple['SSHUNIXChannel', SSHSocketSessionFactory]]
53+
_NewTunTapSession = \
54+
Union[bool, MaybeAwait['SSHTunTapSession'], SSHSocketSessionFactory,
55+
Tuple['SSHTunTapChannel', MaybeAwait['SSHTunTapSession']],
56+
Tuple['SSHTunTapChannel', SSHSocketSessionFactory]]
57+
_NewListener = Union[bool, 'SSHAcceptHandler', MaybeAwait[SSHListener]]
5458

5559

5660
class SSHServer:

0 commit comments

Comments
 (0)