From 8f899edd574ae19b0392fad3c06ca60a6939d6ad Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Fri, 5 Jun 2020 15:14:40 +0200 Subject: [PATCH] Dropped support for Python 2. --- .travis.yml | 1 - README.rst | 4 ++++ picklefield/fields.py | 12 ++++++------ setup.cfg | 3 --- setup.py | 4 ++-- tox.ini | 4 ---- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index aae3926..55a4c95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ sudo: false language: python cache: pip python: - - 2.7 - 3.5 - 3.6 - 3.7 diff --git a/README.rst b/README.rst index 6639493..577c39e 100644 --- a/README.rst +++ b/README.rst @@ -162,6 +162,10 @@ since it is never a good idea to have a PickledObjectField be user editable. Changes ------- +UNRELEASED +========== + +* Dropped support for Python 2. Changes in version 2.1.0 ======================== diff --git a/picklefield/fields.py b/picklefield/fields.py index 45a4f31..1e87690 100644 --- a/picklefield/fields.py +++ b/picklefield/fields.py @@ -31,7 +31,7 @@ class PickledObject(str): """ -class _ObjectWrapper(object): +class _ObjectWrapper: """ A class used to wrap object that have properties that may clash with the ORM internals. @@ -95,7 +95,7 @@ def __init__(self, *args, **kwargs): self.protocol = kwargs.pop('protocol', DEFAULT_PROTOCOL) self.copy = kwargs.pop('copy', True) kwargs.setdefault('editable', False) - super(PickledObjectField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def get_default(self): """ @@ -114,7 +114,7 @@ def get_default(self): return self.default() return self.default # If the field doesn't have a default, then we punt to models.Field. - return super(PickledObjectField, self).get_default() + return super().get_default() def _check_default(self): if self.has_default() and isinstance(self.default, (list, dict, set)): @@ -139,7 +139,7 @@ def _check_default(self): return [] def check(self, **kwargs): - errors = super(PickledObjectField, self).check(**kwargs) + errors = super().check(**kwargs) errors.extend(self._check_default()) return errors @@ -167,7 +167,7 @@ def to_python(self, value): return value def pre_save(self, model_instance, add): - value = super(PickledObjectField, self).pre_save(model_instance, add) + value = super().pre_save(model_instance, add) return wrap_conflictual_object(value) if DJANGO_VERSION < (2, 0): @@ -211,4 +211,4 @@ def get_lookup(self, lookup_name): """ if lookup_name not in ['exact', 'in', 'isnull']: raise TypeError('Lookup type %s is not supported.' % lookup_name) - return super(PickledObjectField, self).get_lookup(lookup_name) + return super().get_lookup(lookup_name) diff --git a/setup.cfg b/setup.cfg index b4b3ce2..869de29 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,3 @@ combine_as_imports=true include_trailing_comma=true multi_line_output=5 not_skip=__init__.py - -[wheel] -universal = 1 diff --git a/setup.py b/setup.py index 24ec734..3955741 100644 --- a/setup.py +++ b/setup.py @@ -26,8 +26,7 @@ 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', @@ -38,6 +37,7 @@ ], keywords=['django pickle model field'], packages=find_packages(exclude=['tests', 'tests.*']), + python_requires='>=3', install_requires=['Django>=1.11'], extras_require={ 'tests': ['tox'], diff --git a/tox.ini b/tox.ini index 72304b2..4fd5e22 100644 --- a/tox.ini +++ b/tox.ini @@ -4,14 +4,12 @@ args_are_paths = false envlist = flake8, isort, - py27-1.11, py35-{1.11,2.2}, py36-{1.11,2.2,master}, py37-{1.11,2.2,master}, py38-{2.2,master}, [tox:travis] -2.7 = py27 3.5 = py35 3.6 = py36 3.7 = py37 @@ -19,7 +17,6 @@ envlist = [testenv] basepython = - py27: python2.7 py35: python3.5 py36: python3.6 py37: python3.7 @@ -29,7 +26,6 @@ commands = {envpython} -R -Wonce {envbindir}/coverage run --branch -m django test -v2 --settings=tests.settings {posargs} coverage report -m deps = - py27: mock coverage 1.11: Django>=1.11,<2.0 2.0: Django>=2.0,<2.1