aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sec_certs/sample
diff options
context:
space:
mode:
authoradamjanovsky2023-11-10 12:54:00 +0100
committerGitHub2023-11-10 12:54:00 +0100
commit1ccca9ae8afa8e6574e1cbba2c93b8d5428e2b2e (patch)
treec0c2f35f921f3551f2bf0a146c1cbd6c0494f7a9 /src/sec_certs/sample
parent5968e53d9f78d744c1bd151be0d754282e65baee (diff)
parent10aa312c5e83c197a2d41fec710c5301bfff169e (diff)
downloadsec-certs-1ccca9ae8afa8e6574e1cbba2c93b8d5428e2b2e.tar.gz
sec-certs-1ccca9ae8afa8e6574e1cbba2c93b8d5428e2b2e.tar.zst
sec-certs-1ccca9ae8afa8e6574e1cbba2c93b8d5428e2b2e.zip
Merge pull request #373 from crocs-muni/switch-black-to-ruff
switch black -> ruff format
Diffstat (limited to 'src/sec_certs/sample')
-rw-r--r--src/sec_certs/sample/cc.py15
-rw-r--r--src/sec_certs/sample/fips.py2
-rw-r--r--src/sec_certs/sample/sar.py2
3 files changed, 9 insertions, 10 deletions
diff --git a/src/sec_certs/sample/cc.py b/src/sec_certs/sample/cc.py
index c89f67c6..f2087eeb 100644
--- a/src/sec_certs/sample/cc.py
+++ b/src/sec_certs/sample/cc.py
@@ -247,7 +247,7 @@ class CCCertificate(
st_filename: str | None = field(default=None)
def __bool__(self) -> bool:
- return any([x is not None for x in vars(self)])
+ return any(x is not None for x in vars(self))
@property
def bsi_data(self) -> dict[str, Any] | None:
@@ -612,13 +612,12 @@ class CCCertificate(
)
for att, val in vars(self).items():
- if not val:
- setattr(self, att, getattr(other, att))
- elif other_source == "html" and att == "protection_profiles":
- setattr(self, att, getattr(other, att))
- elif other_source == "html" and att == "maintenance_updates":
- setattr(self, att, getattr(other, att))
- elif att == "state":
+ if (
+ (not val)
+ or (other_source == "html" and att == "protection_profiles")
+ or (other_source == "html" and att == "maintenance_updates")
+ or (att == "state")
+ ):
setattr(self, att, getattr(other, att))
else:
if getattr(self, att) != getattr(other, att):
diff --git a/src/sec_certs/sample/fips.py b/src/sec_certs/sample/fips.py
index 26510191..e0bcb74a 100644
--- a/src/sec_certs/sample/fips.py
+++ b/src/sec_certs/sample/fips.py
@@ -64,7 +64,7 @@ class FIPSHTMLParser:
)
entries = [(FIPSHTMLParser.normalize_string(key.text), entry) for key, entry in entries]
entries = [parse_single_detail_entry(*x) for x in entries if x[0] in DETAILS_KEY_NORMALIZATION_DICT]
- entries = {x: y for x, y in entries}
+ entries = dict(entries)
if "caveat" in entries:
entries["mentioned_certs"] = FIPSHTMLParser.get_mentioned_certs_from_caveat(entries["caveat"])
diff --git a/src/sec_certs/sample/sar.py b/src/sec_certs/sample/sar.py
index 8f48f417..e3d7bd2b 100644
--- a/src/sec_certs/sample/sar.py
+++ b/src/sec_certs/sample/sar.py
@@ -50,7 +50,7 @@ class SAR(ComplexSerializableType):
@staticmethod
def matches_re(string: str) -> bool:
return any(
- [re.match(sar_class + "(?:_[A-Z]{3,4}){1,2}(?:\\.[0-9]){0,2}", string) for sar_class in SAR_CLASS_MAPPING]
+ re.match(sar_class + "(?:_[A-Z]{3,4}){1,2}(?:\\.[0-9]){0,2}", string) for sar_class in SAR_CLASS_MAPPING
)
def __lt__(self, other: Any) -> bool: