Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
fix: is not Noneを省略していた箇所を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
PigeonsHouse committed Dec 29, 2023
1 parent 78b4ae1 commit 68399ac
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/converter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def convert_video(

process = create_process(vsml_data.content, debug_mode)
style = vsml_data.content.style
if process.video:
if process.video is not None:
bg_process = get_background_process(
VSMLManager.get_root_resolution().get_str()
)
Expand Down
6 changes: 5 additions & 1 deletion src/converter/style_to_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
def get_background_color_code(
background_color: Optional[Color],
) -> str:
return background_color.value if background_color else "0x00000000"
return (
background_color.value
if background_color is not None
else "0x00000000"
)


def width_height_filter(
Expand Down
6 changes: 3 additions & 3 deletions src/converter/wrap/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create_parallel_process(
child_process.video,
child_process.audio,
)
if child_process.video:
if child_process.video is not None:
match style.layer_mode:
case LayerMode.SINGLE:
max_margin = max(
Expand All @@ -85,11 +85,11 @@ def create_parallel_process(
)
case _:
raise Exception()
if child_process.audio:
if child_process.audio is not None:
audio_process = audio_merge_filter(
audio_process, child_process.audio
)
if audio_process:
if audio_process is not None:
audio_process = adjust_parallel_audio(
style.object_length, audio_process
)
Expand Down
4 changes: 2 additions & 2 deletions src/converter/wrap/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ def create_sequence_process(
break

# 余った時間マージンを追加する
if video_process:
if video_process is not None:
video_remain_time_margin = video_time_margin + previous_time_margin
if video_remain_time_margin.is_zero_over():
video_process, _ = time_space_end_filter(
video_remain_time_margin,
background_color_code,
video_process=video_process,
)
if audio_process:
if audio_process is not None:
audio_remain_time_margin = audio_time_margin + previous_time_margin
if audio_remain_time_margin.is_zero_over():
_, audio_process = time_space_end_filter(
Expand Down
12 changes: 9 additions & 3 deletions src/style/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,14 @@ def __repr__(self) -> str:
return str(vars(self))

def get_size_with_padding(self) -> tuple[GraphicValue, GraphicValue]:
width = self.source_width if self.source_width else self.width
height = self.source_height if self.source_height else self.height
width = (
self.source_width if self.source_width is not None else self.width
)
height = (
self.source_height
if self.source_height is not None
else self.height
)
width_with_padding = width + self.padding_left + self.padding_right
height_with_padding = height + self.padding_top + self.padding_bottom
return width_with_padding, height_with_padding
Expand All @@ -457,7 +463,7 @@ def get_object_length_with_padding(self) -> TimeValue:
object_length = (
self.source_object_length
if (
self.source_object_length
self.source_object_length is not None
and self.object_length.unit != TimeUnit.FIT
)
else self.object_length
Expand Down
6 changes: 3 additions & 3 deletions src/vsml.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,18 @@ def element_to_content(
child_style = child_content.style
child_source_object_length = (
child_style.source_object_length.value
if child_style.source_object_length
if child_style.source_object_length is not None
and child_style.object_length.unit != TimeUnit.FIT
else 0.0
)
child_source_width = (
child_style.source_width.value
if child_style.source_width
if child_style.source_width is not None
else 0
)
child_source_height = (
child_style.source_height.value
if child_style.source_height
if child_style.source_height is not None
else 0
)

Expand Down
2 changes: 1 addition & 1 deletion src/vss.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def convert_vss_dict(

def convert_prop_val_to_dict(prop_val_str: str) -> dict[str, str]:
prop_val_pattern = re.compile(PROP_VAL_PATTERN, flags=re.S)
if prop_val_pattern.fullmatch(prop_val_str):
if prop_val_pattern.fullmatch(prop_val_str) is not None:
prop_text = prop_val_str.strip()
if len(prop_text) > 0:
prop, value = [s.strip() for s in prop_text.split(":", 1)]
Expand Down

0 comments on commit 68399ac

Please sign in to comment.