diff --git a/lib/guessit/fileutils.py b/lib/guessit/fileutils.py index 2087c17..4e052b6 100644 --- a/lib/guessit/fileutils.py +++ b/lib/guessit/fileutils.py @@ -87,4 +87,5 @@ def load_file_in_same_dir(ref_file, filename): zfile = zipfile.ZipFile(zfilename) return zfile.read('/'.join(path[i + 1:])) - return u(io.open(os.path.join(*path), encoding='utf-8').read()) + with io.open(os.path.join(*path), encoding='utf-8') as fh: + return u(fh.read()) diff --git a/lib/guessit/language.py b/lib/guessit/language.py index 7f51b2c..45c0c28 100644 --- a/lib/guessit/language.py +++ b/lib/guessit/language.py @@ -172,7 +172,7 @@ class Language(UnicodeMixin): 'pob' """ - _with_country_regexp = re.compile('(.*)\((.*)\)') + _with_country_regexp = re.compile(r'(.*)\((.*)\)') _with_country_regexp2 = re.compile('(.*)-(.*)') def __init__(self, language, country=None, strict=False, scheme=None): diff --git a/lib/guessit/patterns.py b/lib/guessit/patterns.py index 447e24d..90a6d92 100644 --- a/lib/guessit/patterns.py +++ b/lib/guessit/patterns.py @@ -140,7 +140,7 @@ prop_multi = { 'format': { 'DVD': [ 'DVD', 'DVD-Rip', 'VIDEO-TS', 'DVDivX' ], 'DTS': [ 'DTS' ], 'AAC': [ 'He-AAC', 'AAC-He', 'AAC' ] }, - 'audioChannels': { '5.1': [ r'5\.1', 'DD5[\._ ]1', '5ch' ] }, + 'audioChannels': { '5.1': [ r'5\.1', r'DD5[\._ ]1', '5ch' ] }, 'episodeFormat': { 'Minisode': [ 'Minisodes?' ] } @@ -170,7 +170,7 @@ prop_single = { 'releaseGroup': [ 'ESiR', 'WAF', 'SEPTiC', r'\[XCT\]', 'iNT', 'P } _dash = '-' -_psep = '[-\. _]?' +_psep = r'[-\. _]?' def _to_rexp(prop): return re.compile(prop.replace(_dash, _psep), re.IGNORECASE) diff --git a/lib/guessit/textutils.py b/lib/guessit/textutils.py index a1b7c4b..0c5d862 100644 --- a/lib/guessit/textutils.py +++ b/lib/guessit/textutils.py @@ -58,7 +58,7 @@ def clean_string(s): return result -_words_rexp = re.compile('\w+', re.UNICODE) +_words_rexp = re.compile(r'\w+', re.UNICODE) def find_words(s): return _words_rexp.findall(s.replace('_', ' '))