#17: fix python 3 support

This commit is contained in:
Karl Kroening 2017-07-06 02:50:22 -06:00
parent b548092d48
commit 662c56eb5b
6 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,8 @@
from __future__ import unicode_literals
from . import _filters, _ffmpeg, _run
from ._filters import *
from ._ffmpeg import *
from ._run import *
__all__ = _filters.__all__ + _ffmpeg.__all__ + _run.__all__

View File

@ -1,4 +1,5 @@
from __future__ import unicode_literals
from .nodes import (
filter_operator,
GlobalNode,

View File

@ -1,4 +1,5 @@
from __future__ import unicode_literals
from .nodes import (
FilterNode,
filter_operator,

View File

@ -1,4 +1,8 @@
import hashlib
from __future__ import unicode_literals
from builtins import str
from past.builtins import basestring
import hashlib
def _recursive_repr(item):

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from ._utils import get_hash, get_hash_int
from builtins import object
from collections import namedtuple
@ -72,14 +74,14 @@ DagEdge = namedtuple('DagEdge', ['downstream_node', 'downstream_label', 'upstrea
def get_incoming_edges(downstream_node, incoming_edge_map):
edges = []
for downstream_label, (upstream_node, upstream_label) in incoming_edge_map.items():
for downstream_label, (upstream_node, upstream_label) in list(incoming_edge_map.items()):
edges += [DagEdge(downstream_node, downstream_label, upstream_node, upstream_label)]
return edges
def get_outgoing_edges(upstream_node, outgoing_edge_map):
edges = []
for upstream_label, downstream_infos in outgoing_edge_map.items():
for upstream_label, downstream_infos in list(outgoing_edge_map.items()):
for (downstream_node, downstream_label) in downstream_infos:
edges += [DagEdge(downstream_node, downstream_label, upstream_node, upstream_label)]
return edges
@ -91,7 +93,7 @@ class KwargReprNode(DagNode):
@property
def __upstream_hashes(self):
hashes = []
for downstream_label, (upstream_node, upstream_label) in self.incoming_edge_map.items():
for downstream_label, (upstream_node, upstream_label) in list(self.incoming_edge_map.items()):
hashes += [hash(x) for x in [downstream_label, upstream_node, upstream_label]]
return hashes

View File

@ -1,5 +1,6 @@
from __future__ import unicode_literals
from builtins import object
from .dag import KwargReprNode
from ._utils import get_hash_int
@ -49,7 +50,7 @@ class Node(KwargReprNode):
@classmethod
def __check_input_types(cls, stream_map, incoming_stream_types):
for stream in stream_map.values():
for stream in list(stream_map.values()):
if not _is_of_types(stream, incoming_stream_types):
raise TypeError('Expected incoming stream(s) to be of one of the following types: {}; got {}'
.format(_get_types_str(incoming_stream_types), type(stream)))
@ -69,7 +70,7 @@ class Node(KwargReprNode):
@classmethod
def __get_incoming_edge_map(cls, stream_map):
incoming_edge_map = {}
for downstream_label, upstream in stream_map.items():
for downstream_label, upstream in list(stream_map.items()):
incoming_edge_map[downstream_label] = (upstream.node, upstream.label)
return incoming_edge_map