Skip to content

Commit

Permalink
NXDRIVE-2711: Sourcery refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
swetayadav1 committed Nov 2, 2023
1 parent 345078c commit c21d4f1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
11 changes: 5 additions & 6 deletions nxdrive/client/uploader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,11 @@ def link_blob_to_doc(
kwargs["headers"] = headers
try:
doc_type = kwargs.get("doc_type", "")
if transfer.is_direct_transfer and doc_type and doc_type != "":
res = self._transfer_docType_file(transfer, headers, doc_type)
else:
res = self._transfer_autoType_file(command, blob, kwargs)

return res
return (
self._transfer_docType_file(transfer, headers, doc_type)
if transfer.is_direct_transfer and doc_type and doc_type != ""
else self._transfer_autoType_file(command, blob, kwargs)
)
except Exception as exc:
err = f"Error while linking blob to doc: {exc!r}"
log.warning(err)
Expand Down
3 changes: 1 addition & 2 deletions nxdrive/engine/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def get_current_action(*, thread_id: int = None) -> Optional["Action"]:

@staticmethod
def finish_action() -> None:
action = Action.actions.pop(current_thread_id(), None)
if action:
if action := Action.actions.pop(current_thread_id(), None):
action.finish()

def finish(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_client_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
def baseuploader():
remote = Remote
remote.dao = Mock()
baseuploader = BaseUploader(remote)
return baseuploader
return BaseUploader(remote)


def test_link_blob_to_doc(baseuploader, upload, tmp_path, monkeypatch):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_engine_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def test_migration_db_v10(engine_dao):
"""Verify Downloads after migration from v9 to v10."""
with engine_dao("engine_migration_10.db") as dao:
downloads = list(dao.get_downloads())
assert len(downloads) == 0
assert not downloads

states = list(dao.get_states_from_partial_local(Path()))
assert len(states) == 4
Expand Down

0 comments on commit c21d4f1

Please sign in to comment.