-
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-2861: Fix behavior when not entering the correct URL format (Sourcery refactored) #4338
Conversation
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. |
1 similar comment
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-2861-Fix-behavior-when-not-entering-the-correct-URL-formatt #4338 +/- ##
===========================================================================================================
+ Coverage 48.99% 49.10% +0.10%
===========================================================================================================
Files 94 94
Lines 15680 15645 -35
===========================================================================================================
Hits 7683 7683
+ Misses 7997 7962 -35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…ixed failed style
2d5d618
to
7d6c48b
Compare
…ering-the-correct-URL-formatt
7d6c48b
to
4fe67fb
Compare
engine = self._manager.engines.get(uid) | ||
if not engine: | ||
if engine := self._manager.engines.get(uid): | ||
return [s.export() for s in engine.dao.get_last_files(number)] | ||
else: | ||
return [] | ||
return [s.export() for s in engine.dao.get_last_files(number)] |
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 QMLDriveApi.get_last_files
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
count = 0 | ||
engine = self._manager.engines.get(uid) | ||
if engine: | ||
count = engine.dao.get_last_files_count(duration=60) | ||
return count | ||
return ( | ||
engine.dao.get_last_files_count(duration=60) | ||
if (engine := self._manager.engines.get(uid)) | ||
else 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 QMLDriveApi.get_last_files_count
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Move setting of default value for variable into
else
branch (introduce-default-else
) - Replace if statement with if expression (
assign-if-exp
) - Inline variable that is immediately returned (
inline-immediately-returned-variable
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.get_active_sessions_count
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.get_completed_sessions_count
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(engine_uid) | ||
if not engine: | ||
if engine := self._manager.engines.get(engine_uid): | ||
engine.dao.pause_transfer( | ||
nature, transfer_uid, progress, is_direct_transfer=is_direct_transfer | ||
) | ||
else: | ||
return | ||
engine.dao.pause_transfer( | ||
nature, transfer_uid, progress, is_direct_transfer=is_direct_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 QMLDriveApi.pause_transfer
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.open_remote_server
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
else: | ||
engine = self._manager.engines.get(uid) | ||
if engine: | ||
filepath = engine.local.abspath(filepath) | ||
self._manager.open_local_file(filepath) | ||
elif engine := self._manager.engines.get(uid): | ||
filepath = engine.local.abspath(filepath) | ||
self._manager.open_local_file(filepath) |
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 QMLDriveApi.open_local
refactored with the following changes:
- Merge else clause's nested if statement into elif (
merge-else-if-into-elif
) - Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.show_conflicts_resolution
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
result = {k: v for k, v in sorted(result.items(), key=lambda item: item[1])} | ||
result = dict(sorted(result.items(), key=lambda item: item[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 QMLDriveApi._balance_percents
refactored with the following changes:
- Replace identity comprehension with call to collection constructor (
identity-comprehension
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.filters_dialog
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
error = self._manager.set_proxy(proxy) | ||
if error: | ||
if error := self._manager.set_proxy(proxy): |
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 QMLDriveApi.set_proxy_settings
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
count = 0 | ||
engine = self._manager.engines.get(uid) | ||
if engine: | ||
count = engine.dao.get_syncing_count() | ||
return count | ||
return ( | ||
engine.dao.get_syncing_count() | ||
if (engine := self._manager.engines.get(uid)) | ||
else 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 QMLDriveApi.get_syncing_count
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Move setting of default value for variable into
else
branch (introduce-default-else
) - Replace if statement with if expression (
assign-if-exp
) - Inline variable that is immediately returned (
inline-immediately-returned-variable
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.resolve_with_local
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.resolve_with_remote
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.retry_pair
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.ignore_pair
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.open_remote
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
engine = self._manager.engines.get(uid) | ||
if engine: | ||
if engine := self._manager.engines.get(uid): |
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 QMLDriveApi.open_remote_document
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
Pull Request #4337 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-2861-Fix-behavior-when-not-entering-the-correct-URL-formatt
branch, then run:Help us improve this pull request!