Skip to content

Commit 6abf035

Browse files
committed
Remove dependency on future
1 parent df129c7 commit 6abf035

File tree

7 files changed

+7
-48
lines changed

7 files changed

+7
-48
lines changed

ffmpeg/_ffmpeg.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
from __future__ import unicode_literals
22

3-
from past.builtins import basestring
4-
from ._utils import basestring
5-
63
from .nodes import (
74
filter_operator,
85
GlobalNode,
@@ -79,7 +76,7 @@ def output(*streams_and_filename, **kwargs):
7976
"""
8077
streams_and_filename = list(streams_and_filename)
8178
if 'filename' not in kwargs:
82-
if not isinstance(streams_and_filename[-1], basestring):
79+
if not isinstance(streams_and_filename[-1], str):
8380
raise ValueError('A filename must be provided')
8481
kwargs['filename'] = streams_and_filename.pop(-1)
8582
streams = streams_and_filename

ffmpeg/_run.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import unicode_literals
22
from .dag import get_outgoing_edges, topo_sort
3-
from ._utils import basestring, convert_kwargs_to_cmd_line_args
3+
from ._utils import convert_kwargs_to_cmd_line_args
44
from builtins import str
55
from functools import reduce
66
import copy
@@ -140,7 +140,7 @@ def _get_output_args(node, stream_name_map):
140140
args += ['-b:a', str(kwargs.pop('audio_bitrate'))]
141141
if 'video_size' in kwargs:
142142
video_size = kwargs.pop('video_size')
143-
if not isinstance(video_size, basestring) and isinstance(video_size, Iterable):
143+
if not isinstance(video_size, str) and isinstance(video_size, Iterable):
144144
video_size = '{}x{}'.format(video_size[0], video_size[1])
145145
args += ['-video_size', video_size]
146146
args += convert_kwargs_to_cmd_line_args(kwargs)
@@ -185,7 +185,7 @@ def compile(stream_spec, cmd='ffmpeg', overwrite_output=False):
185185
This is the same as calling :meth:`get_args` except that it also
186186
includes the ``ffmpeg`` command as the first argument.
187187
"""
188-
if isinstance(cmd, basestring):
188+
if isinstance(cmd, str):
189189
cmd = [cmd]
190190
elif type(cmd) != list:
191191
cmd = list(cmd)

ffmpeg/_utils.py

+1-35
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,9 @@
11
from __future__ import unicode_literals
22
from builtins import str
3-
from past.builtins import basestring
43
import hashlib
54
import sys
65

76

8-
if sys.version_info.major == 2:
9-
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
10-
str = str
11-
12-
try:
13-
from collections.abc import Iterable
14-
except ImportError:
15-
from collections import Iterable
16-
17-
18-
# `past.builtins.basestring` module can't be imported on Python3 in some environments (Ubuntu).
19-
# This code is copy-pasted from it to avoid crashes.
20-
class BaseBaseString(type):
21-
def __instancecheck__(cls, instance):
22-
return isinstance(instance, (bytes, str))
23-
24-
def __subclasshook__(cls, thing):
25-
# TODO: What should go here?
26-
raise NotImplemented
27-
28-
297
def with_metaclass(meta, *bases):
308
class metaclass(meta):
319
__call__ = type.__call__
@@ -39,25 +17,13 @@ def __new__(cls, name, this_bases, d):
3917
return metaclass('temporary_class', None, {})
4018

4119

42-
if sys.version_info.major >= 3:
43-
44-
class basestring(with_metaclass(BaseBaseString)):
45-
pass
46-
47-
else:
48-
# noinspection PyUnresolvedReferences,PyCompatibility
49-
from builtins import basestring
50-
51-
5220
def _recursive_repr(item):
5321
"""Hack around python `repr` to deterministically represent dictionaries.
5422
5523
This is able to represent more things than json.dumps, since it does not require
5624
things to be JSON serializable (e.g. datetimes).
5725
"""
58-
if isinstance(item, basestring):
59-
result = str(item)
60-
elif isinstance(item, list):
26+
if isinstance(item, list):
6127
result = '[{}]'.format(', '.join([_recursive_repr(x) for x in item]))
6228
elif isinstance(item, dict):
6329
kv_pairs = [

ffmpeg/nodes.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import unicode_literals
22

3-
from past.builtins import basestring
43
from .dag import KwargReprNode
54
from ._utils import escape_chars, get_hash_int
65
from builtins import object
@@ -68,7 +67,7 @@ def __getitem__(self, index):
6867
"""
6968
if self.selector is not None:
7069
raise ValueError('Stream already has a selector: {}'.format(self))
71-
elif not isinstance(index, basestring):
70+
elif not isinstance(index, str):
7271
raise TypeError("Expected string index (e.g. 'a'); got {!r}".format(index))
7372
return self.node.stream(label=self.label, selector=index)
7473

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ certifi==2019.3.9
66
chardet==3.0.4
77
docutils==0.14
88
filelock==3.0.12
9-
future==0.17.1
109
idna==2.8
1110
imagesize==1.1.0
1211
importlib-metadata==0.17

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@
6868
download_url=download_url,
6969
keywords=keywords,
7070
long_description=long_description,
71-
install_requires=['future'],
71+
install_requires=[],
7272
extras_require={
7373
'dev': [
74-
'future==0.17.1',
7574
'numpy==1.16.4',
7675
'pytest-mock==1.10.4',
7776
'pytest==4.6.1',

tox.ini

-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ python =
1919
[testenv]
2020
commands = py.test -vv
2121
deps =
22-
future
2322
pytest
2423
pytest-mock

0 commit comments

Comments
 (0)