Commit 0a79a96
committed
refactor: upgrade type annotations to Python 3.10+ syntax
Replace Union[X, Y] with X | Y and add future annotations to version template.
Changes:
- vcs-versioning/src/vcs_versioning/_pyproject_reading.py:
- GivenPyProjectResult: Union[...] -> ... | ... | None
- Remove Union import
- vcs-versioning/src/vcs_versioning/_types.py:
- PathT: Union[PathLike, str] -> PathLike | str
- Remove Union import
- vcs-versioning/src/vcs_versioning/_dump_version.py:
- Template: Union[int, str] -> int | str
- Template: Union[str, None] -> str | None
- Remove Tuple, Union imports from template
- Add 'from __future__ import annotations' to generated .py template
Generated version files now include future annotations for backward compatibility
with Python 3.10+ pipe operator syntax.1 parent 48b4596 commit 0a79a96
File tree
4 files changed
+12
-23
lines changed- vcs-versioning/src/vcs_versioning
4 files changed
+12
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 36 | + | |
| 37 | + | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 14 | | |
24 | 15 | | |
25 | 16 | | |
| |||
38 | 29 | | |
39 | 30 | | |
40 | 31 | | |
41 | | - | |
| 32 | + | |
42 | 33 | | |
43 | 34 | | |
44 | | - | |
| 35 | + | |
45 | 36 | | |
46 | 37 | | |
47 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments