|
15 | 15 | import socket
|
16 | 16 | import unittest
|
17 | 17 | import unittest.mock
|
| 18 | +from collections.abc import KeysView, Sequence, Sized, ValuesView |
18 | 19 | from decimal import Decimal
|
19 | 20 | from pathlib import Path
|
20 | 21 | from textwrap import dedent
|
21 | 22 | from types import FunctionType, ModuleType
|
22 |
| -from typing import ( |
23 |
| - Any, |
24 |
| - FrozenSet, |
25 |
| - KeysView, |
26 |
| - List, |
27 |
| - Match, |
28 |
| - Pattern, |
29 |
| - Sequence, |
30 |
| - Set, |
31 |
| - Sized, |
32 |
| - Union, |
33 |
| - ValuesView, |
34 |
| -) |
| 23 | +from typing import Any, Union |
35 | 24 |
|
36 | 25 | import attr
|
37 | 26 | import click
|
@@ -112,7 +101,7 @@ def test_ghostwriter_exploits_arguments_with_enum_defaults():
|
112 | 101 | test()
|
113 | 102 |
|
114 | 103 |
|
115 |
| -def timsort(seq: Sequence[int]) -> List[int]: |
| 104 | +def timsort(seq: Sequence[int]) -> list[int]: |
116 | 105 | return sorted(seq)
|
117 | 106 |
|
118 | 107 |
|
@@ -150,19 +139,19 @@ def takes_values(x: ValuesView[int]) -> None:
|
150 | 139 | pass
|
151 | 140 |
|
152 | 141 |
|
153 |
| -def takes_match(x: Match[bytes]) -> None: |
| 142 | +def takes_match(x: re.Match[bytes]) -> None: |
154 | 143 | pass
|
155 | 144 |
|
156 | 145 |
|
157 |
| -def takes_pattern(x: Pattern[str]) -> None: |
| 146 | +def takes_pattern(x: re.Pattern[str]) -> None: |
158 | 147 | pass
|
159 | 148 |
|
160 | 149 |
|
161 | 150 | def takes_sized(x: Sized) -> None:
|
162 | 151 | pass
|
163 | 152 |
|
164 | 153 |
|
165 |
| -def takes_frozensets(a: FrozenSet[int], b: FrozenSet[int]) -> None: |
| 154 | +def takes_frozensets(a: frozenset[int], b: frozenset[int]) -> None: |
166 | 155 | pass
|
167 | 156 |
|
168 | 157 |
|
@@ -232,7 +221,7 @@ def test_inference_from_defaults_and_none_booleans_reprs_not_just_and_sampled_fr
|
232 | 221 | assert "@given(foo=st.none(), bar=st.booleans())" in source_code
|
233 | 222 |
|
234 | 223 |
|
235 |
| -def hopefully_hashable(foo: Set[Decimal]): |
| 224 | +def hopefully_hashable(foo: set[Decimal]): |
236 | 225 | pass
|
237 | 226 |
|
238 | 227 |
|
@@ -273,7 +262,7 @@ def from_json(cls, obj: str) -> Union[dict, list]:
|
273 | 262 | return json.loads(obj)
|
274 | 263 |
|
275 | 264 | @staticmethod
|
276 |
| - def static_sorter(seq: Sequence[int]) -> List[int]: |
| 265 | + def static_sorter(seq: Sequence[int]) -> list[int]: |
277 | 266 | return sorted(seq)
|
278 | 267 |
|
279 | 268 |
|
|
0 commit comments