diff --git a/guessit/data/__init__.py b/guessit/data/__init__.py new file mode 100644 index 00000000..86fd56d8 --- /dev/null +++ b/guessit/data/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Data +""" diff --git a/guessit/rules/properties/website.py b/guessit/rules/properties/website.py index 1dd84936..39907527 100644 --- a/guessit/rules/properties/website.py +++ b/guessit/rules/properties/website.py @@ -3,7 +3,7 @@ """ Website property. """ -from pkg_resources import resource_stream # @UnresolvedImport +from importlib_resources import open_text # @UnresolvedImport from rebulk.remodule import re from rebulk import Rebulk, Rule, RemoveMatch @@ -27,11 +27,11 @@ def website(config): rebulk = rebulk.regex_defaults(flags=re.IGNORECASE).string_defaults(ignore_case=True) rebulk.defaults(name="website") - with resource_stream('guessit', 'data/tlds-alpha-by-domain.txt') as tld_file: + with open_text('guessit.data', 'tlds-alpha-by-domain.txt') as tld_file: tlds = [ - tld.strip().decode('utf-8') + tld.strip() for tld in tld_file.readlines() - if b'--' not in tld + if '--' not in tld ][1:] # All registered domain extension safe_tlds = config['safe_tlds'] # For sure a website extension diff --git a/setup.py b/setup.py index 9b689418..155115d7 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ with io.open(os.path.join(here, 'CHANGELOG.md'), encoding='utf-8') as f: changelog = f.read() -install_requires = ['rebulk>=3', 'babelfish', 'python-dateutil'] +install_requires = ['rebulk>=3', 'babelfish', 'python-dateutil', 'importlib-resources'] setup_requires = ['pytest-runner']