From 66b578ec1a2dbb80f4697ffb40293e6f95e2fb8f Mon Sep 17 00:00:00 2001 From: Bastien Vallet Date: Tue, 7 Jul 2020 11:53:05 +0200 Subject: [PATCH] [cleanup] Code cleanup - Fix tox - Fix flake8 line length - Remove six - Remove python 2.x support --- .travis.yml | 17 ++++++----------- djclick/adapter.py | 4 +--- djclick/test/test_adapter.py | 6 ------ djclick/test/testprj/testapp/models.py | 4 ---- requirements-dev.txt | 1 - requirements.txt | 1 - setup.py | 6 +++--- tox.ini | 10 +++++++++- 8 files changed, 19 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e88a35..b8d08f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,11 +14,8 @@ python: - "3.6" env: - matrix: - - TOXENV=dj22 - - TOXENV=dj30 - - - TOXENV=flake8 + - TOXENV=dj22 + - TOXENV=dj30 cache: directories: @@ -27,14 +24,12 @@ cache: install: - pip install flake8 tox 'coverage<5' coveralls -jobs: - include: - - name: flake8 - python: "3.6" - script: flake8 djclick - script: - tox -e $TOXENV - coverage report - coverage html - coveralls + +jobs: + include: + - script: tox -e flake8 diff --git a/djclick/adapter.py b/djclick/adapter.py index 1233a15..e528d37 100644 --- a/djclick/adapter.py +++ b/djclick/adapter.py @@ -2,8 +2,6 @@ import sys from functools import update_wrapper -import six - import click from django import get_version, VERSION as DJANGO_VERSION @@ -110,7 +108,7 @@ def execute(self, *args, **kwargs): # Rename kwargs to to the appropriate destination argument name opt_mapping = dict(self.map_names()) arg_options = { - opt_mapping.get(key, key): value for key, value in six.iteritems(kwargs) + opt_mapping.get(key, key): value for key, value in kwargs.items() } # Update the context with the passed (renamed) kwargs diff --git a/djclick/test/test_adapter.py b/djclick/test/test_adapter.py index cc35f49..7eb4bd7 100644 --- a/djclick/test/test_adapter.py +++ b/djclick/test/test_adapter.py @@ -3,8 +3,6 @@ import codecs import subprocess -import six - import pytest import click @@ -16,10 +14,6 @@ import djclick -todo = pytest.mark.xfail(reason="TODO") - - -@pytest.mark.skipif(not six.PY3, reason="Only necessary on Python3") def test_not_ascii(): # NOCOV """ Make sure that the systems preferred encoding is not `ascii`. diff --git a/djclick/test/testprj/testapp/models.py b/djclick/test/testprj/testapp/models.py index 6923afb..4ac7be1 100644 --- a/djclick/test/testprj/testapp/models.py +++ b/djclick/test/testprj/testapp/models.py @@ -1,10 +1,6 @@ -from __future__ import unicode_literals - from django.db import models -from six import python_2_unicode_compatible -@python_2_unicode_compatible class DummyModel(models.Model): slug = models.CharField(max_length=50) diff --git a/requirements-dev.txt b/requirements-dev.txt index 1542b12..6536945 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,7 +12,6 @@ check-manifest flake8 mccabe pep8 -flake8-todo pep8-naming pyflakes diff --git a/requirements.txt b/requirements.txt index b87678b..d28a871 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -six>=1.9.0 click>=7.1,<7.2 diff --git a/setup.py b/setup.py index 483c9ee..b106ff8 100755 --- a/setup.py +++ b/setup.py @@ -18,10 +18,10 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", ] diff --git a/tox.ini b/tox.ini index 481fe68..2709083 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # By moving it out of the way (~500MB), we trim test execution time by > 80%. toxworkdir = {homedir}/.toxenvs/django-click envlist = - dj{22,30} + dj{22,30},flake8 [testenv] usedevelop = true @@ -17,3 +17,11 @@ deps = dj22: django>=2.2,<2.3 dj30: django>=3.0,<3.1 commands = py.test -rxs --cov-report= --cov-append --cov djclick {posargs:djclick} + + +[testenv:flake8] +commands = flake8 djclick + + +[flake8] +max-line-length = 100