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

2711-Testcase-fix (Sourcery refactored) #4299

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Nov 6, 2023

Pull Request #4298 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-Testcase-fix-2711 branch, then run:

git fetch origin sourcery/wip-NXDRIVE-Testcase-fix-2711
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 November 6, 2023 09:33
@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.

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

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

Comparison is base (e639547) 47.79% compared to head (0c8e0fa) 47.77%.

Additional details and impacted files
@@                        Coverage Diff                        @@
##           wip-NXDRIVE-Testcase-fix-2711    #4299      +/-   ##
=================================================================
- Coverage                          47.79%   47.77%   -0.02%     
=================================================================
  Files                                 94       94              
  Lines                              15678    15673       -5     
=================================================================
- Hits                                7493     7488       -5     
  Misses                              8185     8185              
Flag Coverage Δ
functional 36.73% <28.57%> (-0.01%) ⬇️
integration 2.06% <0.00%> (+<0.01%) ⬆️
unit 37.42% <0.00%> (+0.01%) ⬆️

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

Files Coverage Δ
nxdrive/updater/base.py 76.72% <28.57%> (+0.77%) ⬆️

... and 4 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-Testcase-fix-2711 branch from 0e5376e to f1185b4 Compare November 8, 2023 09:57
@sourcery-ai sourcery-ai bot force-pushed the sourcery/wip-NXDRIVE-Testcase-fix-2711 branch from f1185b4 to 0c8e0fa Compare November 8, 2023 10:04
Comment on lines -127 to +134
for engine in self.manager.engines.copy().values():
if engine.remote:
return engine.remote.client.server_version # type: ignore
return None
return next(
(
engine.remote.client.server_version
for engine in self.manager.engines.copy().values()
if engine.remote
),
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 BaseUpdater.server_ver refactored with the following changes:

  • Use the built-in function next instead of a for-loop (use-next)

This removes the following comments ( why? ):

# type: ignore

Comment on lines -160 to +167
if exc.errno in NO_SPACE_ERRORS:
log.warning("Update failed, disk space needed", exc_info=True)
self.noSpaceLeftOnDevice.emit()
else:
if exc.errno not in NO_SPACE_ERRORS:
raise
log.warning("Update failed, disk space needed", exc_info=True)
self.noSpaceLeftOnDevice.emit()
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 BaseUpdater.update refactored with the following changes:

Comment on lines -182 to +185
path = os.path.join(gettempdir(), uuid.uuid4().hex + "_" + name)
path = os.path.join(gettempdir(), f"{uuid.uuid4().hex}_{name}")
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 BaseUpdater._download refactored with the following changes:

Comment on lines -302 to +311
versions = {
if versions := {
version: info
for version, info in self.versions.items()
if info.get("type", "").lower()
in (self.manager.get_update_channel(), "release")
and version_lt(version, "4")
}
if versions:
}:
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 BaseUpdater.force_downgrade refactored with the following changes:

Comment on lines -366 to +368
info = self.versions.get(version)
if info:
if info := self.versions.get(version):
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 BaseUpdater.get_version_channel refactored with the following changes:

@sourcery-ai sourcery-ai bot closed this Nov 17, 2023
@sourcery-ai sourcery-ai bot deleted the sourcery/wip-NXDRIVE-Testcase-fix-2711 branch November 17, 2023 11:20
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.

1 participant