Skip to content

Commit 36abd32

Browse files
committed
Adjust type hints to comply with the pyupgrade pre-commit hook
This gets rid of some errors from the pyupgrade pre-commit hook.
1 parent 224fb0d commit 36abd32

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/cyhy_cvesync/cve_sync.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from io import BytesIO
77
import json
88
import logging
9-
from typing import Dict, List, Tuple
109
import urllib.request
1110

1211
# Third-Party Libraries
@@ -24,15 +23,15 @@
2423
PREFERRED_CVSS_METRICS = ["cvssMetricV31", "cvssMetricV30", "cvssMetricV2"]
2524

2625
# Map to track existing CVE documents that were not updated
27-
cve_map: Dict[str, CVEDoc] = {}
26+
cve_map: dict[str, CVEDoc] = {}
2827
cve_map_lock = asyncio.Lock()
2928

3029
logger = logging.getLogger(f"{CYHY_ROOT_LOGGER}.{__name__}")
3130

3231

3332
async def process_cve_json(
3433
cve_json: dict, cve_authoritative_source: str
35-
) -> Tuple[int, int]:
34+
) -> tuple[int, int]:
3635
"""
3736
Process the provided CVEs JSON and update the database with their contents.
3837
@@ -186,11 +185,11 @@ async def fetch_cve_data(session: ClientSession, cve_url: str, gzipped: bool) ->
186185

187186

188187
async def process_urls(
189-
cve_urls: List[str],
188+
cve_urls: list[str],
190189
cve_data_gzipped: bool,
191190
concurrency: int,
192191
cve_authoritative_source: str,
193-
) -> Tuple[int, int, int]:
192+
) -> tuple[int, int, int]:
194193
"""
195194
Process URLs containing CVE data.
196195

src/cyhy_cvesync/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import asyncio
66
import logging
77
import sys
8-
from typing import Optional
98

109
# Third-Party Libraries
1110
from cyhy_config import get_config
@@ -33,7 +32,7 @@ def generate_urls(url_pattern: str) -> list[str]:
3332

3433

3534
async def do_cve_sync(
36-
config_file: Optional[str] = None, arg_log_level: Optional[str] = None
35+
config_file: str | None = None, arg_log_level: str | None = None
3736
) -> None:
3837
"""Perform the CVE synchronization."""
3938
setup_logging(arg_log_level)

src/cyhy_cvesync/models/config_model.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""Model definitions for the configuration."""
22

3-
# Standard Python Libraries
4-
from typing import Optional
5-
63
# Third-Party Libraries
74
from pydantic import BaseModel, ConfigDict, Field
85

@@ -31,7 +28,7 @@ class CVESync(BaseModel):
3128
default=DEFAULT_CVE_URL_PATTERN,
3229
description="URL pattern for the CVE JSON file; note that {year} in the pattern will be substituted with each valid year",
3330
)
34-
log_level: Optional[str] = Field(
31+
log_level: str | None = Field(
3532
None,
3633
description="Logging level",
3734
)

0 commit comments

Comments
 (0)