aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJ08nY2023-04-26 13:36:54 +0200
committerJ08nY2023-04-26 13:36:54 +0200
commit6448911bb5872feb281b0151d63c54eeeb887cc7 (patch)
treeba66ba67810af5babf7eeb29c20b7dc67c9aab77 /src
parentda4671fa87a4ef2ddd4a3aa2cc9ed3d1c16087af (diff)
downloadsec-certs-6448911bb5872feb281b0151d63c54eeeb887cc7.tar.gz
sec-certs-6448911bb5872feb281b0151d63c54eeeb887cc7.tar.zst
sec-certs-6448911bb5872feb281b0151d63c54eeeb887cc7.zip
Fix Turkey CC scheme NaNs.
Diffstat (limited to 'src')
-rw-r--r--src/sec_certs/sample/cc_scheme.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/sec_certs/sample/cc_scheme.py b/src/sec_certs/sample/cc_scheme.py
index 721dae25..12fb1fd4 100644
--- a/src/sec_certs/sample/cc_scheme.py
+++ b/src/sec_certs/sample/cc_scheme.py
@@ -3,6 +3,7 @@
from __future__ import annotations
import hashlib
+import math
import tempfile
import warnings
from dataclasses import dataclass
@@ -1320,18 +1321,19 @@ def get_turkey_certified() -> list[dict[str, Any]]:
dfs = tabula.read_pdf(str(pdf_path), pages="all")
for df in dfs:
for line in df.values: # type: ignore
+ values = [value if not (isinstance(value, float) and math.isnan(value)) else None for value in line]
cert = {
# TODO: Split item number and generate several dicts for a range they include.
- "item_no": line[0],
- "developer": line[1],
- "product": line[2],
- "cc_version": line[3],
- "level": line[4],
- "cert_lab": line[5],
- "certification_date": line[6],
- "expiration_date": line[7],
+ "item_no": values[0],
+ "developer": values[1],
+ "product": values[2],
+ "cc_version": values[3],
+ "level": values[4],
+ "cert_lab": values[5],
+ "certification_date": values[6],
+ "expiration_date": values[7],
# TODO: Parse "Ongoing Evaluation" out of this field as well.
- "archived": isinstance(line[9], str) and "Archived" in line[9],
+ "archived": isinstance(values[9], str) and "Archived" in values[9],
}
results.append(cert)
return results