diff --git a/mayan/apps/common/apps.py b/mayan/apps/common/apps.py index a1a3e47f6f..2358c22a25 100644 --- a/mayan/apps/common/apps.py +++ b/mayan/apps/common/apps.py @@ -29,7 +29,7 @@ from .links import ( from .literals import DELETE_STALE_UPLOADS_INTERVAL from .menus import ( - menu_about, menu_main, menu_secondary, menu_tools, menu_user + menu_about, menu_main, menu_secondary, menu_user ) from .licenses import * # NOQA from .queues import * # NOQA - Force queues registration diff --git a/mayan/apps/common/compressed_files.py b/mayan/apps/common/compressed_files.py index 646d0b5724..4898a9f5ac 100644 --- a/mayan/apps/common/compressed_files.py +++ b/mayan/apps/common/compressed_files.py @@ -6,7 +6,7 @@ import zipfile try: import zlib # NOQA COMPRESSION = zipfile.ZIP_DEFLATED -except: +except ImportError: COMPRESSION = zipfile.ZIP_STORED from django.core.files.uploadedfile import SimpleUploadedFile diff --git a/mayan/apps/common/generics.py b/mayan/apps/common/generics.py index ec946e6fc2..3aab7d628a 100644 --- a/mayan/apps/common/generics.py +++ b/mayan/apps/common/generics.py @@ -127,7 +127,7 @@ class AssignRemoveView(ExtraContextMixin, ViewPermissionCheckMixin, ObjectPermis try: action_function(selection_obj) - except: + except Exception: if settings.DEBUG: raise else: diff --git a/mayan/apps/common/javascript.py b/mayan/apps/common/javascript.py index f25bc67a36..2c2d8d5d16 100644 --- a/mayan/apps/common/javascript.py +++ b/mayan/apps/common/javascript.py @@ -5,7 +5,6 @@ import hashlib import json import os import shutil -import sys import tarfile from furl import furl diff --git a/mayan/apps/common/templatetags/common_tags.py b/mayan/apps/common/templatetags/common_tags.py index e85087647f..5192a9ad0a 100644 --- a/mayan/apps/common/templatetags/common_tags.py +++ b/mayan/apps/common/templatetags/common_tags.py @@ -4,7 +4,6 @@ from json import dumps import sh -from django.conf import settings from django.template import Context, Library from django.template.loader import get_template from django.utils.encoding import force_text diff --git a/mayan/apps/common/views.py b/mayan/apps/common/views.py index 98626d7cca..14bec19514 100644 --- a/mayan/apps/common/views.py +++ b/mayan/apps/common/views.py @@ -5,13 +5,13 @@ from json import dumps from django.conf import settings from django.contrib import messages from django.contrib.contenttypes.models import ContentType -from django.http import Http404, HttpResponseRedirect +from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, resolve_url from django.template import RequestContext -from django.urls import reverse, reverse_lazy +from django.urls import reverse_lazy from django.utils import timezone, translation from django.utils.http import urlencode -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import ugettext_lazy as _ from django.views.generic import RedirectView, TemplateView from acls.models import AccessControlList diff --git a/mayan/apps/document_signatures/literals.py b/mayan/apps/document_signatures/literals.py index 44464a1cd5..f27ca1f9d8 100644 --- a/mayan/apps/document_signatures/literals.py +++ b/mayan/apps/document_signatures/literals.py @@ -1,4 +1,3 @@ from __future__ import unicode_literals RETRY_DELAY = 10 - diff --git a/mayan/apps/document_signatures/tasks.py b/mayan/apps/document_signatures/tasks.py index 2e90d94b46..3d358d668d 100644 --- a/mayan/apps/document_signatures/tasks.py +++ b/mayan/apps/document_signatures/tasks.py @@ -6,8 +6,6 @@ from django.apps import apps from mayan.celery import app -from .literals import RETRY_DELAY - logger = logging.getLogger(__name__) diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index e10f21bd83..60a9f90e23 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -649,7 +649,7 @@ class DocumentVersion(models.Model): self.mimetype, self.encoding = get_mimetype( file_object=file_object ) - except: + except Exception: self.mimetype = '' self.encoding = '' finally: diff --git a/mayan/apps/documents/tests/test_document_type_views.py b/mayan/apps/documents/tests/test_document_type_views.py index 117077688e..049ce2d236 100644 --- a/mayan/apps/documents/tests/test_document_type_views.py +++ b/mayan/apps/documents/tests/test_document_type_views.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from ..literals import ( DEFAULT_DELETE_PERIOD, DEFAULT_DELETE_TIME_UNIT ) -from ..models import Document, DocumentType +from ..models import DocumentType from ..permissions import ( permission_document_type_create, permission_document_type_delete, permission_document_type_edit, permission_document_type_view, @@ -213,6 +213,6 @@ class DocumentTypeQuickLabelViewsTestCase(GenericDocumentViewTestCase): obj=self.document_type, permission=permission_document_type_view ) response = self._request_quick_label_list_view() - self.assertContains(response, text=self.document_type_filename, - status_code=200 + self.assertContains( + response, text=self.document_type_filename, status_code=200 ) diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index d2c6d644ee..25786aa361 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -1,10 +1,8 @@ from __future__ import unicode_literals from datetime import timedelta -import os import time -from django.conf import settings from django.test import override_settings from common.tests import BaseTestCase @@ -18,7 +16,7 @@ from .base import GenericDocumentTestCase from .literals import ( TEST_DOCUMENT_TYPE_LABEL, TEST_DOCUMENT_PATH, TEST_MULTI_PAGE_TIFF_PATH, TEST_PDF_INDIRECT_ROTATE_PATH, TEST_OFFICE_DOCUMENT_PATH, - TEST_SMALL_DOCUMENT_FILENAME, TEST_SMALL_DOCUMENT_PATH + TEST_SMALL_DOCUMENT_PATH ) diff --git a/mayan/apps/mailer/forms.py b/mayan/apps/mailer/forms.py index 3f46a7a394..550264e489 100644 --- a/mayan/apps/mailer/forms.py +++ b/mayan/apps/mailer/forms.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import json from django import forms -from django.conf import settings from django.utils.translation import ugettext_lazy as _ from acls.models import AccessControlList diff --git a/mayan/apps/metadata/api.py b/mayan/apps/metadata/api.py index 6a3c98bdc7..e64505c248 100644 --- a/mayan/apps/metadata/api.py +++ b/mayan/apps/metadata/api.py @@ -96,7 +96,7 @@ def metadata_repr_as_list(metadata_list): try: output.append('%s - %s' % (MetadataType.objects.get( pk=metadata_dict['id']), metadata_dict.get('value', ''))) - except: + except Exception: pass return output diff --git a/mayan/apps/metadata/apps.py b/mayan/apps/metadata/apps.py index c6d1d856a0..b169f165a5 100644 --- a/mayan/apps/metadata/apps.py +++ b/mayan/apps/metadata/apps.py @@ -17,7 +17,6 @@ from common.classes import ModelAttribute from common.widgets import two_state_template from documents.search import document_page_search, document_search from documents.signals import post_document_type_change -from documents.permissions import permission_document_view from mayan.celery import app from navigation import SourceColumn diff --git a/mayan/apps/permissions/tests/test_views.py b/mayan/apps/permissions/tests/test_views.py index 998b2f0370..ddfad6236a 100644 --- a/mayan/apps/permissions/tests/test_views.py +++ b/mayan/apps/permissions/tests/test_views.py @@ -120,14 +120,12 @@ class PermissionsViewsTestCase(GenericViewTestCase): def test_role_permissions_view_with_permission_grant(self): self._create_role() self.grant_access(permission=permission_permission_grant, obj=self.role_2) - #self.grant_access(permission=permission_role_edit, obj=self.role_2) response = self._request_role_permissions_view() self.assertEqual(response.status_code, 200) def test_role_permissions_view_with_permission_revoke(self): self._create_role() self.grant_access(permission=permission_permission_revoke, obj=self.role_2) - #self.grant_access(permission=permission_role_edit, obj=self.role_2) response = self._request_role_permissions_view() self.assertEqual(response.status_code, 200) diff --git a/mayan/apps/sources/tests/test_links.py b/mayan/apps/sources/tests/test_links.py index e23dc96695..2b86b1c20a 100644 --- a/mayan/apps/sources/tests/test_links.py +++ b/mayan/apps/sources/tests/test_links.py @@ -1,9 +1,5 @@ from __future__ import unicode_literals -from django.contrib.contenttypes.models import ContentType -from django.urls import reverse - -from acls.models import AccessControlList from documents.tests import GenericDocumentViewTestCase from documents.permissions import permission_document_create diff --git a/mayan/apps/storage/backends/compressedstorage.py b/mayan/apps/storage/backends/compressedstorage.py index 008c575bc4..ad0a69e971 100644 --- a/mayan/apps/storage/backends/compressedstorage.py +++ b/mayan/apps/storage/backends/compressedstorage.py @@ -6,7 +6,7 @@ import zipfile try: import zlib # NOQA COMPRESSION = zipfile.ZIP_DEFLATED -except: +except ImportError: COMPRESSION = zipfile.ZIP_STORED try: diff --git a/mayan/apps/tags/widgets.py b/mayan/apps/tags/widgets.py index 9b1e55fe4e..449069576c 100644 --- a/mayan/apps/tags/widgets.py +++ b/mayan/apps/tags/widgets.py @@ -3,8 +3,6 @@ from __future__ import absolute_import, unicode_literals from django import forms from django.apps import apps from django.template.loader import render_to_string -from django.utils.encoding import force_text -from django.utils.html import format_html from django.utils.safestring import mark_safe from .permissions import permission_tag_view diff --git a/mayan/apps/user_management/tests/test_views.py b/mayan/apps/user_management/tests/test_views.py index 5af70f354c..3191422e15 100644 --- a/mayan/apps/user_management/tests/test_views.py +++ b/mayan/apps/user_management/tests/test_views.py @@ -14,13 +14,11 @@ from metadata.tests.literals import ( ) from ..permissions import ( - permission_user_create, permission_user_delete, permission_user_edit, - permission_user_view + permission_user_create, permission_user_delete, permission_user_edit ) from .literals import ( - TEST_USER_PASSWORD_EDITED, TEST_USER_USERNAME, TEST_USER_2_USERNAME, - TEST_USER_2_USERNAME_EDITED + TEST_USER_PASSWORD_EDITED, TEST_USER_USERNAME, TEST_USER_2_USERNAME ) TEST_USER_TO_DELETE_USERNAME = 'user_to_delete'