From 42d1e49d730f9bf9130ca356d2cd43f0277f9b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 23 Aug 2023 20:14:54 +0200 Subject: [PATCH] Use Python 3.9 --- .pre-commit-config.yaml | 2 +- c2cciutils/__init__.py | 33 +++++----- c2cciutils/applications_definition.py | 6 +- c2cciutils/configuration.py | 72 ++++++++++----------- c2cciutils/lib/docker.py | 12 ++-- c2cciutils/pr_checks.py | 16 ++--- c2cciutils/publish.py | 4 +- c2cciutils/scripts/download_applications.py | 8 +-- c2cciutils/scripts/k8s/db.py | 4 +- c2cciutils/scripts/publish.py | 11 ++-- c2cciutils/scripts/trigger_image_update.py | 3 +- c2cciutils/security.py | 8 +-- example-project/pyproject.toml | 7 +- pyproject.toml | 9 +-- 14 files changed, 95 insertions(+), 100 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7b8de1fa..9810b6767 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -124,7 +124,7 @@ repos: hooks: - id: pyupgrade args: - - --py38-plus + - --py39-plus - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: diff --git a/c2cciutils/__init__.py b/c2cciutils/__init__.py index 43a932d16..596d2e84e 100644 --- a/c2cciutils/__init__.py +++ b/c2cciutils/__init__.py @@ -8,7 +8,8 @@ import re import subprocess # nosec import sys -from typing import Any, Dict, List, Match, Optional, Pattern, Tuple, TypedDict, cast +from re import Match, Pattern +from typing import Any, Optional, TypedDict, cast import magic import requests @@ -58,7 +59,7 @@ def merge(default_config: Any, config: Any) -> Any: return config -def get_master_branch(repo: List[str]) -> Tuple[str, bool]: +def get_master_branch(repo: list[str]) -> tuple[str, bool]: """Get the name of the master branch.""" master_branch = "master" success = False @@ -191,7 +192,7 @@ def error( ) -def compile_re(config: c2cciutils.configuration.VersionTransform, prefix: str = "") -> List[VersionTransform]: +def compile_re(config: c2cciutils.configuration.VersionTransform, prefix: str = "") -> list[VersionTransform]: """ Compile the from as a regular expression of a dictionary of the config list. @@ -220,8 +221,8 @@ def compile_re(config: c2cciutils.configuration.VersionTransform, prefix: str = def match( - value: str, config: List[VersionTransform] -) -> Tuple[Optional[Match[str]], Optional[VersionTransform], str]: + value: str, config: list[VersionTransform] +) -> tuple[Optional[Match[str]], Optional[VersionTransform], str]: """ Get the matched version. @@ -239,7 +240,7 @@ def match( return None, None, value -def does_match(value: str, config: List[VersionTransform]) -> bool: +def does_match(value: str, config: list[VersionTransform]) -> bool: """ Check if the version match with the config patterns. @@ -336,7 +337,7 @@ def gopass_put(secret: str, key: str) -> None: subprocess.check_output(["gopass", "insert", "--force", key], input=secret.encode()) -def add_authorization_header(headers: Dict[str, str]) -> Dict[str, str]: +def add_authorization_header(headers: dict[str, str]) -> dict[str, str]: """ Add the Authorization header needed to be authenticated on GitHub. @@ -357,7 +358,7 @@ def add_authorization_header(headers: Dict[str, str]) -> Dict[str, str]: return headers -def graphql(query_file: str, variables: Dict[str, Any], default: Any = None) -> Any: +def graphql(query_file: str, variables: dict[str, Any], default: Any = None) -> Any: """ Get a graphql result from GitHub. @@ -397,14 +398,14 @@ def graphql(query_file: str, variables: Dict[str, Any], default: Any = None) -> raise RuntimeError(f"GraphQL error: {json.dumps(json_response['errors'], indent=2)}") if "data" not in json_response: raise RuntimeError(f"GraphQL no data: {json.dumps(json_response, indent=2)}") - return cast(Dict[str, Any], json_response["data"]) + return cast(dict[str, Any], json_response["data"]) def get_git_files_mime( - mime_type: Optional[List[str]] = None, - extensions: Optional[List[str]] = None, - ignore_patterns_re: Optional[List[str]] = None, -) -> List[str]: + mime_type: Optional[list[str]] = None, + extensions: Optional[list[str]] = None, + ignore_patterns_re: Optional[list[str]] = None, +) -> list[str]: """ Get list of paths from git with all the files that have the specified mime type. @@ -464,7 +465,7 @@ def get_branch(branch: Optional[str], master_branch: str = "master") -> str: def get_based_on_master( - repo: List[str], + repo: list[str], override_current_branch: Optional[str], master_branch: str, config: c2cciutils.configuration.Configuration, @@ -525,7 +526,7 @@ def get_based_on_master( return based_branch == master_branch -def get_codespell_command(config: c2cciutils.configuration.Configuration, fix: bool = False) -> List[str]: +def get_codespell_command(config: c2cciutils.configuration.Configuration, fix: bool = False) -> list[str]: """ Get the codespell command. @@ -555,7 +556,7 @@ def get_codespell_command(config: c2cciutils.configuration.Configuration, fix: b return command -def snyk_exec() -> Tuple[str, Dict[str, str]]: +def snyk_exec() -> tuple[str, dict[str, str]]: """Get the Snyk cli executable path.""" env = {**os.environ} env["FORCE_COLOR"] = "true" diff --git a/c2cciutils/applications_definition.py b/c2cciutils/applications_definition.py index 8753cf4b1..49a166356 100644 --- a/c2cciutils/applications_definition.py +++ b/c2cciutils/applications_definition.py @@ -3,7 +3,7 @@ """ -from typing import Dict, List, Literal, TypedDict, Union +from typing import Literal, TypedDict, Union # Application configuration. # @@ -27,13 +27,13 @@ # The tile name to get in the tar file. "tar-file-name": str, # The commands to run after the tile creation. - "finish-commands": List[List[str]], + "finish-commands": list[list[str]], }, total=False, ) -ApplicationsConfiguration = Dict[str, "ApplicationConfiguration"] +ApplicationsConfiguration = dict[str, "ApplicationConfiguration"] """ Applications configuration. diff --git a/c2cciutils/configuration.py b/c2cciutils/configuration.py index 8cfcbbca4..4e6e9e44a 100644 --- a/c2cciutils/configuration.py +++ b/c2cciutils/configuration.py @@ -3,13 +3,13 @@ """ -from typing import Any, Dict, List, Literal, TypedDict, Union +from typing import Any, Literal, TypedDict, Union AUDIT_DEFAULT = {"snyk": True, "outdated_versions": True} """ Default value of the field path 'configuration audit' """ -AUDIT_SNYK_FILES_NO_INSTALL_DEFAULT: List[Any] = [] +AUDIT_SNYK_FILES_NO_INSTALL_DEFAULT: list[Any] = [] """ Default value of the field path 'Audit snyk config files_no_install' """ @@ -25,7 +25,7 @@ """ Default value of the field path 'Audit snyk config monitor_arguments' """ -AUDIT_SNYK_PIPENV_SYNC_ARGUMENTS_DEFAULT: List[Any] = [] +AUDIT_SNYK_PIPENV_SYNC_ARGUMENTS_DEFAULT: list[Any] = [] """ Default value of the field path 'Audit snyk config pipenv_sync_arguments' """ @@ -67,7 +67,7 @@ class AuditSnykConfig(TypedDict, total=False): The audit Pipfile configuration """ - test_arguments: List[str] + test_arguments: list[str] """ audit snyk test arguments. @@ -79,7 +79,7 @@ class AuditSnykConfig(TypedDict, total=False): - --severity-threshold=medium """ - monitor_arguments: List[str] + monitor_arguments: list[str] """ audit snyk monitor arguments. @@ -89,7 +89,7 @@ class AuditSnykConfig(TypedDict, total=False): - --all-projects """ - fix_arguments: List[str] + fix_arguments: list[str] """ audit snyk fix arguments. @@ -99,7 +99,7 @@ class AuditSnykConfig(TypedDict, total=False): - --all-projects """ - fix_github_create_pull_request_arguments: List[str] + fix_github_create_pull_request_arguments: list[str] """ audit snyk fix pull request arguments. @@ -110,7 +110,7 @@ class AuditSnykConfig(TypedDict, total=False): - --label=dependencies """ - pip_install_arguments: List[str] + pip_install_arguments: list[str] """ audit snyk pip install arguments. @@ -120,7 +120,7 @@ class AuditSnykConfig(TypedDict, total=False): - --user """ - pipenv_sync_arguments: List[str] + pipenv_sync_arguments: list[str] """ audit snyk pipenv sync arguments. @@ -130,7 +130,7 @@ class AuditSnykConfig(TypedDict, total=False): [] """ - files_no_install: List[str] + files_no_install: list[str] """ audit snyk files no install. @@ -170,7 +170,7 @@ class Codespell(TypedDict, total=False): The codespell check configuration """ - internal_dictionaries: List[str] + internal_dictionaries: list[str] """ codespell dictionaries. @@ -185,7 +185,7 @@ class Codespell(TypedDict, total=False): - en-GB_to_en-US """ - arguments: List[str] + arguments: list[str] """ codespell arguments. @@ -197,7 +197,7 @@ class Codespell(TypedDict, total=False): - --ignore-words-list=ro """ - ignore_re: List[str] + ignore_re: list[str] r""" codespell ignore regular expression. @@ -227,7 +227,7 @@ class Codespell(TypedDict, total=False): ) -DB_CONFIGURATION_DEFAULT: Dict[str, Any] = {} +DB_CONFIGURATION_DEFAULT: dict[str, Any] = {} """ Default value of the field path 'K8s configuration db' """ @@ -263,7 +263,7 @@ class Codespell(TypedDict, total=False): # tls.autoGenerated: 'true' # tls.enabled: 'true' # volumePermissions.enabled: 'true' - "chart-options": Dict[str, str], + "chart-options": dict[str, str], }, total=False, ) @@ -308,13 +308,13 @@ class Codespell(TypedDict, total=False): # - test-cluster # - --no-lb # - --no-rollback - "install-commands": List[List[str]], + "install-commands": list[list[str]], }, total=False, ) -K3D_CONFIGURATION_DEFAULT: Dict[str, Any] = {} +K3D_CONFIGURATION_DEFAULT: dict[str, Any] = {} """ Default value of the field path 'K8s configuration k3d' """ @@ -334,7 +334,7 @@ class K8SConfiguration(TypedDict, total=False): db: "DbConfiguration" -K8S_CONFIGURATION_DEFAULT: Dict[str, Any] = {} +K8S_CONFIGURATION_DEFAULT: dict[str, Any] = {} """ Default value of the field path 'configuration k8s' """ @@ -397,7 +397,7 @@ class K8SConfiguration(TypedDict, total=False): """ Default value of the field path 'Publish Docker config snyk test_args' """ -PUBLISH_GOOGLE_CALENDAR_DEFAULT: Dict[str, Any] = {} +PUBLISH_GOOGLE_CALENDAR_DEFAULT: dict[str, Any] = {} """ Default value of the field path 'publish_google_calendar' """ @@ -409,7 +409,7 @@ class K8SConfiguration(TypedDict, total=False): """ Default value of the field path 'publish pypi package group' """ -PUBLISH_PYPI_DEFAULT: Dict[str, Any] = {} +PUBLISH_PYPI_DEFAULT: dict[str, Any] = {} """ Default value of the field path 'publish_pypi' """ @@ -462,7 +462,7 @@ class PrintVersions(TypedDict, total=False): The print versions configuration """ - versions: List["_PrintVersionsVersionsItem"] + versions: list["_PrintVersionsVersionsItem"] """ Print versions versions. @@ -574,10 +574,10 @@ class PublishDockerConfig(TypedDict, total=False): default: True """ - images: List["PublishDockerImage"] + images: list["PublishDockerImage"] """ List of images to be published """ - repository: Dict[str, "PublishDockerRepository"] + repository: dict[str, "PublishDockerRepository"] """ Docker repository. @@ -621,7 +621,7 @@ class PublishDockerImage(TypedDict, total=False): name: str """ The image name """ - tags: List[str] + tags: list[str] """ publish docker image tags. @@ -638,7 +638,7 @@ class PublishDockerRepository(TypedDict, total=False): server: str """ The server URL """ - versions: List[str] + versions: list[str] """ Publish Docker repository versions. @@ -672,7 +672,7 @@ class PublishGoogleCalendarConfig(TypedDict, total=False): The configuration to publish on Google Calendar """ - on: List[str] + on: list[str] """ Publish Google calendar on. @@ -700,10 +700,10 @@ class PublishHelmConfig(TypedDict, total=False): Configuration to publish on Helm charts on GitHub release """ - folders: List[str] + folders: list[str] """ The folders that will be published """ - versions: List[str] + versions: list[str] """ The kind or version that should be published, tag, branch or value of the --version argument of the c2cciutils-publish script """ @@ -727,10 +727,10 @@ class PublishPypiConfig(TypedDict, total=False): Configuration to publish on pypi """ - packages: List["PublishPypiPackage"] + packages: list["PublishPypiPackage"] """ The configuration of packages that will be published """ - versions: List[str] + versions: list[str] """ The kind or version that should be published, tag, branch or value of the --version argument of the c2cciutils-publish script """ @@ -753,7 +753,7 @@ class PublishPypiPackage(TypedDict, total=False): path: str """ The path of the pypi package """ - build_command: List[str] + build_command: list[str] """ The command used to do the build """ @@ -919,7 +919,7 @@ class Version(TypedDict, total=False): tag_to_version_re: "VersionTransform" -VersionTransform = List["_VersionTransformItem"] +VersionTransform = list["_VersionTransformItem"] """ Version transform. @@ -927,12 +927,12 @@ class Version(TypedDict, total=False): """ -_PUBLISH_DOCKER_CONFIG_DISPATCH_DEFAULT: Dict[str, Any] = {} +_PUBLISH_DOCKER_CONFIG_DISPATCH_DEFAULT: dict[str, Any] = {} """ Default value of the field path 'Publish Docker config dispatch' """ class _PrintVersionsVersionsItem(TypedDict, total=False): - cmd: List[str] + cmd: list[str] """ The command that should be used """ name: str @@ -945,7 +945,7 @@ class _PrintVersionsVersionsItem(TypedDict, total=False): class _PublishDockerConfigSnyk(TypedDict, total=False): """Checks the published images with Snyk""" - monitor_args: Union[List[str], Literal[False]] + monitor_args: Union[list[str], Literal[False]] """ Publish docker snyk monitor args. @@ -957,7 +957,7 @@ class _PublishDockerConfigSnyk(TypedDict, total=False): oneOf """ - test_args: Union[List[str], Literal[False]] + test_args: Union[list[str], Literal[False]] """ Publish docker snyk test args. diff --git a/c2cciutils/lib/docker.py b/c2cciutils/lib/docker.py index 64ddadeeb..23a5e2edb 100644 --- a/c2cciutils/lib/docker.py +++ b/c2cciutils/lib/docker.py @@ -3,7 +3,7 @@ """ import os import subprocess # nosec: B404 -from typing import Dict, Optional, Tuple, cast +from typing import Optional, cast import yaml from debian_inspector.version import Version @@ -11,7 +11,7 @@ def get_dpkg_packages_versions( image: str, default_distribution: Optional[str] = None, default_release: Optional[str] = None -) -> Tuple[bool, Dict[str, Version]]: +) -> tuple[bool, dict[str, Version]]: """ Get the versions of the dpkg packages installed in the image. @@ -57,7 +57,7 @@ def get_dpkg_packages_versions( release_final = release.strip('"').replace(".", "_") prefix = f"{distribution_final}_{release_final}/" - package_version: Dict[str, Version] = {} + package_version: dict[str, Version] = {} packages_status_process = subprocess.run( ["docker", "run", "--rm", "--entrypoint=", image, "dpkg", "--status"], stdout=subprocess.PIPE, @@ -93,21 +93,21 @@ def get_dpkg_packages_versions( return True, {f"{prefix}{k}": v for k, v in package_version.items()} -def get_versions_config() -> Tuple[Dict[str, Dict[str, str]], bool]: +def get_versions_config() -> tuple[dict[str, dict[str, str]], bool]: """ Get the versions from the config file. """ if os.path.exists("ci/dpkg-versions.yaml"): with open("ci/dpkg-versions.yaml", encoding="utf-8") as versions_file: return ( - cast(Dict[str, Dict[str, str]], yaml.load(versions_file.read(), Loader=yaml.SafeLoader)), + cast(dict[str, dict[str, str]], yaml.load(versions_file.read(), Loader=yaml.SafeLoader)), True, ) return {}, False def check_versions( - versions_config: Dict[str, str], + versions_config: dict[str, str], image: str, default_distribution: Optional[str] = None, default_release: Optional[str] = None, diff --git a/c2cciutils/pr_checks.py b/c2cciutils/pr_checks.py index 8f0fe71b7..1137c2102 100644 --- a/c2cciutils/pr_checks.py +++ b/c2cciutils/pr_checks.py @@ -7,7 +7,7 @@ import re import subprocess # nosec from tempfile import NamedTemporaryFile -from typing import Any, Dict, List, Optional +from typing import Any, Optional import requests import yaml @@ -15,7 +15,7 @@ import c2cciutils.configuration -def _commit_intro(need_separator: bool, commit: Dict[str, Any]) -> bool: +def _commit_intro(need_separator: bool, commit: dict[str, Any]) -> bool: head = commit["commit"]["message"].split("\n")[0] if need_separator: print("-" * 30) @@ -23,7 +23,7 @@ def _commit_intro(need_separator: bool, commit: Dict[str, Any]) -> bool: return True -def print_event(github_event: Dict[str, Any], **kwargs: Any) -> bool: +def print_event(github_event: dict[str, Any], **kwargs: Any) -> bool: """ Print the github object. """ @@ -34,7 +34,7 @@ def print_event(github_event: Dict[str, Any], **kwargs: Any) -> bool: def commits_messages( config: c2cciutils.configuration.PullRequestChecksCommitsMessagesConfiguration, - commits: List[Dict[str, Any]], + commits: list[dict[str, Any]], **kwargs: Any, ) -> bool: """ @@ -129,7 +129,7 @@ def commits_messages( def commits_spell( config: c2cciutils.configuration.PullRequestChecksCommitsSpellingConfiguration, full_config: c2cciutils.configuration.Configuration, - commits: List[Dict[str, Any]], + commits: list[dict[str, Any]], **kwargs: Any, ) -> bool: """Check the spelling of the commits body.""" @@ -164,7 +164,7 @@ def commits_spell( def pull_request_spell( config: c2cciutils.configuration.PullRequestChecksPullRequestSpellingConfiguration, full_config: c2cciutils.configuration.Configuration, - github_event: Dict[str, Any], + github_event: dict[str, Any], **kwargs: Any, ) -> bool: """Check the spelling of the pull request title and message.""" @@ -193,7 +193,7 @@ def pull_request_spell( return True -def pull_request_labels(github_event: Dict[str, Any], **kwargs: Any) -> bool: +def pull_request_labels(github_event: dict[str, Any], **kwargs: Any) -> bool: """Check it the label are set correctly for the changelog generation.""" del kwargs @@ -243,7 +243,7 @@ def _get_issue_number(name: str) -> Optional[str]: return None -def add_issue_link(github_event: Dict[str, Any], **kwargs: Any) -> bool: +def add_issue_link(github_event: dict[str, Any], **kwargs: Any) -> bool: """Add a comment with the link to Jira if needed.""" del kwargs diff --git a/c2cciutils/publish.py b/c2cciutils/publish.py index 6410b1ece..310a06e33 100644 --- a/c2cciutils/publish.py +++ b/c2cciutils/publish.py @@ -11,7 +11,7 @@ import subprocess # nosec import sys import uuid -from typing import List, Optional +from typing import Optional import ruamel.yaml import tomlkit @@ -338,7 +338,7 @@ def docker( tag_src: str, tag_dst: str, latest: bool, - images_full: List[str], + images_full: list[str], ) -> bool: """ Publish to a Docker registry. diff --git a/c2cciutils/scripts/download_applications.py b/c2cciutils/scripts/download_applications.py index ac88ee62d..2afcee334 100644 --- a/c2cciutils/scripts/download_applications.py +++ b/c2cciutils/scripts/download_applications.py @@ -7,7 +7,7 @@ import urllib from glob import glob from io import BytesIO -from typing import Dict, cast +from typing import cast import requests import yaml @@ -30,7 +30,7 @@ def main() -> None: args = argparser.parse_args() with open(args.versions_file, encoding="utf-8") as config_file: - versions = cast(Dict[str, str], yaml.load(config_file, Loader=yaml.SafeLoader)) + versions = cast(dict[str, str], yaml.load(config_file, Loader=yaml.SafeLoader)) with open(args.applications_file, encoding="utf-8") as config_file: applications = cast( applications_definition.ApplicationsConfiguration, yaml.load(config_file, Loader=yaml.SafeLoader) @@ -44,7 +44,7 @@ def download_c2cciutils_applications() -> None: os.path.join(os.path.dirname(os.path.dirname(__file__)), "applications-versions.yaml"), encoding="utf-8", ) as config_file: - versions = cast(Dict[str, str], yaml.load(config_file, Loader=yaml.SafeLoader)) + versions = cast(dict[str, str], yaml.load(config_file, Loader=yaml.SafeLoader)) with open( os.path.join(os.path.dirname(os.path.dirname(__file__)), "applications.yaml"), encoding="utf-8" ) as config_file: @@ -55,7 +55,7 @@ def download_c2cciutils_applications() -> None: def download_applications( - applications: applications_definition.ApplicationsConfiguration, versions: Dict[str, str] + applications: applications_definition.ApplicationsConfiguration, versions: dict[str, str] ) -> None: """Download the versions of applications specified in the configuration.""" diff --git a/c2cciutils/scripts/k8s/db.py b/c2cciutils/scripts/k8s/db.py index 3dd98d4c1..0d26e83f6 100644 --- a/c2cciutils/scripts/k8s/db.py +++ b/c2cciutils/scripts/k8s/db.py @@ -4,7 +4,7 @@ import os import subprocess # nosec import sys -from typing import Dict, cast +from typing import cast import yaml @@ -39,7 +39,7 @@ def main() -> None: ), encoding="utf-8", ) as config_file: - versions = cast(Dict[str, str], yaml.load(config_file, Loader=yaml.SafeLoader)) + versions = cast(dict[str, str], yaml.load(config_file, Loader=yaml.SafeLoader)) args = parser.parse_args() diff --git a/c2cciutils/scripts/publish.py b/c2cciutils/scripts/publish.py index 3c1774c32..cbac87ae9 100644 --- a/c2cciutils/scripts/publish.py +++ b/c2cciutils/scripts/publish.py @@ -10,7 +10,8 @@ import subprocess # nosec import sys import tarfile -from typing import Dict, List, Match, Optional, Set, cast +from re import Match +from typing import Optional, cast import requests import yaml @@ -208,9 +209,9 @@ def main() -> None: version_index = security.headers.index("Version") latest = security.data[-1][version_index] == version - images_src: Set[str] = set() - images_full: List[str] = [] - images_snyk: Set[str] = set() + images_src: set[str] = set() + images_full: list[str] = [] + images_snyk: set[str] = set() versions = args.docker_versions.split(",") if args.docker_versions else [version] for image_conf in docker_config.get("images", []): if ( @@ -246,7 +247,7 @@ def main() -> None: tags_calendar = [] for name, conf in { **cast( - Dict[str, c2cciutils.configuration.PublishDockerRepository], + dict[str, c2cciutils.configuration.PublishDockerRepository], c2cciutils.configuration.DOCKER_REPOSITORY_DEFAULT, ), **docker_config.get("repository", {}), diff --git a/c2cciutils/scripts/trigger_image_update.py b/c2cciutils/scripts/trigger_image_update.py index 35fe216fc..c552ba7cc 100644 --- a/c2cciutils/scripts/trigger_image_update.py +++ b/c2cciutils/scripts/trigger_image_update.py @@ -9,7 +9,6 @@ import random import subprocess # nosec import sys -from typing import List import requests import yaml @@ -60,7 +59,7 @@ def main() -> None: dispatch(args.repository, args.event_type, [f"{image}:{version}" for image in images_full]) -def dispatch(repository: str, event_type: str, images_full: List[str]) -> None: +def dispatch(repository: str, event_type: str, images_full: list[str]) -> None: """ Trigger an image update on the argocd repository. """ diff --git a/c2cciutils/security.py b/c2cciutils/security.py index f32872f8b..c0bfd725a 100644 --- a/c2cciutils/security.py +++ b/c2cciutils/security.py @@ -3,7 +3,7 @@ """ import xml.etree.ElementTree # nosec -from typing import List, Optional +from typing import Optional import markdown from markdown.extensions.tables import TableExtension @@ -14,9 +14,9 @@ class Security: Read the table of versions from SECURITY.md. """ - headers: List[str] - data: List[List[str]] - _row: Optional[List[str]] = None + headers: list[str] + data: list[list[str]] + _row: Optional[list[str]] = None def __init__(self, status: str): """ diff --git a/example-project/pyproject.toml b/example-project/pyproject.toml index b67f7c936..1cf6394e9 100644 --- a/example-project/pyproject.toml +++ b/example-project/pyproject.toml @@ -1,12 +1,12 @@ [tool.black] line-length = 110 -target-version = ['py38'] +target-version = ["py39"] [tool.isort] profile = "black" [tool.mypy] -python_version = 3.8 +python_version = 3.9 ignore_missing_imports = true warn_redundant_casts = true warn_unused_ignores = true @@ -27,9 +27,6 @@ classifiers = [ "Environment :: Console", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Topic :: Scientific/Engineering :: GIS", diff --git a/pyproject.toml b/pyproject.toml index b0421f467..aaee3bbbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 110 -target-version = ['py38'] +target-version = ["py39"] [tool.isort] multi_line_output = 3 @@ -10,7 +10,7 @@ use_parentheses = true line_length = 110 [tool.mypy] -python_version = 3.8 +python_version = 3.9 ignore_missing_imports = true warn_redundant_casts = true warn_unused_ignores = true @@ -32,9 +32,6 @@ classifiers = [ "Environment :: Console", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Typing :: Typed", @@ -75,7 +72,7 @@ c2cciutils-download-applications = "c2cciutils.scripts.download_applications:mai c2cciutils-docker-versions-gen = "c2cciutils.scripts.docker_versions_gen:main" [tool.poetry.dependencies] -python = ">=3.8,<4.0" +python = ">=3.9,<4.0" markdown-table = "2020.12.3" python-magic = "0.4.27" requests = "2.31.0"