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-2767: Clean up systray menu (Sourcery refactored) #3974

Closed

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented May 24, 2023

Pull Request #3973 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-2767-Clean-up-systray-menu branch, then run:

git fetch origin sourcery/wip-NXDRIVE-2767-Clean-up-systray-menu
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from gitofanindya May 24, 2023 05:45
@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 May 24, 2023

Codecov Report

Patch coverage: 23.07% and project coverage change: +0.04 🎉

Comparison is base (0dc5b66) 46.91% compared to head (032b7c4) 46.96%.

Additional details and impacted files
@@                            Coverage Diff                             @@
##           wip-NXDRIVE-2767-Clean-up-systray-menu    #3974      +/-   ##
==========================================================================
+ Coverage                                   46.91%   46.96%   +0.04%     
==========================================================================
  Files                                          93       93              
  Lines                                       15642    15630      -12     
==========================================================================
+ Hits                                         7339     7341       +2     
+ Misses                                       8303     8289      -14     
Flag Coverage Δ
functional 37.67% <23.07%> (+0.02%) ⬆️
integration 1.99% <7.69%> (?)
unit 35.59% <23.07%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
nxdrive/gui/view.py 37.03% <0.00%> (+0.80%) ⬆️
nxdrive/options.py 99.51% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2767-Clean-up-systray-menu branch from ac70c63 to ba1e7d2 Compare May 24, 2023 07:12
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2767-Clean-up-systray-menu branch from ba1e7d2 to 91b31f9 Compare May 25, 2023 06:06
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2767-Clean-up-systray-menu branch from 91b31f9 to d5567dd Compare June 6, 2023 03:20
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-2767-Clean-up-systray-menu branch from d5567dd to 032b7c4 Compare June 6, 2023 03:40
if value in ("unsync", "delete_server"):
if value in {"unsync", "delete_server"}:
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 _validate_deletion_behavior refactored with the following changes:

return int(value)
return value
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 validate_sync_root_max_level_limits refactored with the following changes:

for feature in vars(Feature).keys():
for feature in vars(Feature):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lines 642-642 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 -492 to +497
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-2767-Clean-up-systray-menu to master June 6, 2023 07:26
@sourcery-ai sourcery-ai bot closed this Jun 6, 2023
@sourcery-ai sourcery-ai bot deleted the sourcery/wip-NXDRIVE-2767-Clean-up-systray-menu branch June 6, 2023 07:26
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.

None yet

2 participants