Skip to content

Commit

Permalink
Make the linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy authored and eccles committed Jul 21, 2021
1 parent 8ab6bb7 commit 348e5c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
10 changes: 3 additions & 7 deletions archivist/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion archivist/confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions archivist/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 348e5c5

Please sign in to comment.