mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-06 04:15:44 +08:00
#17: fix python 3 support
This commit is contained in:
parent
b548092d48
commit
662c56eb5b
@ -1,6 +1,8 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from . import _filters, _ffmpeg, _run
|
from . import _filters, _ffmpeg, _run
|
||||||
from ._filters import *
|
from ._filters import *
|
||||||
from ._ffmpeg import *
|
from ._ffmpeg import *
|
||||||
from ._run import *
|
from ._run import *
|
||||||
|
|
||||||
__all__ = _filters.__all__ + _ffmpeg.__all__ + _run.__all__
|
__all__ = _filters.__all__ + _ffmpeg.__all__ + _run.__all__
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .nodes import (
|
from .nodes import (
|
||||||
filter_operator,
|
filter_operator,
|
||||||
GlobalNode,
|
GlobalNode,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .nodes import (
|
from .nodes import (
|
||||||
FilterNode,
|
FilterNode,
|
||||||
filter_operator,
|
filter_operator,
|
||||||
|
@ -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):
|
def _recursive_repr(item):
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from ._utils import get_hash, get_hash_int
|
from ._utils import get_hash, get_hash_int
|
||||||
from builtins import object
|
from builtins import object
|
||||||
from collections import namedtuple
|
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):
|
def get_incoming_edges(downstream_node, incoming_edge_map):
|
||||||
edges = []
|
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)]
|
edges += [DagEdge(downstream_node, downstream_label, upstream_node, upstream_label)]
|
||||||
return edges
|
return edges
|
||||||
|
|
||||||
|
|
||||||
def get_outgoing_edges(upstream_node, outgoing_edge_map):
|
def get_outgoing_edges(upstream_node, outgoing_edge_map):
|
||||||
edges = []
|
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:
|
for (downstream_node, downstream_label) in downstream_infos:
|
||||||
edges += [DagEdge(downstream_node, downstream_label, upstream_node, upstream_label)]
|
edges += [DagEdge(downstream_node, downstream_label, upstream_node, upstream_label)]
|
||||||
return edges
|
return edges
|
||||||
@ -91,7 +93,7 @@ class KwargReprNode(DagNode):
|
|||||||
@property
|
@property
|
||||||
def __upstream_hashes(self):
|
def __upstream_hashes(self):
|
||||||
hashes = []
|
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]]
|
hashes += [hash(x) for x in [downstream_label, upstream_node, upstream_label]]
|
||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
from .dag import KwargReprNode
|
from .dag import KwargReprNode
|
||||||
from ._utils import get_hash_int
|
from ._utils import get_hash_int
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ class Node(KwargReprNode):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __check_input_types(cls, stream_map, incoming_stream_types):
|
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):
|
if not _is_of_types(stream, incoming_stream_types):
|
||||||
raise TypeError('Expected incoming stream(s) to be of one of the following types: {}; got {}'
|
raise TypeError('Expected incoming stream(s) to be of one of the following types: {}; got {}'
|
||||||
.format(_get_types_str(incoming_stream_types), type(stream)))
|
.format(_get_types_str(incoming_stream_types), type(stream)))
|
||||||
@ -69,7 +70,7 @@ class Node(KwargReprNode):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def __get_incoming_edge_map(cls, stream_map):
|
def __get_incoming_edge_map(cls, stream_map):
|
||||||
incoming_edge_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)
|
incoming_edge_map[downstream_label] = (upstream.node, upstream.label)
|
||||||
return incoming_edge_map
|
return incoming_edge_map
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user