From 4c5f55bd51e846efab7ead4753e682f66b0c5164 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Sat, 11 Jan 2025 13:20:20 -0500 Subject: [PATCH] Format with ruff --- auto_editor/formats/fcp11.py | 6 +++--- auto_editor/formats/fcp7.py | 8 ++++---- auto_editor/render/audio.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/auto_editor/formats/fcp11.py b/auto_editor/formats/fcp11.py index 65be267a1..196b6da68 100644 --- a/auto_editor/formats/fcp11.py +++ b/auto_editor/formats/fcp11.py @@ -80,7 +80,7 @@ def fraction(val: int) -> str: SubElement( resources, "format", - id=f"r{i*2+1}", + id=f"r{i * 2 + 1}", name=make_name(one_src, tl.tb), frameDuration=fraction(1), width=f"{tl.res[0]}", @@ -90,11 +90,11 @@ def fraction(val: int) -> str: r2 = SubElement( resources, "asset", - id=f"r{i*2+2}", + id=f"r{i * 2 + 2}", name=one_src.path.stem, start="0s", hasVideo="1" if one_src.videos else "0", - format=f"r{i*2+1}", + format=f"r{i * 2 + 1}", hasAudio="1" if one_src.audios else "0", audioSources="1", audioChannels=f"{2 if not one_src.audios else one_src.audios[0].channels}", diff --git a/auto_editor/formats/fcp7.py b/auto_editor/formats/fcp7.py index fe6d2c9d2..41c397899 100644 --- a/auto_editor/formats/fcp7.py +++ b/auto_editor/formats/fcp7.py @@ -495,7 +495,7 @@ def fcp7_write_xml(name: str, output: str, resolve: bool, tl: v3) -> None: file_defs: set[str] = set() # Contains urls for src in set(tl.sources): - the_id = f"file-{len(src_to_id)+1}" + the_id = f"file-{len(src_to_id) + 1}" src_to_url[src] = f"{src.path.resolve()}" src_to_id[src] = the_id @@ -541,7 +541,7 @@ def make_filedef(clipitem: Element, src: FileInfo) -> None: _in = f"{clip.offset}" _out = f"{clip.offset + clip.dur}" - this_clipid = f"clipitem-{j+1}" + this_clipid = f"clipitem-{j + 1}" clipitem = ET.SubElement(track, "clipitem", id=this_clipid) ET.SubElement(clipitem, "name").text = src.path.stem ET.SubElement(clipitem, "enabled").text = "TRUE" @@ -562,14 +562,14 @@ def make_filedef(clipitem: Element, src: FileInfo) -> None: link = ET.SubElement(clipitem, "link") ET.SubElement( link, "linkclipref" - ).text = f"clipitem-{(len(tl.v[0]))+j+1}" + ).text = f"clipitem-{(len(tl.v[0])) + j + 1}" continue for i in range(1 + len(src.audios) * 2): # `2` because stereo. link = ET.SubElement(clipitem, "link") ET.SubElement( link, "linkclipref" - ).text = f"clipitem-{(i*(len(tl.v[0])))+j+1}" + ).text = f"clipitem-{(i * (len(tl.v[0]))) + j + 1}" ET.SubElement(link, "mediatype").text = "video" if i == 0 else "audio" ET.SubElement(link, "trackindex").text = f"{max(i, 1)}" ET.SubElement(link, "clipindex").text = f"{j + 1}" diff --git a/auto_editor/render/audio.py b/auto_editor/render/audio.py index 5643de91a..0f63c3dff 100644 --- a/auto_editor/render/audio.py +++ b/auto_editor/render/audio.py @@ -91,7 +91,7 @@ def apply_audio_normalization( ) -> None: if norm["tag"] == "ebu": first_pass = ( - f"i={norm['i']}:lra={norm['lra']}:tp={norm['tp']}:" f"offset={norm['gain']}" + f"i={norm['i']}:lra={norm['lra']}:tp={norm['tp']}:offset={norm['gain']}" ) log.debug(f"audio norm first pass: {first_pass}") with av.open(f"{pre_master}") as container: @@ -167,10 +167,10 @@ def process_audio_clip( if clip.speed != 1: if clip.speed > 10_000: for _ in range(3): - args.append(graph.add("atempo", f"{clip.speed ** (1/3)}")) + args.append(graph.add("atempo", f"{clip.speed ** (1 / 3)}")) elif clip.speed > 100: for _ in range(2): - args.append(graph.add("atempo", f"{clip.speed ** 0.5}")) + args.append(graph.add("atempo", f"{clip.speed**0.5}")) elif clip.speed >= 0.5: args.append(graph.add("atempo", f"{clip.speed}")) else: