Skip to content

Commit 3ebdf29

Browse files
committed
Set pyupgrade minimum Python version to 3.9
1 parent 695dd72 commit 3ebdf29

8 files changed

Lines changed: 12 additions & 13 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ repos:
4242
rev: v3.16.0
4343
hooks:
4444
- id: pyupgrade
45-
args: ["--keep-runtime-typing"]
45+
args: ["--py39-plus", "--keep-runtime-typing"]
4646
- repo: local
4747
hooks:
4848
- id: mypy

cookie_python/new.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import subprocess
44
import time
55
from pathlib import Path
6-
from typing import List, Tuple
76

87
TEMPLATE_REPOSITORY_URL = "https://github.com/smkent/cookie-python"
98

109

11-
def parse_args() -> Tuple[argparse.Namespace, List[str]]:
10+
def parse_args() -> tuple[argparse.Namespace, list[str]]:
1211
ap = argparse.ArgumentParser()
1312
ap.add_argument(
1413
"project_dir", help="New project parent directory", type=str

hooks/post_gen_project.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
import os
33
import shutil
44
import subprocess
5-
from typing import Dict, List
65

76
import yaml
87

98
TEMPLATE_ONLY_DATA = "cookiecutter_template_data"
109

1110

12-
def _run(call: List[str], env: Dict[str, str]) -> None:
11+
def _run(call: list[str], env: dict[str, str]) -> None:
1312
subprocess.run(call, env=env).check_returncode()
1413

1514

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55
from pathlib import Path
66
from tempfile import TemporaryDirectory
7-
from typing import Iterator
7+
from collections.abc import Iterator
88
from unittest.mock import patch
99

1010
import pytest

tests/readme_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from dataclasses import dataclass
2-
from typing import Any, Iterable, List
2+
from typing import Any
3+
from collections.abc import Iterable
34

45

56
@dataclass
@@ -36,8 +37,8 @@ def all_cases(
3637
"enable_container_publish",
3738
"expected_content_file",
3839
]
39-
ids: List[str] = []
40-
argvalues: List[Any] = []
40+
ids: list[str] = []
41+
argvalues: list[Any] = []
4142
for case in [
4243
ReadmeCaseParams(
4344
id="no_github_user",

tests/test_manage_cookie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
from pathlib import Path
44
from types import SimpleNamespace
5-
from typing import Iterable, Iterator
5+
from collections.abc import Iterable, Iterator
66
from unittest.mock import MagicMock, patch
77

88
import github

tests/test_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
import os
33
import subprocess
4-
from typing import Any, Dict
4+
from typing import Any
55

66
import pytest
77
import yaml
@@ -11,7 +11,7 @@
1111
TEMPLATE_ONLY_DATA = "cookiecutter_template_data"
1212

1313

14-
def _bake(cookies: Any, extra_context: Dict[str, Any]) -> Any:
14+
def _bake(cookies: Any, extra_context: dict[str, Any]) -> Any:
1515
result = cookies.bake(extra_context=extra_context)
1616

1717
assert not result.exception

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ repos:
4141
rev: v3.3.1
4242
hooks:
4343
- id: pyupgrade
44-
args: ["--keep-runtime-typing"]
44+
args: ["--py39-plus", "--keep-runtime-typing"]
4545
- repo: local
4646
hooks:
4747
- id: mypy

0 commit comments

Comments
 (0)