forked from tolgaozuygur/nightvision
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored main branch #1
Open
sourcery-ai
wants to merge
1
commit into
main
Choose a base branch
from
sourcery/main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comment on lines
-21
to
+22
fps_text = font.render(str(CAM_FPS_LIST[cam_fps_id]) + "fps", True, green, black) | ||
fps_text = font.render(f"{str(CAM_FPS_LIST[cam_fps_id])}fps", True, | ||
green, black) |
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 updateFpsText
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
Comment on lines
-74
to
+96
else: | ||
if (time.time() - funcButtonDownStartTime) >= POWER_DOWN_BUTTON_DUR: | ||
os.system("sudo shutdown now -h") | ||
else: | ||
if funcButtonDownStartTime != 0: | ||
#disable connections | ||
splitter.connection.disable() | ||
render_l.connection.disable() | ||
render_r.connection.disable() | ||
#change fps | ||
cam_fps_id += 1 | ||
if cam_fps_id >= len(CAM_FPS_LIST): | ||
cam_fps_id = 0 | ||
print(CAM_FPS_LIST[cam_fps_id]) | ||
updateFpsText() | ||
camera.outputs[0].framerate = CAM_FPS_LIST[cam_fps_id] | ||
camera.outputs[0].commit() | ||
#enable connections | ||
splitter.connection.enable() | ||
render_l.connection.enable() | ||
render_r.connection.enable() | ||
### | ||
print("Func button pressed") | ||
funcButtonDownStartTime = 0 | ||
elif (time.time() - funcButtonDownStartTime) >= POWER_DOWN_BUTTON_DUR: | ||
os.system("sudo shutdown now -h") | ||
elif funcButtonDownStartTime != 0: | ||
#disable connections | ||
splitter.connection.disable() | ||
render_l.connection.disable() | ||
render_r.connection.disable() | ||
#change fps | ||
cam_fps_id += 1 | ||
if cam_fps_id >= len(CAM_FPS_LIST): | ||
cam_fps_id = 0 | ||
print(CAM_FPS_LIST[cam_fps_id]) | ||
updateFpsText() | ||
camera.outputs[0].framerate = CAM_FPS_LIST[cam_fps_id] | ||
camera.outputs[0].commit() | ||
#enable connections | ||
splitter.connection.enable() | ||
render_l.connection.enable() | ||
render_r.connection.enable() | ||
### | ||
print("Func button pressed") | ||
funcButtonDownStartTime = 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.
Lines 74-97
refactored with the following changes:
- Merge else clause's nested if statement into elif [×2] (
merge-else-if-into-elif
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
0 participants
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Branch
main
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
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
main
branch, then run:Help us improve this pull request!