aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJ08nY2025-11-19 12:41:26 +0100
committerJ08nY2025-11-19 12:41:26 +0100
commitb16bbbcc83c017267f0401347ef8119ba80f782c (patch)
treec67e786b82fe09efcab71514b58946e05b616a97 /src
parentdd94905479541bb321d033a5b17ef99ecb3374df (diff)
downloadsec-certs-b16bbbcc83c017267f0401347ef8119ba80f782c.tar.gz
sec-certs-b16bbbcc83c017267f0401347ef8119ba80f782c.tar.zst
sec-certs-b16bbbcc83c017267f0401347ef8119ba80f782c.zip
Apply ruff fixes.
Also needed a mypy ignore on the extract monstrosity.
Diffstat (limited to 'src')
-rw-r--r--src/sec_certs/configuration.py6
-rw-r--r--src/sec_certs/utils/extract.py17
2 files changed, 14 insertions, 9 deletions
diff --git a/src/sec_certs/configuration.py b/src/sec_certs/configuration.py
index 17db9318..c06f872a 100644
--- a/src/sec_certs/configuration.py
+++ b/src/sec_certs/configuration.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import json
from pathlib import Path
-from typing import Literal, Optional
+from typing import Literal
import yaml
from pydantic import AnyHttpUrl, Field
@@ -121,7 +121,7 @@ class Configuration(BaseSettings):
True,
description="During keyword search, first page usually contains addresses - ignore it.",
)
- cc_reference_annotator_dir: Optional[Path] = Field( # noqa: UP007
+ cc_reference_annotator_dir: Path | None = Field( # noqa: UP007
None,
description="Path to directory with serialized reference annotator model. If set to `null`, tool will search default directory for the given dataset.",
)
@@ -141,7 +141,7 @@ class Configuration(BaseSettings):
True,
description="If true, progress bars will be printed to stdout during computation.",
)
- nvd_api_key: Optional[str] = Field(None, description="NVD API key for access to CVEs and CPEs.") # noqa: UP007
+ nvd_api_key: str | None = Field(None, description="NVD API key for access to CVEs and CPEs.") # noqa: UP007
preferred_source_remote_datasets: Literal["sec-certs", "origin"] = Field(
"sec-certs",
description="If set to `sec-certs`, will fetch remote datasets from sec-certs.org."
diff --git a/src/sec_certs/utils/extract.py b/src/sec_certs/utils/extract.py
index 35361e94..f72fd837 100644
--- a/src/sec_certs/utils/extract.py
+++ b/src/sec_certs/utils/extract.py
@@ -6,7 +6,7 @@ import re
from collections import Counter
from enum import Enum
from pathlib import Path
-from typing import Any
+from typing import Any, no_type_check
import numpy as np
@@ -17,7 +17,8 @@ from sec_certs.constants import FILE_ERRORS_STRATEGY, LINE_SEPARATOR, MAX_ALLOWE
logger = logging.getLogger(__name__)
-def search_only_headers_anssi(filepath: Path): # noqa: C901
+@no_type_check
+def search_only_headers_anssi(filepath: Path): # type: ignore # noqa: C901
# TODO: Please, refactor me. I reallyyyyyyyyyyyyy need it!!!!!!
class HEADER_TYPE(Enum):
HEADER_FULL = 1
@@ -272,7 +273,8 @@ def search_only_headers_anssi(filepath: Path): # noqa: C901
return items_found
-def search_only_headers_bsi(filepath: Path): # noqa: C901
+@no_type_check
+def search_only_headers_bsi(filepath: Path): # type: ignore # noqa: C901
# TODO: Please, refactor me. I reallyyyyyyyyyyyyy need it!!!!!!
LINE_SEPARATOR_STRICT = " "
NUM_LINES_TO_INVESTIGATE = 15
@@ -371,7 +373,8 @@ def search_only_headers_bsi(filepath: Path): # noqa: C901
return items_found
-def search_only_headers_nscib(filepath: Path): # noqa: C901
+@no_type_check
+def search_only_headers_nscib(filepath: Path): # type: ignore # noqa: C901
# TODO: Please, refactor me. I reallyyyyyyyyyyyyy need it!!!!!!
LINE_SEPARATOR_STRICT = " "
NUM_LINES_TO_INVESTIGATE = 60
@@ -451,7 +454,8 @@ def search_only_headers_nscib(filepath: Path): # noqa: C901
return items_found
-def search_only_headers_niap(filepath: Path):
+@no_type_check
+def search_only_headers_niap(filepath: Path): # type: ignore # noqa: C901
# TODO: Please, refactor me. I reallyyyyyyyyyyyyy need it!!!!!!
LINE_SEPARATOR_STRICT = " "
NUM_LINES_TO_INVESTIGATE = 15
@@ -502,7 +506,8 @@ def search_only_headers_niap(filepath: Path):
return items_found
-def search_only_headers_canada(filepath: Path): # noqa: C901
+@no_type_check
+def search_only_headers_canada(filepath: Path): # type: ignore # noqa: C901
# TODO: Please, refactor me. I reallyyyyyyyyyyyyy need it!!!!!!
LINE_SEPARATOR_STRICT = " "
NUM_LINES_TO_INVESTIGATE = 20