diff --git a/archivist/assets.py b/archivist/assets.py index 3746125b..5d24d880 100644 --- a/archivist/assets.py +++ b/archivist/assets.py @@ -107,9 +107,7 @@ class _AssetsClient: def __init__(self, archivist: "type_helper.Archivist"): self._archivist = archivist - def create( - self, behaviours: List, attrs: Dict, *, confirm: bool = False - ) -> Asset: + def create(self, behaviours: List, attrs: Dict, *, confirm: bool = False) -> Asset: """Create asset Creates asset with defined behaviours and attributes. @@ -132,9 +130,7 @@ def create( confirm=confirm, ) - def create_from_data( - self, data: Dict, *, confirm: bool = False - ) -> Asset: + def create_from_data(self, data: Dict, *, confirm: bool = False) -> Asset: """Create asset Creates asset with request body from data stream. @@ -157,7 +153,7 @@ def create_from_data( if not confirm: return asset - return wait_for_confirmation(self, asset["identity"]) # type: ignore The None return is unreachable + return wait_for_confirmation(self, asset["identity"]) # type: ignore def read(self, identity: str) -> Asset: """Read asset diff --git a/archivist/confirm.py b/archivist/confirm.py index 753d2e23..b7f99eaf 100644 --- a/archivist/confirm.py +++ b/archivist/confirm.py @@ -67,7 +67,10 @@ def wait_for_confirmation(self, identity): if entity[CONFIRMATION_STATUS] == CONFIRMATION_CONFIRMED: return entity - return None + return None # this line is unreachable to function that use it + # But will mess up any linters that use type hints + # Remember to ignore the return type if you use this + # Function def __on_giveup_confirmed(details): diff --git a/archivist/events.py b/archivist/events.py index fef02ed0..d8e569c5 100644 --- a/archivist/events.py +++ b/archivist/events.py @@ -148,9 +148,7 @@ def create( confirm=confirm, ) - def create_from_data( - self, asset_id: str, data: Dict, *, confirm=False - ) -> Event: + def create_from_data(self, asset_id: str, data: Dict, *, confirm=False) -> Event: """Create event Creates event for given asset from data. @@ -174,7 +172,7 @@ def create_from_data( if not confirm: return event - return wait_for_confirmation(self, event["identity"]) # type: ignore The None return is unreachable + return wait_for_confirmation(self, event["identity"]) # type: ignore def read(self, identity: str) -> Event: """Read event