diff --git a/.travis.yml b/.travis.yml index 2585d18..f5e6795 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ dist: xenial language: python cache: pip python: - - 2.7 - - 3.4 - 3.5 - 3.6 - 3.7 @@ -14,16 +12,6 @@ env: - DJANGO=master matrix: exclude: - - python: 2.7 - env: DJANGO=2.0 - - python: 2.7 - env: DJANGO=2.1 - - python: 2.7 - env: DJANGO=master - - python: 3.4 - env: DJANGO=2.1 - - python: 3.4 - env: DJANGO=master - python: 3.5 env: DJANGO=master install: pip install tox-travis codecov diff --git a/CHANGES.txt b/CHANGES.txt index acf3429..e372e7f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -23,6 +23,9 @@ Changes - Clean up code, tests, and documentation. [aleksihakli] +- Drop support for Python 2.7 and Python 3.4. + [aleksihakli] + 4.5.4 (2019-01-15) ------------------ diff --git a/axes/__init__.py b/axes/__init__.py index 4b1c174..bbc0eda 100644 --- a/axes/__init__.py +++ b/axes/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - __version__ = '4.5.4' default_app_config = 'axes.apps.AppConfig' diff --git a/axes/admin.py b/axes/admin.py index af416b3..0f866cb 100644 --- a/axes/admin.py +++ b/axes/admin.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.contrib import admin from django.utils.translation import gettext_lazy as _ diff --git a/axes/apps.py b/axes/apps.py index 0ceb5d0..92839ba 100644 --- a/axes/apps.py +++ b/axes/apps.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django import apps diff --git a/axes/attempts.py b/axes/attempts.py index 64ba0df..60bd803 100644 --- a/axes/attempts.py +++ b/axes/attempts.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from datetime import timedelta from hashlib import md5 diff --git a/axes/backends.py b/axes/backends.py index 67f8d13..06fb0fb 100644 --- a/axes/backends.py +++ b/axes/backends.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.contrib.auth.backends import ModelBackend from axes.attempts import is_already_locked diff --git a/axes/checks.py b/axes/checks.py index 1215256..2e92af1 100644 --- a/axes/checks.py +++ b/axes/checks.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.checks import Error, Tags, register from django.conf import settings diff --git a/axes/conf.py b/axes/conf.py index 4c8d0b0..fc7c8a1 100644 --- a/axes/conf.py +++ b/axes/conf.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.conf import settings from django.utils.translation import gettext_lazy as _ diff --git a/axes/decorators.py b/axes/decorators.py index e38de07..918edd6 100644 --- a/axes/decorators.py +++ b/axes/decorators.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from functools import wraps import logging diff --git a/axes/exceptions.py b/axes/exceptions.py index 3139ce1..3b019a2 100644 --- a/axes/exceptions.py +++ b/axes/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.exceptions import PermissionDenied diff --git a/axes/management/__init__.py b/axes/management/__init__.py index baffc48..e69de29 100644 --- a/axes/management/__init__.py +++ b/axes/management/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/axes/management/commands/__init__.py b/axes/management/commands/__init__.py index baffc48..e69de29 100644 --- a/axes/management/commands/__init__.py +++ b/axes/management/commands/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/axes/management/commands/axes_list_attempts.py b/axes/management/commands/axes_list_attempts.py index f211ef6..b9bd6df 100644 --- a/axes/management/commands/axes_list_attempts.py +++ b/axes/management/commands/axes_list_attempts.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.management.base import BaseCommand from axes.models import AccessAttempt diff --git a/axes/management/commands/axes_reset.py b/axes/management/commands/axes_reset.py index 772f13a..f28c9f4 100644 --- a/axes/management/commands/axes_reset.py +++ b/axes/management/commands/axes_reset.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.management.base import BaseCommand from axes.utils import reset diff --git a/axes/management/commands/axes_reset_ip.py b/axes/management/commands/axes_reset_ip.py index 66abfea..657a1ac 100644 --- a/axes/management/commands/axes_reset_ip.py +++ b/axes/management/commands/axes_reset_ip.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.management.base import BaseCommand from axes.utils import reset diff --git a/axes/management/commands/axes_reset_username.py b/axes/management/commands/axes_reset_username.py index d455c66..2e6ec7c 100644 --- a/axes/management/commands/axes_reset_username.py +++ b/axes/management/commands/axes_reset_username.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.management.base import BaseCommand from axes.utils import reset diff --git a/axes/middleware.py b/axes/middleware.py index f3be766..1ce6363 100644 --- a/axes/middleware.py +++ b/axes/middleware.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from axes.exceptions import AxesSignalPermissionDenied from axes.utils import get_lockout_response diff --git a/axes/migrations/0001_initial.py b/axes/migrations/0001_initial.py index 24aa82c..5c5d510 100644 --- a/axes/migrations/0001_initial.py +++ b/axes/migrations/0001_initial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/axes/migrations/0002_auto_20151217_2044.py b/axes/migrations/0002_auto_20151217_2044.py index a6cbc12..0d880d0 100644 --- a/axes/migrations/0002_auto_20151217_2044.py +++ b/axes/migrations/0002_auto_20151217_2044.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/axes/migrations/0003_auto_20160322_0929.py b/axes/migrations/0003_auto_20160322_0929.py index b47d693..e337e54 100644 --- a/axes/migrations/0003_auto_20160322_0929.py +++ b/axes/migrations/0003_auto_20160322_0929.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import models, migrations diff --git a/axes/migrations/0004_auto_20181024_1538.py b/axes/migrations/0004_auto_20181024_1538.py index 266f5d0..215b18d 100644 --- a/axes/migrations/0004_auto_20181024_1538.py +++ b/axes/migrations/0004_auto_20181024_1538.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.16 on 2018-10-24 22:38 -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/axes/migrations/0005_remove_accessattempt_trusted.py b/axes/migrations/0005_remove_accessattempt_trusted.py index 10db717..9e004a0 100644 --- a/axes/migrations/0005_remove_accessattempt_trusted.py +++ b/axes/migrations/0005_remove_accessattempt_trusted.py @@ -1,5 +1,3 @@ -# Generated by Django 2.1.4 on 2018-12-23 09:03 - from django.db import migrations diff --git a/axes/models.py b/axes/models.py index 2a6c1de..cceff60 100644 --- a/axes/models.py +++ b/axes/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.db import models from django.utils.translation import gettext_lazy as _ diff --git a/axes/signals.py b/axes/signals.py index 141069b..95a20de 100644 --- a/axes/signals.py +++ b/axes/signals.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import logging from django.contrib.auth.signals import user_logged_in diff --git a/axes/test_settings.py b/axes/test_settings.py index a7e72d7..1977249 100644 --- a/axes/test_settings.py +++ b/axes/test_settings.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', diff --git a/axes/test_urls.py b/axes/test_urls.py index e417cfa..ede2ec9 100644 --- a/axes/test_urls.py +++ b/axes/test_urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.conf.urls import url from django.contrib import admin diff --git a/axes/tests/__init__.py b/axes/tests/__init__.py index baffc48..e69de29 100644 --- a/axes/tests/__init__.py +++ b/axes/tests/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/axes/tests/compatibility.py b/axes/tests/compatibility.py deleted file mode 100644 index 2e5c08b..0000000 --- a/axes/tests/compatibility.py +++ /dev/null @@ -1,6 +0,0 @@ -from __future__ import unicode_literals - -try: - from unittest.mock import patch # pylint: disable=unused-import -except ImportError: - from mock import patch # pylint: disable=unused-import diff --git a/axes/tests/test_access_attempt.py b/axes/tests/test_access_attempt.py index cf95df2..35d4019 100644 --- a/axes/tests/test_access_attempt.py +++ b/axes/tests/test_access_attempt.py @@ -1,10 +1,9 @@ -from __future__ import unicode_literals - import datetime import hashlib import random import string import time +from unittest.mock import patch from django.http import HttpRequest from django.test import TestCase, override_settings @@ -17,7 +16,6 @@ from axes.conf import settings from axes.attempts import get_cache_key from axes.models import AccessAttempt, AccessLog from axes.signals import user_locked_out -from axes.tests.compatibility import patch from axes.utils import reset @@ -213,7 +211,6 @@ class AccessAttemptTest(TestCase): ) self.assertEqual(cache_hash_key, get_cache_key(attempt)) - @patch('axes.utils.get_client_ip', return_value='127.0.0.1') def test_get_cache_key_credentials(self, _): """ Test the cache key format""" diff --git a/axes/tests/test_access_attempt_config.py b/axes/tests/test_access_attempt_config.py index b3ac2c6..6ab5523 100644 --- a/axes/tests/test_access_attempt_config.py +++ b/axes/tests/test_access_attempt_config.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from django.test import TestCase, override_settings diff --git a/axes/tests/test_checks.py b/axes/tests/test_checks.py index 24a9503..9a954d5 100644 --- a/axes/tests/test_checks.py +++ b/axes/tests/test_checks.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.core.checks import run_checks, Error from django.conf import settings from django.test import TestCase, override_settings diff --git a/axes/tests/test_management_commands.py b/axes/tests/test_management_commands.py index 396a8cf..f7f6aa5 100644 --- a/axes/tests/test_management_commands.py +++ b/axes/tests/test_management_commands.py @@ -1,8 +1,4 @@ -from __future__ import unicode_literals - from io import StringIO -from sys import version_info -from unittest import skipIf from django.core.management import call_command from django.test import TestCase @@ -10,7 +6,6 @@ from django.test import TestCase from axes.models import AccessAttempt -@skipIf(version_info < (3, ), 'Not supported on Python 2.x') class ManagementCommandTestCase(TestCase): def setUp(self): AccessAttempt.objects.create( diff --git a/axes/tests/test_utils.py b/axes/tests/test_utils.py index 277c21b..e809010 100644 --- a/axes/tests/test_utils.py +++ b/axes/tests/test_utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime from django.http import HttpRequest diff --git a/axes/utils.py b/axes/utils.py index 476e137..f93f4a3 100644 --- a/axes/utils.py +++ b/axes/utils.py @@ -1,10 +1,3 @@ -from __future__ import unicode_literals - -try: - import win_inet_pton # pylint: disable=unused-import -except ImportError: - pass - from datetime import timedelta from inspect import getargspec from logging import getLogger diff --git a/docs/conf.py b/docs/conf.py index 6deb8e7..961c344 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# # Django Axes documentation build configuration file, created by # sphinx-quickstart on Sat Jul 30 16:37:41 2016. # diff --git a/requirements.txt b/requirements.txt index 677d3a1..e2c7ce0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ -e . coverage==4.5.2 -mock==2.0.0 ; python_version <= "2.7" prospector==1.1.6.2 sphinx_rtd_theme==0.4.2 tox==3.7.0 diff --git a/setup.py b/setup.py index 9afda4f..a693b96 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- - -from __future__ import unicode_literals import codecs from setuptools import setup, find_packages @@ -28,7 +25,6 @@ setup( 'django', 'django-appconf', 'django-ipware>=2.0.2', - 'win_inet_pton ; python_version < "3.4" and sys_platform == "win32"', ], include_package_data=True, packages=find_packages(), @@ -44,10 +40,7 @@ setup( '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', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', diff --git a/tox.ini b/tox.ini index f8c7767..9e35f82 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,10 @@ [tox] envlist = - py{27,34,35,36,37}-django111 - py{34,35,36,37}-django20 - py{35,36,37}-django21 + py{35,36,37}-django{111,20,21} py{36,37}-djangomaster [travis] python = - 2.7: py27 - 3.4: py34 3.5: py35 3.6: py36 3.7: py37