Cleanup: prefer parenthesis over line continuations in Python scripts

This commit is contained in:
Campbell Barton
2025-01-21 23:30:55 +11:00
parent 70f44c6204
commit abd933d6b0
4 changed files with 26 additions and 14 deletions

View File

@@ -244,9 +244,11 @@ _str_whole_re = (
# End of loop.
"))*"
)
_ctxt_re_gen = lambda uid : r"(?P<ctxt_raw{uid}>(?:".format(uid=uid) + \
_str_whole_re.format(_="_ctxt{uid}".format(uid=uid)) + \
r")|(?:[A-Z_0-9]+))"
_ctxt_re_gen = lambda uid: (
r"(?P<ctxt_raw{uid}>(?:".format(uid=uid) +
_str_whole_re.format(_="_ctxt{uid}".format(uid=uid)) +
r")|(?:[A-Z_0-9]+))"
)
_ctxt_re = _ctxt_re_gen("")
_msg_re = r"(?P<msg_raw>" + _str_whole_re.format(_="_msg") + r")"
PYGETTEXT_KEYWORDS = (() +

View File

@@ -577,10 +577,13 @@ class SEQUENCER_MT_select(Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
has_sequencer, has_preview = _space_view_types(st)
is_retiming = context.scene.sequence_editor is not None and \
is_retiming = (
context.scene.sequence_editor is not None and
context.scene.sequence_editor.selected_retiming_keys
)
layout.operator("sequencer.select_all", text="All").action = 'SELECT'
layout.operator("sequencer.select_all", text="None").action = 'DESELECT'
@@ -1009,11 +1012,14 @@ class SEQUENCER_MT_strip_retiming(Menu):
bl_label = "Retiming"
def draw(self, context):
is_retiming = context.scene.sequence_editor is not None and \
context.scene.sequence_editor.selected_retiming_keys
strip = context.active_strip
layout = self.layout
is_retiming = (
context.scene.sequence_editor is not None and
context.scene.sequence_editor.selected_retiming_keys
)
strip = context.active_strip
layout.operator("sequencer.retiming_key_add")
layout.operator("sequencer.retiming_add_freeze_frame_slide")
col = layout.column()

View File

@@ -93,10 +93,12 @@ class TestQueue:
def find(self, revision: str, test: str, category: str, device_id: str) -> dict:
for entry in self.entries:
if entry.revision == revision and \
entry.test == test and \
entry.category == category and \
entry.device_id == device_id:
if (
entry.revision == revision and
entry.test == test and
entry.category == category and
entry.device_id == device_id
):
return entry
return None

View File

@@ -65,9 +65,11 @@ def main() -> int:
rebase_merge = get_string(['git', 'rev-parse', '--git-path', 'rebase-merge'])
rebase_apply = get_string(['git', 'rev-parse', '--git-path', 'rebase-apply'])
merge_head = get_string(['git', 'rev-parse', '--git-path', 'MERGE_HEAD'])
if os.path.exists(rebase_merge) or \
os.path.exists(rebase_apply) or \
os.path.exists(merge_head):
if (
os.path.exists(rebase_merge) or
os.path.exists(rebase_apply) or
os.path.exists(merge_head)
):
print("BLENDER MERGE: rebase or merge in progress, complete it first")
return 1