Cleanup: use static sets for contains checks, remove f-string use

This commit is contained in:
Campbell Barton 2024-02-28 11:02:49 +11:00
parent f04bd961fd
commit 4f8db2ee67
6 changed files with 8 additions and 8 deletions

View File

@ -101,10 +101,10 @@ def get_effective_architecture(args: argparse.Namespace) -> str:
architecture = platform.machine().lower()
# Normalize the architecture name.
if architecture in ("x86_64", "amd64"):
if architecture in {"x86_64", "amd64"}:
architecture = "x64"
assert (architecture in ("x64", "arm64"))
assert (architecture in {"x64", "arm64"})
return architecture

View File

@ -593,7 +593,7 @@ class BONE_PT_custom_props(BoneButtonsPanel, rna_prop_ui.PropertyPanel, Panel):
return "active_pose_bone"
bone_path = obj.pose.bones[context.bone.name].path_from_id()
return f"object.{bone_path}"
return "object." + bone_path
classes = (

View File

@ -1086,7 +1086,7 @@ class NODE_PT_repeat_zone_items(Panel):
if snode is None:
return False
node = context.active_node
if node is None or node.bl_idname not in (cls.input_node_type, cls.output_node_type):
if node is None or node.bl_idname not in {cls.input_node_type, cls.output_node_type}:
return False
if cls.get_output_node(context) is None:
return False

View File

@ -72,7 +72,7 @@ def print_row(config: api.TestConfig, entries: List, end='\n') -> None:
status = entry.status
output = entry.output
result = ''
if status in ('done', 'outdated') and output:
if status in {'done', 'outdated'} and output:
result = '%.4fs' % output['time']
if status == 'outdated':
@ -106,7 +106,7 @@ def run_entry(env: api.TestEnvironment,
failed = False
# Check if entry needs to be run.
if update_only and entry.status not in ('queued', 'outdated'):
if update_only and entry.status not in {'queued', 'outdated'}:
print_row(config, row, end='\r')
return updated, failed

View File

@ -144,7 +144,7 @@ def main():
# underwater_caustics.blend gives quite different results on Linux and Intel macOS compared to
# Windows and Arm macOS.
test_dir_name = Path(test_dir).name
if test_dir_name in ('motion_blur', 'integrator', ):
if test_dir_name in {'motion_blur', 'integrator'}:
report.set_fail_threshold(0.032)
ok = report.run(test_dir, blender, get_arguments, batch=args.batch)

View File

@ -116,7 +116,7 @@ def gitea_json_issues_search(
query_params["type"] if "type" in query_params else "issues and pulls"))
print("Query params:", {
k: v for k, v in query_params.items() if k not in ("type", "access_token")})
k: v for k, v in query_params.items() if k not in {"type", "access_token"}})
base_url = f"{BASE_API_URL}/repos/issues/search"
encoded_query_params = urllib.parse.urlencode(query_params)