Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXDRIVE-2711: Show that upload is still alive for very large files (Sourcery refactored) #4228

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Oct 10, 2023

Pull Request #4227 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch, then run:

git fetch origin sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from swetayadav1 October 10, 2023 07:08
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Sourcery AI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (c21d4f1) 47.79% compared to head (893d1aa) 47.79%.

Additional details and impacted files
@@                                          Coverage Diff                                           @@
##           wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files    #4228   +/-   ##
======================================================================================================
  Coverage                                                                  47.79%   47.79%           
======================================================================================================
  Files                                                                         94       94           
  Lines                                                                      15677    15657   -20     
======================================================================================================
- Hits                                                                        7493     7484    -9     
+ Misses                                                                      8184     8173   -11     
Flag Coverage Δ
functional 36.75% <17.39%> (+<0.01%) ⬆️
integration 2.06% <0.00%> (?)
unit 37.43% <34.78%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
nxdrive/engine/activity.py 97.77% <100.00%> (-0.05%) ⬇️
nxdrive/client/uploader/__init__.py 30.63% <0.00%> (+0.27%) ⬆️
nxdrive/dao/engine.py 62.22% <77.77%> (-0.02%) ⬇️
nxdrive/gui/view.py 40.07% <0.00%> (+0.86%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 8939f22 to f7c4888 Compare October 11, 2023 07:17
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from f7c4888 to 2ad7584 Compare October 11, 2023 07:40
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 2ad7584 to 64c5e7f Compare October 12, 2023 07:05
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 64c5e7f to 64b67b9 Compare October 12, 2023 11:07
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 64b67b9 to e8dad39 Compare October 17, 2023 06:48
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from e8dad39 to 52c56f7 Compare October 17, 2023 11:52
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 52c56f7 to 399aa9c Compare October 18, 2023 12:32
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 399aa9c to a124e61 Compare October 18, 2023 12:49
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from a124e61 to f44f4df Compare October 25, 2023 11:42
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from f44f4df to 21f9bbc Compare October 25, 2023 11:51
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 21f9bbc to 625754b Compare October 25, 2023 12:41
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 625754b to b686f2a Compare October 25, 2023 12:43
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from b686f2a to b95782a Compare October 25, 2023 14:35
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from b95782a to daf2480 Compare October 26, 2023 06:40
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from daf2480 to 380b4da Compare October 26, 2023 08:49
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from 380b4da to a5a9fe2 Compare October 26, 2023 09:08
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch from a5a9fe2 to 893d1aa Compare November 2, 2023 09:11
Comment on lines -360 to +362
# Handle status changes every time a chunk is sent
_transfer = self.get_upload(
if _transfer := self.get_upload(
doc_pair=transfer.doc_pair, path=transfer.path
)
if _transfer:
):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BaseUploader.upload_chunks refactored with the following changes:

This removes the following comments ( why? ):

# Handle status changes every time a chunk is sent

Comment on lines -505 to -509
res = self.remote.fetch(
return self.remote.fetch(
f"{self.remote.client.api_path}/path{transfer.remote_parent_path}",
headers=headers,
)
return res
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BaseUploader._transfer_docType_file refactored with the following changes:

return bool(c.rowcount > 0)
return c.rowcount > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EngineDAO.release_processor refactored with the following changes:

return bool(c.rowcount == 1)
return c.rowcount == 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EngineDAO.acquire_processor refactored with the following changes:

update + " " + self._get_recursive_remote_condition(doc_pair),
f"{update} {self._get_recursive_remote_condition(doc_pair)}",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EngineDAO.delete_remote_state refactored with the following changes:

Comment on lines -133 to +131
signal = getattr(reporter, f"action_{evt}", None)
if signal:
if signal := getattr(reporter, f"action_{evt}", None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function FileAction._connect_reporter refactored with the following changes:

if not engine:
return ""

return getattr(engine, self.names[role].decode())
return "" if not engine else getattr(engine, self.names[role].decode())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EngineModel.data refactored with the following changes:

Comment on lines -99 to +96
if not engine:
return ""

return getattr(engine, role)
return "" if not engine else getattr(engine, role)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EngineModel.get refactored with the following changes:

Comment on lines -499 to +504
datetime = get_date_from_sqlite(row["created_on"])
if datetime:
if datetime := get_date_from_sqlite(row["created_on"]):
label += "_ON"
# As date_time is in UTC
offset = tzlocal().utcoffset(datetime)
if offset:
if offset := tzlocal().utcoffset(datetime):
datetime += offset
args.append(Translator.format_datetime(datetime))
return self.tr(label, values=args)
elif role == self.COMPLETED_ON:
label = "COMPLETED" if row["status"].name == "DONE" else "CANCELLED"
args = []
datetime = get_date_from_sqlite(row["completed_on"])
if datetime:
if datetime := get_date_from_sqlite(row["completed_on"]):
label += "_ON"
offset = tzlocal().utcoffset(datetime)
if offset:
if offset := tzlocal().utcoffset(datetime):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ActiveSessionModel.data refactored with the following changes:

This removes the following comments ( why? ):

# As date_time is in UTC

datetime = get_date_from_sqlite(row["created_on"])
if datetime:
if datetime := get_date_from_sqlite(row["created_on"]):
label += "_ON"
# As date_time is in UTC
offset = tzlocal().utcoffset(datetime)
if offset:
if offset := tzlocal().utcoffset(datetime):
datetime += offset
args.append(Translator.format_datetime(datetime))
return self.tr(label, values=args)
elif role == self.COMPLETED_ON:
label = "COMPLETED" if row["status"].name == "DONE" else "CANCELLED"
args = []
datetime = get_date_from_sqlite(row["completed_on"])
if datetime:
if datetime := get_date_from_sqlite(row["completed_on"]):
label += "_ON"
offset = tzlocal().utcoffset(datetime)
if offset:
if offset := tzlocal().utcoffset(datetime):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompletedSessionModel.data refactored with the following changes:

This removes the following comments ( why? ):

# As date_time is in UTC

Base automatically changed from wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files to master November 2, 2023 13:45
@sourcery-ai sourcery-ai bot closed this Nov 2, 2023
@sourcery-ai sourcery-ai bot deleted the sourcery/wip-NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files branch November 2, 2023 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants