Skip to content

Commit 348e5c5

Browse files
serhiyeccles
authored andcommitted
Make the linter happy
1 parent 8ab6bb7 commit 348e5c5

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

archivist/assets.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ class _AssetsClient:
107107
def __init__(self, archivist: "type_helper.Archivist"):
108108
self._archivist = archivist
109109

110-
def create(
111-
self, behaviours: List, attrs: Dict, *, confirm: bool = False
112-
) -> Asset:
110+
def create(self, behaviours: List, attrs: Dict, *, confirm: bool = False) -> Asset:
113111
"""Create asset
114112
115113
Creates asset with defined behaviours and attributes.
@@ -132,9 +130,7 @@ def create(
132130
confirm=confirm,
133131
)
134132

135-
def create_from_data(
136-
self, data: Dict, *, confirm: bool = False
137-
) -> Asset:
133+
def create_from_data(self, data: Dict, *, confirm: bool = False) -> Asset:
138134
"""Create asset
139135
140136
Creates asset with request body from data stream.
@@ -157,7 +153,7 @@ def create_from_data(
157153
if not confirm:
158154
return asset
159155

160-
return wait_for_confirmation(self, asset["identity"]) # type: ignore The None return is unreachable
156+
return wait_for_confirmation(self, asset["identity"]) # type: ignore
161157

162158
def read(self, identity: str) -> Asset:
163159
"""Read asset

archivist/confirm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def wait_for_confirmation(self, identity):
6767
if entity[CONFIRMATION_STATUS] == CONFIRMATION_CONFIRMED:
6868
return entity
6969

70-
return None
70+
return None # this line is unreachable to function that use it
71+
# But will mess up any linters that use type hints
72+
# Remember to ignore the return type if you use this
73+
# Function
7174

7275

7376
def __on_giveup_confirmed(details):

archivist/events.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ def create(
148148
confirm=confirm,
149149
)
150150

151-
def create_from_data(
152-
self, asset_id: str, data: Dict, *, confirm=False
153-
) -> Event:
151+
def create_from_data(self, asset_id: str, data: Dict, *, confirm=False) -> Event:
154152
"""Create event
155153
156154
Creates event for given asset from data.
@@ -174,7 +172,7 @@ def create_from_data(
174172
if not confirm:
175173
return event
176174

177-
return wait_for_confirmation(self, event["identity"]) # type: ignore The None return is unreachable
175+
return wait_for_confirmation(self, event["identity"]) # type: ignore
178176

179177
def read(self, identity: str) -> Event:
180178
"""Read event

0 commit comments

Comments
 (0)