Skip to content

Commit

Permalink
Upgraded some embedded dependencies to be ready for Python 3.10. This…
Browse files Browse the repository at this point in the history
… doesn't mean that it's fully supported right now.
  • Loading branch information
morpheus65535 committed Dec 1, 2021
1 parent 2d214bf commit 402c82d
Show file tree
Hide file tree
Showing 244 changed files with 8,217 additions and 96,583 deletions.
4 changes: 2 additions & 2 deletions bazarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def check_python_version():
print("Python " + minimum_py3_str + " or greater required. "
"Current version is " + platform.python_version() + ". Please upgrade Python.")
sys.exit(1)
elif int(python_version[0]) == 3 and int(python_version[1]) == 9:
print("Python 3.9.x is unsupported. Current version is " + platform.python_version() +
elif int(python_version[0]) == 3 and int(python_version[1]) > 8:
print("Python version greater than 3.8.x is unsupported. Current version is " + platform.python_version() +
". Keep in mind that even if it works, you're on your own.")
elif (int(python_version[0]) == minimum_py3_tuple[0] and int(python_version[1]) < minimum_py3_tuple[1]) or \
(int(python_version[0]) != minimum_py3_tuple[0]):
Expand Down
6 changes: 0 additions & 6 deletions libs/babelfish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
__title__ = 'babelfish'
__version__ = '0.5.5-dev'
__author__ = 'Antoine Bertin'
__license__ = 'BSD'
__copyright__ = 'Copyright 2015 the BabelFish authors'

import sys

if sys.version_info[0] >= 3:
Expand Down
13 changes: 9 additions & 4 deletions libs/babelfish/converters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
import collections
from pkg_resources import iter_entry_points, EntryPoint
from ..exceptions import LanguageConvertError, LanguageReverseError

try:
# Python 3.3+
from collections.abc import Mapping, MutableMapping
except ImportError:
from collections import Mapping, MutableMapping


# from https://github.com/kennethreitz/requests/blob/master/requests/structures.py
class CaseInsensitiveDict(collections.MutableMapping):
class CaseInsensitiveDict(MutableMapping):
"""A case-insensitive ``dict``-like object.
Implements all methods and operations of
``collections.MutableMapping`` as well as dict's ``copy``. Also
``collections.abc.MutableMapping`` as well as dict's ``copy``. Also
provides ``lower_items``.
All keys are expected to be strings. The structure remembers the
Expand Down Expand Up @@ -63,7 +68,7 @@ def lower_items(self):
)

def __eq__(self, other):
if isinstance(other, collections.Mapping):
if isinstance(other, Mapping):
other = CaseInsensitiveDict(other)
else:
return NotImplemented
Expand Down
4 changes: 2 additions & 2 deletions libs/babelfish/converters/opensubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class OpenSubtitlesConverter(LanguageReverseConverter):
def __init__(self):
self.alpha3b_converter = language_converters['alpha3b']
self.alpha2_converter = language_converters['alpha2']
self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne'}
self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne', ('chi', 'TW'): 'zht'}
self.from_opensubtitles = CaseInsensitiveDict({'pob': ('por', 'BR'), 'pb': ('por', 'BR'), 'ell': ('ell', None),
'scc': ('srp', None), 'mne': ('srp', 'ME')})
'scc': ('srp', None), 'mne': ('srp', 'ME'), 'zht': ('zho', 'TW')})
self.codes = (self.alpha2_converter.codes | self.alpha3b_converter.codes | set(self.from_opensubtitles.keys()))

def convert(self, alpha3, country=None, script=None):
Expand Down
1 change: 1 addition & 0 deletions libs/babelfish/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
from pkg_resources import resource_stream # @UnresolvedImport
Expand Down
45 changes: 0 additions & 45 deletions libs/babelfish/data/get_files.py

This file was deleted.

1 change: 1 addition & 0 deletions libs/babelfish/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
from pkg_resources import resource_stream # @UnresolvedImport
Expand Down
1 change: 1 addition & 0 deletions libs/babelfish/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
from collections import namedtuple
from pkg_resources import resource_stream # @UnresolvedImport
from . import basestr
Expand Down

0 comments on commit 402c82d

Please sign in to comment.