diff --git a/petale/api_views.py b/petale/api_views.py
index e5e21c3..777ecc1 100644
--- a/petale/api_views.py
+++ b/petale/api_views.py
@@ -16,6 +16,7 @@
import logging
+from urllib import parse as urlparse
try:
from functools import reduce
@@ -32,8 +33,7 @@ from atomicwrites import atomic_write
from django.conf import settings
from django.db.models.query import F, Q
from django.db.transaction import atomic
-from django.http import HttpResponse, StreamingHttpResponse
-from django.utils.six.moves.urllib import parse as urlparse
+from django.http import HttpResponse
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
diff --git a/petale/authentication.py b/petale/authentication.py
index 01a09b2..2ea8281 100644
--- a/petale/authentication.py
+++ b/petale/authentication.py
@@ -15,11 +15,11 @@
# along with this program. If not, see .
import logging
+from urllib import parse as urlparse
import requests
from django.conf import settings
from django.contrib.auth.models import User
-from django.utils.six.moves.urllib import parse as urlparse
from django.utils.translation import ugettext_lazy as _
from rest_framework.authentication import BasicAuthentication
from rest_framework.exceptions import AuthenticationFailed
diff --git a/petale/migrations/0001_initial.py b/petale/migrations/0001_initial.py
index 6f6431a..a2bc45b 100644
--- a/petale/migrations/0001_initial.py
+++ b/petale/migrations/0001_initial.py
@@ -2,8 +2,6 @@ import django.core.validators
from django.conf import settings
from django.db import migrations, models
-import petale.models
-
class Migration(migrations.Migration):
diff --git a/petale/models.py b/petale/models.py
index 0266b73..35d401e 100644
--- a/petale/models.py
+++ b/petale/models.py
@@ -21,7 +21,6 @@ from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.core.validators import RegexValidator
from django.db import models
-from django.utils import six
from django.utils.translation import ugettext_lazy as _
from . import utils
@@ -49,7 +48,7 @@ class Partner(models.Model):
size = models.BigIntegerField(verbose_name=_('Size'), default=0, help_text=_('as bytes'))
def __str__(self):
- return self.name
+ return str(self.name)
def check_limits(self, size_delta, **kwargs):
new_size = self.size + size_delta
@@ -84,7 +83,7 @@ class CUT(models.Model):
uuid = models.CharField(max_length=255, validators=[id_validator], unique=True)
def __str__(self):
- return self.uuid
+ return str(self.uuid)
class Meta:
verbose_name = _('CUT')
diff --git a/petale/urls.py b/petale/urls.py
index ba29b50..87c58a6 100644
--- a/petale/urls.py
+++ b/petale/urls.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from django.conf.urls import include, url
+from django.conf.urls import url
from django.contrib import admin
from .api_views import PetalAPIKeysView, PetalAPIView
diff --git a/pylint.rc b/pylint.rc
new file mode 100644
index 0000000..c7cb64c
--- /dev/null
+++ b/pylint.rc
@@ -0,0 +1,128 @@
+[MASTER]
+profile=no
+persistent=yes
+cache-size=500
+
+[MESSAGES CONTROL]
+disable=
+ abstract-method,
+ arguments-differ,
+ assignment-from-none,
+ attribute-defined-outside-init,
+ bad-super-call,
+ broad-except,
+ consider-using-dict-comprehension,
+ consider-using-set-comprehension,
+ cyclic-import,
+ duplicate-code,
+ exec-used,
+ fixme,
+ global-variable-undefined,
+ import-outside-toplevel,
+ inconsistent-return-statements,
+ invalid-name,
+ keyword-arg-before-vararg,
+ missing-class-docstring,
+ missing-function-docstring,
+ missing-module-docstring,
+ no-else-return,
+ no-member,
+ no-self-use,
+ non-parent-init-called,
+ not-callable,
+ possibly-unused-variable,
+ protected-access,
+ raise-missing-from,
+ redefined-argument-from-local,
+ redefined-builtin,
+ redefined-outer-name,
+ signature-differs,
+ stop-iteration-return,
+ super-init-not-called,
+ superfluous-parens,
+ too-many-ancestors,
+ too-many-arguments,
+ too-many-branches,
+ too-many-instance-attributes,
+ too-many-lines,
+ too-many-locals,
+ too-many-nested-blocks,
+ too-many-return-statements,
+ too-many-statements,
+ undefined-loop-variable,
+ unnecessary-comprehension,
+ unspecified-encoding,
+ unsubscriptable-object,
+ unsupported-membership-test,
+ unused-argument,
+ use-a-generator,
+ c-extension-no-member,
+ consider-using-f-string
+
+
+[REPORTS]
+output-format=parseable
+include-ids=yes
+
+
+[BASIC]
+no-docstring-rgx=__.*__|_.*
+class-rgx=[A-Z_][a-zA-Z0-9_]+$
+function-rgx=[a-zA_][a-zA-Z0-9_]{2,70}$
+method-rgx=[a-z_][a-zA-Z0-9_]{2,70}$
+const-rgx=(([A-Z_][A-Z0-9_]*)|([a-z_][a-z0-9_]*)|(__.*__)|register|urlpatterns)$
+good-names=_,i,j,k,e,x,Run,,setUp,tearDown,r,p,s,v,fd
+
+[TYPECHECK]
+
+# Tells whether missing members accessed in mixin class should be ignored. A
+# mixin class is detected if its name ends with "mixin" (case insensitive).
+ignore-mixin-members=yes
+
+# List of classes names for which member attributes should not be checked
+# (useful for classes with attributes dynamically set).
+ignored-classes=
+
+# When zope mode is activated, add a predefined set of Zope acquired attributes
+# to generated-members.
+zope=no
+
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E0201 when accessed.
+generated-members=objects,DoesNotExist,id,pk,_meta,base_fields,context
+
+# List of method names used to declare (i.e. assign) instance attributes
+defining-attr-methods=__init__,__new__,setUp
+
+
+[VARIABLES]
+init-import=no
+dummy-variables-rgx=_|dummy
+good-names=_,i,j,k,e,x,Run,,setUp,tearDown,r,p,s,v,fd
+
+[SIMILARITIES]
+min-similarity-lines=6
+ignore-comments=yes
+ignore-docstrings=yes
+
+
+[MISCELLANEOUS]
+notes=FIXME,XXX,TODO
+
+
+[FORMAT]
+max-line-length=160
+max-module-lines=2000
+indent-string=' '
+
+
+[DESIGN]
+max-args=10
+max-locals=15
+max-returns=6
+max-branchs=12
+max-statements=50
+max-parents=7
+max-attributes=7
+min-public-methods=0
+max-public-methods=50
diff --git a/pylint.sh b/pylint.sh
index 241d24c..0742243 100755
--- a/pylint.sh
+++ b/pylint.sh
@@ -1,13 +1,4 @@
#!/bin/bash
-
set -e
-if [ -f /var/lib/jenkins/pylint.django.rc ]; then
- PYLINT_RC=/var/lib/jenkins/pylint.django.rc
-elif [ -f pylint.django.rc ]; then
- PYLINT_RC=pylint.django.rc
-else
- echo No pylint RC found
- exit 0
-fi
-pylint -f parseable --rcfile ${PYLINT_RC} "$@" > pylint.out || /bin/true
+pylint -f parseable --rcfile pylint.rc "$@" | tee pylint.out; test $PIPESTATUS -eq 0
diff --git a/tox.ini b/tox.ini
index 7500737..27f4187 100644
--- a/tox.ini
+++ b/tox.ini
@@ -55,12 +55,16 @@ commands =
./manage.py {posargs:--help}
[testenv:pylint]
-usedevelop = true
basepython = python3
+setenv =
+ DJANGO_SETTINGS_MODULE=petale.settings
+ PETALE_SETTINGS_FILE=tests/settings.py
+ SETUPTOOLS_USE_DISTUTILS=stdlib
deps =
Django<2.3
- pylint<1.8
- pylint-django<0.8.1
+ psycopg2-binary
+ pylint
+ pylint-django
commands =
/bin/bash -c "./pylint.sh petale/"