From 122037f5afb0f4f6a2101cc39c879c70fd6a057d Mon Sep 17 00:00:00 2001 From: Laerte Pereira <5853172+Laerte@users.noreply.github.com> Date: Mon, 14 Nov 2022 13:11:43 -0300 Subject: [PATCH] Drop support for Python 3.5, 3.6 versions (#1097) * Drop support for Python 3.5, 3.6 versions * fix extras_require --- .github/workflows/main.yml | 6 ------ README.rst | 2 +- dateparser/date.py | 12 ++---------- dateparser_cli/utils.py | 5 +---- setup.py | 7 ++----- tests/test_hijri.py | 9 +-------- 6 files changed, 7 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79b3e459d..fdd5ea710 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,12 +17,6 @@ jobs: - python-version: 3.8 env: TOXENV: flake8 - - python-version: 3.5 - env: - TOXENV: py - - python-version: 3.6 - env: - TOXENV: py - python-version: 3.7 env: TOXENV: py diff --git a/README.rst b/README.rst index f33418f38..89588754d 100644 --- a/README.rst +++ b/README.rst @@ -156,7 +156,7 @@ are executed, you can do so through the Installation ------------ -Dateparser supports Python >= 3.5. You can install it by doing: +Dateparser supports Python >= 3.7. You can install it by doing: :: diff --git a/dateparser/date.py b/dateparser/date.py index 5bd269440..fc434a6f2 100644 --- a/dateparser/date.py +++ b/dateparser/date.py @@ -303,12 +303,7 @@ def __setitem__(self, k, v): setattr(self, k, v) def __repr__(self): - if sys.version_info < (3, 6): # python 3.5 compatibility - properties_text = "date_obj={}, period={}, locale={}".format( - self.date_obj.__repr__(), self.period.__repr__(), self.locale.__repr__() - ) - else: - properties_text = ', '.join('{}={}'.format(prop, val.__repr__()) for prop, val in self.__dict__.items()) + properties_text = ', '.join('{}={}'.format(prop, val.__repr__()) for prop, val in self.__dict__.items()) return '{}({})'.format( self.__class__.__name__, properties_text @@ -465,10 +460,7 @@ def get_date_data(self, date_string, date_formats=None): def get_date_tuple(self, *args, **kwargs): date_data = self.get_date_data(*args, **kwargs) - if sys.version_info < (3, 6): # python 3.5 compatibility - fields = ['date_obj', 'period', 'locale'] - else: - fields = date_data.__dict__.keys() + fields = date_data.__dict__.keys() date_tuple = collections.namedtuple('DateData', fields) return date_tuple(**date_data.__dict__) diff --git a/dateparser_cli/utils.py b/dateparser_cli/utils.py index d2c3591b0..c4239180a 100644 --- a/dateparser_cli/utils.py +++ b/dateparser_cli/utils.py @@ -5,10 +5,7 @@ DEFAULT_DIR_NAME = 'dateparser_models' DEFAULT_UNIX_CACHE_DIR = '~/.cache' -if sys.version_info < (3, 6): # python 3.5 compatibility - DEFAULT_WINDOWS_CACHE_DIR = os.path.join(str(Path.home()), "AppData", "Roaming") -else: - DEFAULT_WINDOWS_CACHE_DIR = os.path.join(Path.home(), "AppData", "Roaming") +DEFAULT_WINDOWS_CACHE_DIR = os.path.join(Path.home(), "AppData", "Roaming") if sys.platform.startswith('win'): diff --git a/setup.py b/setup.py index 026e6df20..20693ba3a 100644 --- a/setup.py +++ b/setup.py @@ -34,23 +34,20 @@ 'console_scripts': ['dateparser-download = dateparser_cli.cli:entrance'], }, extras_require={ - 'calendars:python_version<"3.6"': ['convertdate'], - 'calendars:python_version>="3.6"': ['hijri-converter', 'convertdate'], + 'calendars': ['hijri-converter', 'convertdate'], 'fasttext': ['fasttext'], 'langdetect': ['langdetect'], }, license="BSD", zip_safe=False, keywords='dateparser', - python_requires='>=3.5', + python_requires='>=3.7', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', diff --git a/tests/test_hijri.py b/tests/test_hijri.py index 55e215972..0b858a927 100644 --- a/tests/test_hijri.py +++ b/tests/test_hijri.py @@ -6,16 +6,9 @@ from tests import BaseTestCase -is_python_supported = sys.version_info >= (3, 6) +from dateparser.calendars.hijri import HijriCalendar -try: - from dateparser.calendars.hijri import HijriCalendar -except ImportError: - if is_python_supported: - raise - -@unittest.skipUnless(is_python_supported, "hijri-converter doesn't support Python<3.6") class TestHijriParser(BaseTestCase): def setUp(self):