aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormmstanone2022-02-13 22:37:50 +0100
committermmstanone2022-02-13 22:37:50 +0100
commitf780c7c00cf0e752087f3260e814769ac0b63d64 (patch)
tree6dd81dfa5467b4c05213664a2f624fd37f4c8490
parentb51c95d0fb78c4d28f495f90d184b4ebe850427b (diff)
downloadsec-certs-f780c7c00cf0e752087f3260e814769ac0b63d64.tar.gz
sec-certs-f780c7c00cf0e752087f3260e814769ac0b63d64.tar.zst
sec-certs-f780c7c00cf0e752087f3260e814769ac0b63d64.zip
fix failing flake8
-rw-r--r--sec_certs/helpers.py4
-rw-r--r--sec_certs/sample/common_criteria.py14
2 files changed, 12 insertions, 6 deletions
diff --git a/sec_certs/helpers.py b/sec_certs/helpers.py
index 19aa6401..6c775e73 100644
--- a/sec_certs/helpers.py
+++ b/sec_certs/helpers.py
@@ -609,7 +609,7 @@ def search_only_headers_bsi(filepath: Path): # noqa: C901
# Port from old-api branch
-def search_only_headers_nscib(filepath: Path):
+def search_only_headers_nscib(filepath: Path): # noqa: C901
LINE_SEPARATOR_STRICT = " "
NUM_LINES_TO_INVESTIGATE = 60
items_found: Dict[str, str] = {}
@@ -740,7 +740,7 @@ def search_only_headers_niap(filepath: Path):
# Port from old-api branch
-def search_only_headers_canada(filepath: Path):
+def search_only_headers_canada(filepath: Path): # noqa: C901
LINE_SEPARATOR_STRICT = " "
NUM_LINES_TO_INVESTIGATE = 20
items_found: Dict[str, str] = {}
diff --git a/sec_certs/sample/common_criteria.py b/sec_certs/sample/common_criteria.py
index a24bf5be..5dda7326 100644
--- a/sec_certs/sample/common_criteria.py
+++ b/sec_certs/sample/common_criteria.py
@@ -693,10 +693,7 @@ class CommonCriteriaCert(Certificate["CommonCriteriaCert"], PandasSerializableTy
return cert_id.startswith("BSI-DSZ-CC-")
@staticmethod
- def _fix_bsi_cert_id(cert_id: str, all_cert_ids: Set[str]) -> str:
- start_year = 1996
- limit_year = datetime.now().year + 1
- bsi_parts = cert_id.split("-")
+ def _extract_bsi_parts(bsi_parts: List[str]) -> Tuple:
cert_num = None
cert_version = None
cert_year = None
@@ -711,6 +708,15 @@ class CommonCriteriaCert(Certificate["CommonCriteriaCert"], PandasSerializableTy
if len(bsi_parts) > 5:
cert_year = bsi_parts[5]
+ return cert_num, cert_version, cert_year
+
+ @staticmethod
+ def _fix_bsi_cert_id(cert_id: str, all_cert_ids: Set[str]) -> str:
+ start_year = 1996
+ limit_year = datetime.now().year + 1
+ bsi_parts = cert_id.split("-")
+
+ cert_num, cert_version, cert_year = CommonCriteriaCert._extract_bsi_parts(bsi_parts)
if cert_year is None:
for year in range(start_year, limit_year):
cert_id_possible = cert_id + "-" + str(year)