-
Notifications
You must be signed in to change notification settings - Fork 2
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 master branch #1
base: master
Are you sure you want to change the base?
Conversation
if has_frame: | ||
return frame | ||
return None | ||
return frame if has_frame else 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 get_video_frame
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
)
print('[' + scope + '] ' + message) | ||
print(f'[{scope}] {message}') |
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 update_status
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
# process frame | ||
temp_frame_paths = get_temp_frame_paths(facefusion.globals.target_path) | ||
if temp_frame_paths: | ||
if temp_frame_paths := get_temp_frame_paths(facefusion.globals.target_path): |
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 process_video
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
This removes the following comments ( why? ):
# process frame
many_faces = get_many_faces(frame) | ||
if many_faces: | ||
if many_faces := get_many_faces(frame): |
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 get_one_face
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
commands = [ 'ffmpeg', '-hide_banner', '-loglevel', 'error' ] | ||
commands.extend(args) | ||
commands = ['ffmpeg', '-hide_banner', '-loglevel', 'error', *args] |
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 run_ffmpeg
refactored with the following changes:
- Merge extend into list declaration (
merge-list-extend
)
ui_layout_module = importlib.import_module('facefusion.uis.layouts.' + ui_layout) | ||
ui_layout_module = importlib.import_module( | ||
f'facefusion.uis.layouts.{ui_layout}' | ||
) |
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 load_ui_layout_module
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
if name in COMPONENTS: | ||
return COMPONENTS[name] | ||
return None | ||
return COMPONENTS[name] if name in COMPONENTS else 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 get_component
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
)
component = ui.get_component(component_name) | ||
if component: | ||
if component := ui.get_component(component_name): |
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 listen
refactored with the following changes:
- Use named expression to simplify assignment and conditional [×2] (
use-named-expression
)
component = ui.get_component(component_name) | ||
if component: | ||
if component := ui.get_component(component_name): |
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 listen
refactored with the following changes:
- Use named expression to simplify assignment and conditional [×2] (
use-named-expression
)
target_file = ui.get_component('target_file') | ||
if target_file: | ||
if target_file := ui.get_component('target_file'): |
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 listen
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
Branch
master
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
master
branch, then run:Help us improve this pull request!