-
Notifications
You must be signed in to change notification settings - Fork 53
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
…NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files
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 ReportAttention:
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
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
8939f22
to
f7c4888
Compare
f7c4888
to
2ad7584
Compare
2ad7584
to
64c5e7f
Compare
64c5e7f
to
64b67b9
Compare
64b67b9
to
e8dad39
Compare
e8dad39
to
52c56f7
Compare
52c56f7
to
399aa9c
Compare
…NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files
399aa9c
to
a124e61
Compare
a124e61
to
f44f4df
Compare
f44f4df
to
21f9bbc
Compare
21f9bbc
to
625754b
Compare
625754b
to
b686f2a
Compare
…NXDRIVE-2711-Show-that-upload-is-still-alive-for-very-large-files
b686f2a
to
b95782a
Compare
b95782a
to
daf2480
Compare
daf2480
to
380b4da
Compare
380b4da
to
a5a9fe2
Compare
a5a9fe2
to
893d1aa
Compare
# 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: | ||
): |
There was a problem hiding this comment.
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:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
This removes the following comments ( why? ):
# Handle status changes every time a chunk is sent
res = self.remote.fetch( | ||
return self.remote.fetch( | ||
f"{self.remote.client.api_path}/path{transfer.remote_parent_path}", | ||
headers=headers, | ||
) | ||
return res |
There was a problem hiding this comment.
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:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
return bool(c.rowcount > 0) | ||
return c.rowcount > 0 |
There was a problem hiding this comment.
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:
- Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
return bool(c.rowcount == 1) | ||
return c.rowcount == 1 |
There was a problem hiding this comment.
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:
- Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
update + " " + self._get_recursive_remote_condition(doc_pair), | ||
f"{update} {self._get_recursive_remote_condition(doc_pair)}", |
There was a problem hiding this comment.
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:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
signal = getattr(reporter, f"action_{evt}", None) | ||
if signal: | ||
if signal := getattr(reporter, f"action_{evt}", None): |
There was a problem hiding this comment.
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:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
if not engine: | ||
return "" | ||
|
||
return getattr(engine, self.names[role].decode()) | ||
return "" if not engine else getattr(engine, self.names[role].decode()) |
There was a problem hiding this comment.
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:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if not engine: | ||
return "" | ||
|
||
return getattr(engine, role) | ||
return "" if not engine else getattr(engine, role) |
There was a problem hiding this comment.
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:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
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): |
There was a problem hiding this comment.
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:
- Use named expression to simplify assignment and conditional [×4] (
use-named-expression
)
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): |
There was a problem hiding this comment.
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:
- Use named expression to simplify assignment and conditional [×4] (
use-named-expression
)
This removes the following comments ( why? ):
# As date_time is in UTC
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:Help us improve this pull request!