Skip to content

Commit

Permalink
Dropped support for Python 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
carltongibson committed Jun 5, 2020
1 parent 2405a2a commit 8f899ed
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ sudo: false
language: python
cache: pip
python:
- 2.7
- 3.5
- 3.6
- 3.7
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
========================

Expand Down
12 changes: 6 additions & 6 deletions picklefield/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
"""
Expand All @@ -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)):
Expand All @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ combine_as_imports=true
include_trailing_comma=true
multi_line_output=5
not_skip=__init__.py

[wheel]
universal = 1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'],
Expand Down
4 changes: 0 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@ 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
3.8 = py38

[testenv]
basepython =
py27: python2.7
py35: python3.5
py36: python3.6
py37: python3.7
Expand All @@ -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
Expand Down

0 comments on commit 8f899ed

Please sign in to comment.