mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
Update guessit to 3.0.3
Also updates: - babelfish-0.5.5 - python-dateutil-2.7.5 - rebulk-1.0.0 - six-1.12.0
This commit is contained in:
parent
05b0fb498f
commit
2eb9d9dc7c
120 changed files with 17964 additions and 4530 deletions
|
@ -3,12 +3,15 @@
|
|||
"""
|
||||
Various utilities functions
|
||||
"""
|
||||
from collections import MutableSet
|
||||
try:
|
||||
from collections.abc import MutableSet
|
||||
except ImportError:
|
||||
from collections import MutableSet
|
||||
|
||||
from types import GeneratorType
|
||||
|
||||
|
||||
def find_all(string, sub, start=None, end=None, ignore_case=False):
|
||||
def find_all(string, sub, start=None, end=None, ignore_case=False, **kwargs):
|
||||
"""
|
||||
Return all indices in string s where substring sub is
|
||||
found, such that sub is contained in the slice s[start:end].
|
||||
|
@ -41,6 +44,7 @@ def find_all(string, sub, start=None, end=None, ignore_case=False):
|
|||
:return: all indices in the input string
|
||||
:rtype: __generator[str]
|
||||
"""
|
||||
#pylint: disable=unused-argument
|
||||
if ignore_case:
|
||||
sub = sub.lower()
|
||||
string = string.lower()
|
||||
|
@ -65,10 +69,8 @@ def get_first_defined(data, keys, default_value=None):
|
|||
:rtype:
|
||||
"""
|
||||
for key in keys:
|
||||
try:
|
||||
if key in data:
|
||||
return data[key]
|
||||
except KeyError:
|
||||
pass
|
||||
return default_value
|
||||
|
||||
|
||||
|
@ -84,6 +86,7 @@ def is_iterable(obj):
|
|||
We don't need to check for the Python 2 `unicode` type, because it doesn't
|
||||
have an `__iter__` attribute anyway.
|
||||
"""
|
||||
# pylint: disable=consider-using-ternary
|
||||
return hasattr(obj, '__iter__') and not isinstance(obj, str) or isinstance(obj, GeneratorType)
|
||||
|
||||
|
||||
|
@ -118,7 +121,7 @@ class IdentitySet(MutableSet): # pragma: no cover
|
|||
"""
|
||||
Set based on identity
|
||||
"""
|
||||
def __init__(self, items=None):
|
||||
def __init__(self, items=None): # pylint: disable=super-init-not-called
|
||||
if items is None:
|
||||
items = []
|
||||
self.refs = set(map(_Ref, items))
|
||||
|
@ -132,11 +135,11 @@ class IdentitySet(MutableSet): # pragma: no cover
|
|||
def __len__(self):
|
||||
return len(self.refs)
|
||||
|
||||
def add(self, elem):
|
||||
self.refs.add(_Ref(elem))
|
||||
def add(self, value):
|
||||
self.refs.add(_Ref(value))
|
||||
|
||||
def discard(self, elem):
|
||||
self.refs.discard(_Ref(elem))
|
||||
def discard(self, value):
|
||||
self.refs.discard(_Ref(value))
|
||||
|
||||
def update(self, iterable):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue