typed-ffmpeg-compatible 2.5.0__py3-none-any.whl → 2.6.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,9 @@ from .nodes import FilterNode, InputNode
10
10
  from .schema import Node, Stream
11
11
 
12
12
 
13
- def remove_split(current_stream: Stream, mapping: dict[Stream, Stream] = None) -> tuple[Stream, dict[Stream, Stream]]:
13
+ def remove_split(
14
+ current_stream: Stream, mapping: dict[Stream, Stream] = None
15
+ ) -> tuple[Stream, dict[Stream, Stream]]:
14
16
  """
15
17
  Rebuild the graph with the given mapping.
16
18
 
@@ -37,20 +39,28 @@ def remove_split(current_stream: Stream, mapping: dict[Stream, Stream] = None) -
37
39
  if isinstance(current_stream.node, FilterNode):
38
40
  # if the current node is a split node, we need to remove it
39
41
  if current_stream.node.name in ("split", "asplit"):
40
- new_stream, _mapping = remove_split(current_stream=current_stream.node.inputs[0], mapping=mapping)
42
+ new_stream, _mapping = remove_split(
43
+ current_stream=current_stream.node.inputs[0], mapping=mapping
44
+ )
41
45
  mapping[current_stream] = mapping[current_stream.node.inputs[0]]
42
46
  return mapping[current_stream.node.inputs[0]], mapping
43
47
 
44
48
  inputs = {}
45
49
  for idx, input_stream in sorted(
46
- enumerate(current_stream.node.inputs), key=lambda idx_stream: -len(idx_stream[1].node.upstream_nodes)
50
+ enumerate(current_stream.node.inputs),
51
+ key=lambda idx_stream: -len(idx_stream[1].node.upstream_nodes),
47
52
  ):
48
- new_stream, _mapping = remove_split(current_stream=input_stream, mapping=mapping)
53
+ new_stream, _mapping = remove_split(
54
+ current_stream=input_stream, mapping=mapping
55
+ )
49
56
  inputs[idx] = new_stream
50
57
  mapping |= _mapping
51
58
 
52
59
  new_node = replace(
53
- current_stream.node, inputs=tuple(stream for idx, stream in sorted(inputs.items(), key=lambda x: x[0]))
60
+ current_stream.node,
61
+ inputs=tuple(
62
+ stream for idx, stream in sorted(inputs.items(), key=lambda x: x[0])
63
+ ),
54
64
  )
55
65
  new_stream = replace(current_stream, node=new_node)
56
66
 
@@ -91,16 +101,24 @@ def add_split(
91
101
  inputs = {}
92
102
 
93
103
  for idx, input_stream in sorted(
94
- enumerate(current_stream.node.inputs), key=lambda idx_stream: -len(idx_stream[1].node.upstream_nodes)
104
+ enumerate(current_stream.node.inputs),
105
+ key=lambda idx_stream: -len(idx_stream[1].node.upstream_nodes),
95
106
  ):
96
107
  new_stream, _mapping = add_split(
97
- current_stream=input_stream, down_node=current_stream.node, down_index=idx, mapping=mapping, context=context
108
+ current_stream=input_stream,
109
+ down_node=current_stream.node,
110
+ down_index=idx,
111
+ mapping=mapping,
112
+ context=context,
98
113
  )
99
114
  inputs[idx] = new_stream
100
115
  mapping |= _mapping
101
116
 
102
117
  new_node = replace(
103
- current_stream.node, inputs=tuple(stream for idx, stream in sorted(inputs.items(), key=lambda x: x[0]))
118
+ current_stream.node,
119
+ inputs=tuple(
120
+ stream for idx, stream in sorted(inputs.items(), key=lambda x: x[0])
121
+ ),
104
122
  )
105
123
  new_stream = replace(current_stream, node=new_node)
106
124
 
@@ -39,4 +39,4 @@ class FFMpegExecuteError(FFMpegError):
39
39
  self.cmd = cmd
40
40
  self.retcode = retcode
41
41
 
42
- super(FFMpegExecuteError, self).__init__(f"{cmd} error (see stderr output for detail) {stderr!r}")
42
+ super().__init__(f"{cmd} error (see stderr output for detail) {stderr!r}")