Skip to content

Commit

Permalink
Clean up: remove support for python2
Browse files Browse the repository at this point in the history
  • Loading branch information
nilfm99 committed Jun 14, 2024
1 parent 7c98e8d commit 8bdf9f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
9 changes: 2 additions & 7 deletions python/vmaf/core/cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
import sys


# TODO: remove this once python2 support is dropped, in python3 all int are as long as you want
if sys.version_info[0] == 3:
long = int


class ModelCrossValidation(object):

@staticmethod
Expand Down Expand Up @@ -66,7 +61,7 @@ def run_kfold_cross_validation(cls,
:return: output
"""

if isinstance(kfold, (int, long)):
if isinstance(kfold, int):
kfold_type = 'int'
elif isinstance(kfold, (list, tuple)):
kfold_type = 'list'
Expand Down Expand Up @@ -158,7 +153,7 @@ def run_nested_kfold_cross_validation(cls,
:return: output
"""

if isinstance(kfold, (int, long)):
if isinstance(kfold, int):
kfold_type = 'int'
elif isinstance(kfold, (list, tuple)):
kfold_type = 'list'
Expand Down
6 changes: 1 addition & 5 deletions python/vmaf/core/raw_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
__copyright__ = "Copyright 2016-2020, Netflix, Inc."
__license__ = "BSD+Patent"

# TODO: remove this once python2 support is dropped
if sys.version_info[0] == 3:
basestring = str


class RawExtractor(Executor):

Expand Down Expand Up @@ -85,7 +81,7 @@ def channels(self):
return 'yuv'
else:
channels = self.optional_dict['channels']
assert isinstance(channels, basestring)
assert isinstance(channels, str)
channels = set(channels.lower())
assert channels.issubset(set('yuv'))
return ''.join(channels)
Expand Down
7 changes: 0 additions & 7 deletions python/vmaf/tools/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
__license__ = "BSD+Patent"


try:
unicode # noqa, remove this once python2 support is dropped

except NameError:
unicode = str


try:
multiprocessing.set_start_method('fork')
except ValueError: # noqa, If platform does not support, just ignore
Expand Down
8 changes: 1 addition & 7 deletions python/vmaf/tools/scanf.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,7 @@
import sys
import unittest

try:
import StringIO

StringIO = StringIO.StringIO # TODO: remove this once python2 support is dropped

except ImportError:
from io import StringIO
from io import StringIO


__all__ = ['scanf', 'sscanf', 'fscanf']
Expand Down

0 comments on commit 8bdf9f1

Please sign in to comment.