From 2eed76ddc3f19e089bc9a6cee8ceb53ff1714d29 Mon Sep 17 00:00:00 2001 From: mmstanone Date: Thu, 11 Nov 2021 11:52:19 +0100 Subject: LSP + paths --- sec_certs/certificate/certificate.py | 4 +++- sec_certs/certificate/protection_profile.py | 2 +- sec_certs/dataset/dataset.py | 4 +++- sec_certs/dataset/protection_profile.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sec_certs/certificate/certificate.py b/sec_certs/certificate/certificate.py index ddcd2cb7..e6276621 100644 --- a/sec_certs/certificate/certificate.py +++ b/sec_certs/certificate/certificate.py @@ -34,7 +34,9 @@ class Certificate(ABC, ComplexSerializableType): def label_studio_title(self): raise NotImplementedError('Not meant to be implemented') - def __eq__(self, other: 'Certificate') -> bool: + def __eq__(self, other: object) -> bool: + if not isinstance(other, Certificate): + return NotImplemented return self.dgst == other.dgst def to_dict(self): diff --git a/sec_certs/certificate/protection_profile.py b/sec_certs/certificate/protection_profile.py index 1bca2c31..976c7666 100644 --- a/sec_certs/certificate/protection_profile.py +++ b/sec_certs/certificate/protection_profile.py @@ -15,7 +15,7 @@ class ProtectionProfile(ComplexSerializableType): """ Object for holding protection profiles. """ - pp_name: str + pp_name: Optional[str] pp_link: Optional[str] = None pp_ids: Optional[FrozenSet[str]] = None diff --git a/sec_certs/dataset/dataset.py b/sec_certs/dataset/dataset.py index 0842122d..c4673373 100644 --- a/sec_certs/dataset/dataset.py +++ b/sec_certs/dataset/dataset.py @@ -74,7 +74,9 @@ class Dataset(ABC): def __len__(self) -> int: return len(self.certs) - def __eq__(self, other: 'Dataset') -> bool: + def __eq__(self, other: object) -> bool: + if not isinstance(other, Dataset): + return NotImplemented return self.certs == other.certs def __str__(self) -> str: diff --git a/sec_certs/dataset/protection_profile.py b/sec_certs/dataset/protection_profile.py index 51617b1c..99420dc6 100644 --- a/sec_certs/dataset/protection_profile.py +++ b/sec_certs/dataset/protection_profile.py @@ -47,7 +47,7 @@ class ProtectionProfileDataset: return cls(dct) @classmethod - def from_web(cls, store_dataset_path: Optional[Union[str, Path]]): + def from_web(cls, store_dataset_path: Optional[Path]): logger.info(f'Downloading static PP dataset from: {cls.static_dataset_url}') if not store_dataset_path: tmp = tempfile.TemporaryDirectory() -- cgit v1.3.1