diff --git a/mayan/apps/acls/tests/test_links.py b/mayan/apps/acls/tests/test_links.py index 633323a77d..16bb0e848a 100644 --- a/mayan/apps/acls/tests/test_links.py +++ b/mayan/apps/acls/tests/test_links.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType -from django.urls import resolve, reverse +from django.urls import reverse from documents.tests.test_views import GenericDocumentViewTestCase from user_management.tests.literals import ( diff --git a/mayan/apps/authentication/views.py b/mayan/apps/authentication/views.py index 9cfc727c25..b135828e0a 100644 --- a/mayan/apps/authentication/views.py +++ b/mayan/apps/authentication/views.py @@ -83,7 +83,7 @@ def password_reset_complete_view(request): return password_reset_complete( request, extra_context=extra_context, - template_name= 'authentication/password_reset_complete.html' + template_name='authentication/password_reset_complete.html' ) diff --git a/mayan/apps/common/apps.py b/mayan/apps/common/apps.py index cd5265e0c8..59f8795327 100644 --- a/mayan/apps/common/apps.py +++ b/mayan/apps/common/apps.py @@ -2,7 +2,6 @@ from __future__ import absolute_import, unicode_literals from datetime import timedelta import logging -import os from kombu import Exchange, Queue diff --git a/mayan/apps/common/generics.py b/mayan/apps/common/generics.py index c8142852cb..9837d34b4a 100644 --- a/mayan/apps/common/generics.py +++ b/mayan/apps/common/generics.py @@ -20,7 +20,7 @@ from django_downloadview import ( ) from pure_pagination.mixins import PaginationMixin -from .forms import ChoiceForm, DynamicForm +from .forms import ChoiceForm from .mixins import ( DeleteExtraDataMixin, DynamicFormViewMixin, ExtraContextMixin, FormExtraKwargsMixin, MultipleObjectMixin, ObjectActionMixin, diff --git a/mayan/apps/common/management/commands/initialsetup.py b/mayan/apps/common/management/commands/initialsetup.py index 92abda7fde..2a91f83991 100644 --- a/mayan/apps/common/management/commands/initialsetup.py +++ b/mayan/apps/common/management/commands/initialsetup.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.core import management -from django.db.utils import OperationalError from ...signals import post_initial_setup, pre_initial_setup diff --git a/mayan/apps/common/management/commands/performupgrade.py b/mayan/apps/common/management/commands/performupgrade.py index 2b33143d74..9e78fa6e8b 100644 --- a/mayan/apps/common/management/commands/performupgrade.py +++ b/mayan/apps/common/management/commands/performupgrade.py @@ -30,6 +30,3 @@ class Command(management.BaseCommand): raise CommandError( 'Error during post_upgrade signal; %s' % exception ) - - - diff --git a/mayan/apps/common/signals.py b/mayan/apps/common/signals.py index cc1cb3a666..21e7890310 100644 --- a/mayan/apps/common/signals.py +++ b/mayan/apps/common/signals.py @@ -7,4 +7,3 @@ post_initial_setup = Signal(use_caching=True) post_upgrade = Signal(use_caching=True) pre_initial_setup = Signal(use_caching=True) pre_upgrade = Signal(use_caching=True) - diff --git a/mayan/apps/document_states/models.py b/mayan/apps/document_states/models.py index 10d17b57d1..29f52ff283 100644 --- a/mayan/apps/document_states/models.py +++ b/mayan/apps/document_states/models.py @@ -141,10 +141,10 @@ class WorkflowState(models.Model): 'workflow_instance', flat=True ) ) | Q( - workflows__log_entries__isnull=True, - workflows__workflow__states=self, - workflows__workflow__states__initial=True - ) + workflows__log_entries__isnull=True, + workflows__workflow__states=self, + workflows__workflow__states__initial=True + ) ).distinct() diff --git a/mayan/apps/documents/migrations/0039_duplicateddocument.py b/mayan/apps/documents/migrations/0039_duplicateddocument.py index a7d944837f..c2e7cc0c97 100644 --- a/mayan/apps/documents/migrations/0039_duplicateddocument.py +++ b/mayan/apps/documents/migrations/0039_duplicateddocument.py @@ -19,19 +19,22 @@ class Migration(migrations.Migration): ( 'id', models.AutoField( auto_created=True, primary_key=True, serialize=False, - verbose_name='ID') - ), + verbose_name='ID' + ) + ), ( 'datetime_added', models.DateTimeField( auto_now_add=True, db_index=True, - verbose_name='Added') - ), + verbose_name='Added' + ) + ), ( 'document', models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name='duplicates', to='documents.Document', - verbose_name='Document') - ), + verbose_name='Document' + ) + ), ( 'documents', models.ManyToManyField( to='documents.Document', diff --git a/mayan/apps/documents/tests/test_views.py b/mayan/apps/documents/tests/test_views.py index d84056ab99..f0b62bcd5d 100644 --- a/mayan/apps/documents/tests/test_views.py +++ b/mayan/apps/documents/tests/test_views.py @@ -33,6 +33,7 @@ from .literals import ( TEST_TRANSFORMATION_NAME, TEST_VERSION_COMMENT ) + @override_settings(OCR_AUTO_OCR=False) class GenericDocumentViewTestCase(GenericViewTestCase): def setUp(self): @@ -606,7 +607,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase): # Grant the document type view permission so that the post create # redirect works self.grant_permission(permission=permission_document_type_view) - response = self._request_document_type_create() + self._request_document_type_create() self.assertEqual(DocumentType.objects.count(), 0) @@ -669,7 +670,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase): ) def test_document_type_edit_view_no_permission(self): - response = self._request_document_type_edit() + self._request_document_type_edit() self.assertEqual( DocumentType.objects.get(pk=self.document_type.pk).label, @@ -781,7 +782,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase): self.grant_access( obj=self.document_type, permission=permission_document_type_view ) - response = self._request_quick_label_delete() + self._request_quick_label_delete() self.assertEqual( self.document_type.filenames.count(), 1 @@ -807,6 +808,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase): self.document_type.filenames.count(), 0 ) + class DocumentVersionTestCase(GenericDocumentViewTestCase): def setUp(self): super(DocumentVersionTestCase, self).setUp() diff --git a/mayan/apps/documents/views/document_version_views.py b/mayan/apps/documents/views/document_version_views.py index 2faefe9ae5..4140b262db 100644 --- a/mayan/apps/documents/views/document_version_views.py +++ b/mayan/apps/documents/views/document_version_views.py @@ -12,7 +12,7 @@ from common.generics import ConfirmView, SingleObjectListView from ..models import Document, DocumentVersion from ..permissions import ( permission_document_download, permission_document_version_revert, - permission_document_version_view, permission_document_view + permission_document_version_view ) from .document_views import DocumentDownloadFormView, DocumentDownloadView diff --git a/mayan/apps/dynamic_search/serializers.py b/mayan/apps/dynamic_search/serializers.py index 28ba7a954f..09c2442dff 100644 --- a/mayan/apps/dynamic_search/serializers.py +++ b/mayan/apps/dynamic_search/serializers.py @@ -2,8 +2,6 @@ from __future__ import unicode_literals from rest_framework import serializers -from .classes import SearchField, SearchModel - class SearchFieldSerializer(serializers.Serializer): field = serializers.CharField(read_only=True) diff --git a/mayan/apps/lock_manager/backends/model_lock.py b/mayan/apps/lock_manager/backends/model_lock.py index ff863f60c2..6ef8f5a97e 100644 --- a/mayan/apps/lock_manager/backends/model_lock.py +++ b/mayan/apps/lock_manager/backends/model_lock.py @@ -11,7 +11,7 @@ class ModelLock(LockingBackend): super(ModelLock, cls).acquire_lock(name=name, timeout=timeout) Lock = apps.get_model(app_label='lock_manager', model_name='Lock') return ModelLock( - model_instance = Lock.objects.acquire_lock( + model_instance=Lock.objects.acquire_lock( name=name, timeout=timeout ) ) diff --git a/mayan/apps/mailer/mailers.py b/mayan/apps/mailer/mailers.py index 2878fbe4bd..6b5b74657e 100644 --- a/mayan/apps/mailer/mailers.py +++ b/mayan/apps/mailer/mailers.py @@ -16,7 +16,7 @@ class DjangoSMTP(MailerBackend): 'help_text': _('The host to use for sending email.'), 'kwargs': { 'max_length': 48 - }, 'required': False + }, 'required': False }, { 'name': 'port', 'label': _('Port'), diff --git a/mayan/apps/metadata/widgets.py b/mayan/apps/metadata/widgets.py index a70540577f..8e4a428069 100644 --- a/mayan/apps/metadata/widgets.py +++ b/mayan/apps/metadata/widgets.py @@ -1,4 +1,5 @@ from __future__ import unicode_literals + from django.utils.html import format_html_join @@ -8,7 +9,9 @@ def get_metadata_string(document): """ return format_html_join( '\n', '
{}: {}
', - ((document_metadata.metadata_type,document_metadata.metadata_type_id,document_metadata.id,document_metadata.value) - for document_metadata in document.metadata.all() + ( + ( + document_metadata.metadata_type, document_metadata.metadata_type_id, document_metadata.id, document_metadata.value + ) for document_metadata in document.metadata.all() ) ) diff --git a/mayan/apps/mirroring/management/commands/mountindex.py b/mayan/apps/mirroring/management/commands/mountindex.py index 2a57b9b948..fa5dd98a23 100644 --- a/mayan/apps/mirroring/management/commands/mountindex.py +++ b/mayan/apps/mirroring/management/commands/mountindex.py @@ -240,7 +240,7 @@ class Command(management.BaseCommand): allow_other=options['allow_other'], allow_root=options['allow_root'] ) - except RuntimeError as exception: + except RuntimeError: if options['allow_other'] or options['allow_root']: raise CommandError( 'Make sure \'user_allow_other\' is set in /etc/fuse.conf' diff --git a/mayan/apps/ocr/tests/test_views.py b/mayan/apps/ocr/tests/test_views.py index 0c67c5041d..41b0462103 100644 --- a/mayan/apps/ocr/tests/test_views.py +++ b/mayan/apps/ocr/tests/test_views.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.test import override_settings -from django.utils.encoding import force_text from documents.tests.test_views import GenericDocumentViewTestCase diff --git a/mayan/apps/ocr/utils.py b/mayan/apps/ocr/utils.py index b2b9d19a03..8175c3040e 100644 --- a/mayan/apps/ocr/utils.py +++ b/mayan/apps/ocr/utils.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals from django.utils.encoding import force_text from django.utils.html import conditional_escape +from .models import DocumentPageContent + def get_document_ocr_content(document): for page in document.pages.all(): diff --git a/mayan/apps/permissions/serializers.py b/mayan/apps/permissions/serializers.py index 02db390840..7449079d2d 100644 --- a/mayan/apps/permissions/serializers.py +++ b/mayan/apps/permissions/serializers.py @@ -60,8 +60,6 @@ class WritableRoleSerializer(serializers.HyperlinkedModelSerializer): model = Role def create(self, validated_data): - result = validated_data.copy() - self.groups_pk_list = validated_data.pop('groups_pk_list', '') self.permissions_pk_list = validated_data.pop( 'permissions_pk_list', '' diff --git a/mayan/apps/sources/models.py b/mayan/apps/sources/models.py index 47d17f4241..f2c4a6f2dc 100644 --- a/mayan/apps/sources/models.py +++ b/mayan/apps/sources/models.py @@ -126,7 +126,6 @@ class Source(models.Model): document.delete(to_trash=False) raise - def handle_upload(self, file_object, description=None, document_type=None, expand=False, label=None, language=None, metadata_dict_list=None, metadata_dictionary=None, user=None): if not document_type: document_type = self.document_type diff --git a/mayan/apps/sources/tests/test_views.py b/mayan/apps/sources/tests/test_views.py index 9ef431c228..687d726d7b 100644 --- a/mayan/apps/sources/tests/test_views.py +++ b/mayan/apps/sources/tests/test_views.py @@ -12,7 +12,7 @@ from common.utils import fs_cleanup, mkdtemp from documents.models import Document, DocumentType from documents.permissions import permission_document_create from documents.tests import ( - TEST_DOCUMENT_DESCRIPTION, TEST_SMALL_DOCUMENT_PATH, TEST_DOCUMENT_TYPE_LABEL, + TEST_DOCUMENT_DESCRIPTION, TEST_DOCUMENT_TYPE_LABEL, TEST_SMALL_DOCUMENT_CHECKSUM, TEST_SMALL_DOCUMENT_PATH ) from documents.tests.test_views import GenericDocumentViewTestCase diff --git a/mayan/apps/tags/widgets.py b/mayan/apps/tags/widgets.py index 1256993ec7..4999c713c9 100644 --- a/mayan/apps/tags/widgets.py +++ b/mayan/apps/tags/widgets.py @@ -3,7 +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.html import escape from django.utils.encoding import force_text from django.utils.html import format_html from django.utils.safestring import mark_safe