Skip to content

Commit 45ca1a2

Browse files
committed
Add some typing to socket module
This silent some errors reported by mypy --check-untyped-defs
1 parent 43f7a0c commit 45ca1a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

testinfra/modules/socket.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# limitations under the License.
1212

1313
import socket
14+
from typing import List
15+
from typing import Optional
16+
from typing import Tuple
1417

1518
from testinfra.modules.base import Module
1619
from testinfra.utils import cached_property
@@ -121,7 +124,7 @@ def is_listening(self):
121124
)
122125

123126
@property
124-
def clients(self):
127+
def clients(self) -> List[Optional[Tuple[str, int]]]:
125128
"""Return a list of clients connected to a listening socket
126129
127130
For tcp and udp sockets a list of pair (adress, port) is returned.
@@ -134,7 +137,7 @@ def clients(self):
134137
[None, None, None]
135138
136139
"""
137-
sockets = []
140+
sockets: List[Optional[Tuple[str, int]]] = []
138141
for sock in self._iter_sockets(False):
139142
if sock[0] != self.protocol:
140143
continue

0 commit comments

Comments
 (0)