From 4640adabe0df764d22bfeaceb663f8327d2de9f1 Mon Sep 17 00:00:00 2001 From: Karl Kroening Date: Wed, 12 Jul 2017 02:10:44 -0600 Subject: [PATCH] Futurize --- ffmpeg/_run.py | 2 +- ffmpeg/nodes.py | 4 ++-- ffmpeg/tests/test_ffmpeg.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ffmpeg/_run.py b/ffmpeg/_run.py index 8e4af83..91a1462 100644 --- a/ffmpeg/_run.py +++ b/ffmpeg/_run.py @@ -67,7 +67,7 @@ def _allocate_filter_stream_names(filter_nodes, outgoing_edge_maps, stream_name_ stream_count = 0 for upstream_node in filter_nodes: outgoing_edge_map = outgoing_edge_maps[upstream_node] - for upstream_label, downstreams in outgoing_edge_map.items(): + for upstream_label, downstreams in list(outgoing_edge_map.items()): if len(downstreams) > 1: # TODO: automatically insert `splits` ahead of time via graph transformation. raise ValueError('Encountered {} with multiple outgoing edges with same upstream label {!r}; a ' diff --git a/ffmpeg/nodes.py b/ffmpeg/nodes.py index 5122ad0..2b4c94f 100644 --- a/ffmpeg/nodes.py +++ b/ffmpeg/nodes.py @@ -54,7 +54,7 @@ def get_stream_map(stream_spec): def get_stream_map_nodes(stream_map): nodes = [] - for stream in stream_map.values(): + for stream in list(stream_map.values()): if not isinstance(stream, Stream): raise TypeError('Expected Stream; got {}'.format(type(stream))) nodes.append(stream.node) @@ -157,7 +157,7 @@ class FilterNode(Node): out_args = [escape_chars(x, '\\\'=:') for x in args] out_kwargs = {} - for k, v in kwargs.items(): + for k, v in list(kwargs.items()): k = escape_chars(k, '\\\'=:') v = escape_chars(v, '\\\'=:') out_kwargs[k] = v diff --git a/ffmpeg/tests/test_ffmpeg.py b/ffmpeg/tests/test_ffmpeg.py index 11734cb..de4f2af 100644 --- a/ffmpeg/tests/test_ffmpeg.py +++ b/ffmpeg/tests/test_ffmpeg.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals +from builtins import bytes +from builtins import range import ffmpeg import os import pytest @@ -171,7 +173,7 @@ def test_filter_normal_arg_escape(): '=': 2, '\n': 0, } - for ch, expected_backslash_count in expected_backslash_counts.items(): + for ch, expected_backslash_count in list(expected_backslash_counts.items()): expected = '{}{}'.format('\\' * expected_backslash_count, ch) actual = _get_drawtext_font_repr(ch) assert expected == actual @@ -205,7 +207,7 @@ def test_filter_text_arg_str_escape(): '=': 2, '\n': 0, } - for ch, expected_backslash_count in expected_backslash_counts.items(): + for ch, expected_backslash_count in list(expected_backslash_counts.items()): expected = '{}{}'.format('\\' * expected_backslash_count, ch) actual = _get_drawtext_text_repr(ch) assert expected == actual