Skip to content

Commit 9a7df23

Browse files
committed
Use builtin dict, list and tuple for typing
1 parent 4a5fa6e commit 9a7df23

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

pyproject.toml

Lines changed: 0 additions & 20 deletions
This file was deleted.

testinfra/modules/puppet.py

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

1313
import json
14-
from typing import Dict
1514

1615
from testinfra.modules.base import InstanceModule
1716

1817

19-
def parse_puppet_resource(data: str) -> Dict[str, Dict[str, str]]:
18+
def parse_puppet_resource(data: str) -> dict[str, dict[str, str]]:
2019
"""Parse data returned by 'puppet resource'
2120
2221
$ puppet resource user
@@ -38,7 +37,7 @@ def parse_puppet_resource(data: str) -> Dict[str, Dict[str, str]]:
3837
[...]
3938
"""
4039

41-
state: Dict[str, Dict[str, str]] = {}
40+
state: dict[str, dict[str, str]] = {}
4241
current = None
4342
for line in data.splitlines():
4443
if not current:

testinfra/modules/socket.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import functools
1414
import socket
15-
from typing import List, Optional, Tuple
15+
from typing import Optional
1616

1717
from testinfra.modules.base import Module
1818

@@ -121,7 +121,7 @@ def is_listening(self):
121121
)
122122

123123
@property
124-
def clients(self) -> List[Optional[Tuple[str, int]]]:
124+
def clients(self) -> list[Optional[tuple[str, int]]]:
125125
"""Return a list of clients connected to a listening socket
126126
127127
For tcp and udp sockets a list of pair (address, port) is returned.
@@ -134,7 +134,7 @@ def clients(self) -> List[Optional[Tuple[str, int]]]:
134134
[None, None, None]
135135
136136
"""
137-
sockets: List[Optional[Tuple[str, int]]] = []
137+
sockets: list[Optional[tuple[str, int]]] = []
138138
for sock in self._iter_sockets(False):
139139
if sock[0] != self.protocol:
140140
continue

0 commit comments

Comments
 (0)