8000 Merge remote-tracking branch 'origin/master' · Meshinfo/ffmpeg-python@a986cbe · GitHub
[go: up one dir, main page]

Skip to content

Commit a986cbe

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents dcebe91 + 89f9153 commit a986cbe

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

ffmpeg/_ffmpeg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def input(filename, **kwargs):
1616
kwargs['filename'] = filename
1717
fmt = kwargs.pop('f', None)
1818
if fmt:
19-
assert 'format' not in kwargs, "Can't specify both `format` and `f` kwargs"
19+
if 'format' in kwargs:
20+
raise ValueError("Can't specify both `format` and `f` kwargs")
2021
kwargs['format'] = fmt
2122
return InputNode(input.__name__, **kwargs)
2223

@@ -46,7 +47,8 @@ def output(parent_node, filename, **kwargs):
4647
kwargs['filename'] = filename
4748
fmt = kwargs.pop('f', None)
4849
if fmt:
49-
assert 'format' not in kwargs, "Can't specify both `format` and `f` kwargs"
50+
if 'format' in kwargs:
51+
raise ValueError("Can't specify both `format` and `f` kwargs")
5052
kwargs['format'] = fmt
5153
return OutputNode([parent_node], output.__name__, **kwargs)
5254

ffmpeg/_run.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _get_input_args(input_node):
4747
args += _convert_kwargs_to_cmd_line_args(kwargs)
4848
args += ['-i', filename]
4949
else:
50-
assert False, 'Unsupported input node: {}'.format(input_node)
50+
raise ValueError('Unsupported input node: {}'.format(input_node))
5151
return args
5252

5353

@@ -56,7 +56,8 @@ def _topo_sort(start_node):
5656
sorted_nodes = []
5757
child_map = {}
5858
def visit(node, child):
59-
assert node not in marked_nodes, 'Graph is not a DAG'
59+
if node in marked_nodes:
60+
raise RuntimeError('Graph is not a DAG')
6061
if child is not None:
6162
if node not in child_map:
6263
child_map[node] = []
@@ -89,7 +90,7 @@ def _get_global_args(node):
8990
if node._name == overwrite_output.__name__:
9091
return ['-y']
9192
else:
92-
assert False, 'Unsupported global node: {}'.format(node)
93+
raise ValueError('Unsupported global node: {}'.format(node))
9394

9495

9596
def _get_output_args(node, stream_name_map):
@@ -107,7 +108,7 @@ def _get_output_args(node, stream_name_map):
107108
args += _convert_kwargs_to_cmd_line_args(kwargs)
108109
args += [filename]
109110
else:
110-
assert False, 'Unsupported output node: {}'.format(node)
111+
raise ValueError('Unsupported output node: {}'.format(node))
111112
return args
112113

113114

ffmpeg/nodes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class Node(object):
99
"""Node base"""
1010
def __init__(self, parents, name, *args, **kwargs):
1111
parent_hashes = [hash(parent) for parent in parents]
12-
assert len(parent_hashes) == len(set(parent_hashes)), 'Same node cannot be included as parent multiple times'
12+
if len(parent_hashes) != len(set(parent_hashes)):
13+
raise ValueError('Same node cannot be included as parent multiple times')
1314
self._parents = parents
1415
self._hash = None
1516
self._name = name
@@ -65,7 +66,8 @@ class OutputNode(Node):
6566

6667
class GlobalNode(Node):
6768
def __init__(self, parent, name, *args, **kwargs):
68-
assert isinstance(parent, OutputNode), 'Global nodes can only be attached after output nodes'
69+
if not isinstance(parent, OutputNode):
70+
raise RuntimeError('Global nodes can only be attached after output nodes')
6971
super(GlobalNode, self).__init__([parent], name, *args, **kwargs)
7072

7173

0 commit comments

Comments
 (0)
0