aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJ08nY2025-02-02 14:22:05 +0100
committerJ08nY2025-02-02 14:22:05 +0100
commit63f993bcf6bbc2a773d4c53f8c0723384ccb5336 (patch)
tree980be8fe3fec4b49fd298d74a2cd290b783df698 /src
parentb128c47291de8654b6b7ab0e225751847f286ea2 (diff)
downloadsec-certs-63f993bcf6bbc2a773d4c53f8c0723384ccb5336.tar.gz
sec-certs-63f993bcf6bbc2a773d4c53f8c0723384ccb5336.tar.zst
sec-certs-63f993bcf6bbc2a773d4c53f8c0723384ccb5336.zip
Add docs about dataset layout.
Diffstat (limited to 'src')
-rw-r--r--src/sec_certs/dataset/cc.py40
-rw-r--r--src/sec_certs/dataset/dataset.py2
-rw-r--r--src/sec_certs/dataset/fips.py17
-rw-r--r--src/sec_certs/dataset/protection_profile.py19
4 files changed, 73 insertions, 5 deletions
diff --git a/src/sec_certs/dataset/cc.py b/src/sec_certs/dataset/cc.py
index 1bf25994..b6f4caa5 100644
--- a/src/sec_certs/dataset/cc.py
+++ b/src/sec_certs/dataset/cc.py
@@ -44,8 +44,46 @@ from sec_certs.utils.profiling import staged
class CCDataset(Dataset[CCCertificate], ComplexSerializableType):
"""
- Class that holds CCCertificate. Serializable into json, pandas, dictionary. Conveys basic certificate manipulations
+ Class that holds :class:`sec_certs.sample.cc.CCCertificate` samples.
+
+ Serializable into json, pandas, dictionary. Conveys basic certificate manipulations
and dataset transformations. Many private methods that perform internal operations, feel free to exploit them.
+
+ The dataset directory looks like this:
+
+ ├── auxiliary_datasets
+ │ ├── cpe_dataset.json
+ │ ├── cve_dataset.json
+ │ ├── cpe_match.json
+ │ ├── cc_scheme.json
+ │ ├── protection_profiles
+ │ │ ├── reports
+ │ │ │ ├── pdf
+ │ │ │ └── txt
+ │ │ ├── pps
+ │ │ │ ├── pdf
+ │ │ │ └── txt
+ │ │ └── pp.json
+ │ └── maintenances
+ │ ├── certs
+ │ │ ├── reports
+ │ │ │ ├── pdf
+ │ │ │ └── txt
+ │ │ └── targets
+ │ │ ├── pdf
+ │ │ └── txt
+ │ └── maintenance_updates.json
+ ├── certs
+ │ ├── reports
+ │ │ ├── pdf
+ │ │ └── txt
+ │ ├── targets
+ │ │ ├── pdf
+ │ │ └── txt
+ │ └── certificates
+ │ ├── pdf
+ │ └── txt
+ └── dataset.json
"""
FULL_ARCHIVE_URL: ClassVar[AnyHttpUrl] = config.cc_latest_full_archive
diff --git a/src/sec_certs/dataset/dataset.py b/src/sec_certs/dataset/dataset.py
index bd7fff51..7a9c92ed 100644
--- a/src/sec_certs/dataset/dataset.py
+++ b/src/sec_certs/dataset/dataset.py
@@ -253,6 +253,7 @@ class Dataset(Generic[CertSubType], ComplexSerializableType, ABC):
def move_dataset(self, new_root_dir: str | Path) -> None:
"""
Moves all dataset files to `new_root_dir` and adjusts all paths internally. Deletes the artifacts from the original location.
+
:param str | Path new_root_dir: path to directory where the new dataset shall be stored.
"""
new_root_dir = Path(new_root_dir)
@@ -267,6 +268,7 @@ class Dataset(Generic[CertSubType], ComplexSerializableType, ABC):
def copy_dataset(self, new_root_dir: str | Path) -> None:
"""
Copies all dataset files to `new_root_dir` and adjusts all paths internally. Keeps the artifacts from the original location.
+
:param str | Path new_root_dir: path to directory where the new dataset shall be stored.
"""
new_root_dir = Path(new_root_dir)
diff --git a/src/sec_certs/dataset/fips.py b/src/sec_certs/dataset/fips.py
index 4c6ee16f..34b1147d 100644
--- a/src/sec_certs/dataset/fips.py
+++ b/src/sec_certs/dataset/fips.py
@@ -36,7 +36,22 @@ logger = logging.getLogger(__name__)
class FIPSDataset(Dataset[FIPSCertificate], ComplexSerializableType):
"""
- Class for processing of FIPSCertificate samples. Inherits from `ComplexSerializableType` and base abstract `Dataset` class.
+ Class for processing of :class:`sec_certs.sample.fips.FIPSCertificate` samples.
+
+ Inherits from `ComplexSerializableType` and base abstract `Dataset` class.
+
+ The dataset directory looks like this:
+
+ ├── auxiliary_datasets
+ │ ├── cpe_dataset.json
+ │ ├── cve_dataset.json
+ │ ├── cpe_match.json
+ │ └── algorithms.json
+ ├── certs
+ │ └── targets
+ │ ├── pdf
+ │ └── txt
+ └── dataset.json
"""
FULL_ARCHIVE_URL: ClassVar[AnyHttpUrl] = config.fips_latest_full_archive
diff --git a/src/sec_certs/dataset/protection_profile.py b/src/sec_certs/dataset/protection_profile.py
index 4d92ac00..2295191a 100644
--- a/src/sec_certs/dataset/protection_profile.py
+++ b/src/sec_certs/dataset/protection_profile.py
@@ -18,6 +18,22 @@ from sec_certs.utils.profiling import staged
class ProtectionProfileDataset(Dataset[ProtectionProfile], ComplexSerializableType):
+ """
+ Class for processing :class:`sec_certs.sample.protection_profile.ProtectionProfile` samples.
+
+ Inherits from `ComplexSerializableType` and base abstract `Dataset` class.
+
+ The dataset directory looks like this:
+
+ ├── reports
+ │ ├── pdf
+ │ └── txt
+ ├── pps
+ │ ├── pdf
+ │ └── txt
+ └── pp.json
+ """
+
FULL_ARCHIVE_URL: ClassVar[AnyHttpUrl] = config.pp_latest_full_archive
SNAPSHOT_URL: ClassVar[AnyHttpUrl] = config.pp_latest_snapshot
@@ -38,9 +54,6 @@ class ProtectionProfileDataset(Dataset[ProtectionProfile], ComplexSerializableTy
self.state = state if state else self.DatasetInternalState()
self.aux_handlers = aux_handlers
self.root_dir = Path(root_dir)
- """
- Class for processing ProtectionProfile samples. Inherits from `ComplexSerializableType` and base abstract `Dataset` class.
- """
@property
def json_path(self) -> Path: