mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-08-10 13:10:03 +08:00
Import ABC from collections.abc instead of collections for Python 3.9 compatibility.
This commit is contained in:
parent
4cb7d26f55
commit
212146fece
@ -3,7 +3,6 @@ from .dag import get_outgoing_edges, topo_sort
|
|||||||
from ._utils import basestring, convert_kwargs_to_cmd_line_args
|
from ._utils import basestring, convert_kwargs_to_cmd_line_args
|
||||||
from builtins import str
|
from builtins import str
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
import collections
|
|
||||||
import copy
|
import copy
|
||||||
import operator
|
import operator
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -18,6 +17,10 @@ from .nodes import (
|
|||||||
output_operator,
|
output_operator,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from collections.abc import Iterable
|
||||||
|
except ImportError:
|
||||||
|
from collections import Iterable
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
def __init__(self, cmd, stdout, stderr):
|
def __init__(self, cmd, stdout, stderr):
|
||||||
@ -137,7 +140,7 @@ def _get_output_args(node, stream_name_map):
|
|||||||
if 'video_size' in kwargs:
|
if 'video_size' in kwargs:
|
||||||
video_size = kwargs.pop('video_size')
|
video_size = kwargs.pop('video_size')
|
||||||
if not isinstance(video_size, basestring) and isinstance(
|
if not isinstance(video_size, basestring) and isinstance(
|
||||||
video_size, collections.Iterable
|
video_size, Iterable
|
||||||
):
|
):
|
||||||
video_size = '{}x{}'.format(video_size[0], video_size[1])
|
video_size = '{}x{}'.format(video_size[0], video_size[1])
|
||||||
args += ['-video_size', video_size]
|
args += ['-video_size', video_size]
|
||||||
|
@ -3,13 +3,17 @@ from builtins import str
|
|||||||
from past.builtins import basestring
|
from past.builtins import basestring
|
||||||
import hashlib
|
import hashlib
|
||||||
import sys
|
import sys
|
||||||
import collections
|
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info.major == 2:
|
if sys.version_info.major == 2:
|
||||||
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
|
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
|
||||||
str = str
|
str = str
|
||||||
|
|
||||||
|
try:
|
||||||
|
from collections.abc import Iterable
|
||||||
|
except ImportError:
|
||||||
|
from collections import Iterable
|
||||||
|
|
||||||
|
|
||||||
# `past.builtins.basestring` module can't be imported on Python3 in some environments (Ubuntu).
|
# `past.builtins.basestring` module can't be imported on Python3 in some environments (Ubuntu).
|
||||||
# This code is copy-pasted from it to avoid crashes.
|
# This code is copy-pasted from it to avoid crashes.
|
||||||
@ -93,7 +97,7 @@ def convert_kwargs_to_cmd_line_args(kwargs):
|
|||||||
args = []
|
args = []
|
||||||
for k in sorted(kwargs.keys()):
|
for k in sorted(kwargs.keys()):
|
||||||
v = kwargs[k]
|
v = kwargs[k]
|
||||||
if isinstance(v, collections.Iterable) and not isinstance(v, str):
|
if isinstance(v, Iterable) and not isinstance(v, str):
|
||||||
for value in v:
|
for value in v:
|
||||||
args.append('-{}'.format(k))
|
args.append('-{}'.format(k))
|
||||||
if value is not None:
|
if value is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user