Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up: remove support for python2 #1370

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading