diff --git a/mayan/apps/authentication/links.py b/mayan/apps/authentication/links.py index 2f145e7ddc..9753b6e240 100644 --- a/mayan/apps/authentication/links.py +++ b/mayan/apps/authentication/links.py @@ -9,8 +9,11 @@ from .icons import icon_logout, icon_password_change def has_usable_password_and_can_change_password(context): return ( - context['request'].user.has_usable_password and - not context['request'].user.user_options.block_password_change + context[ + 'request' + ].user.has_usable_password and not context[ + 'request' + ].user.user_options.block_password_change ) diff --git a/mayan/apps/common/compressed_files.py b/mayan/apps/common/compressed_files.py index e9b819fdd5..eccf7f2fec 100644 --- a/mayan/apps/common/compressed_files.py +++ b/mayan/apps/common/compressed_files.py @@ -83,7 +83,7 @@ class Archive(object): """ Return a file-like object to a member of the archive """ - raise NotImplemented + raise NotImplementedError class TarArchive(Archive): diff --git a/mayan/apps/common/settings.py b/mayan/apps/common/settings.py index 50d7dfad11..65bd08a330 100644 --- a/mayan/apps/common/settings.py +++ b/mayan/apps/common/settings.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import os -import tempfile from django.conf import settings from django.utils.translation import ugettext_lazy as _ diff --git a/mayan/apps/common/tests/test_views.py b/mayan/apps/common/tests/test_views.py index 3ea6538b05..bae31f9367 100644 --- a/mayan/apps/common/tests/test_views.py +++ b/mayan/apps/common/tests/test_views.py @@ -43,25 +43,25 @@ class CommonViewTestCase(GenericViewTestCase): ) def test_object_error_list_view_with_permissions(self): - self._create_error_log_entry() + self._create_error_log_entry() - self.grant_access( - obj=self.user, permission=permission_error_log_view - ) + self.grant_access( + obj=self.user, permission=permission_error_log_view + ) - response = self._request_object_error_log_list() + response = self._request_object_error_log_list() - self.assertContains( - response=response, text=TEST_ERROR_LOG_ENTRY_RESULT, - status_code=200 - ) + self.assertContains( + response=response, text=TEST_ERROR_LOG_ENTRY_RESULT, + status_code=200 + ) def test_object_error_list_view_no_permissions(self): - self._create_error_log_entry() + self._create_error_log_entry() - response = self._request_object_error_log_list() + response = self._request_object_error_log_list() - self.assertNotContains( - response=response, text=TEST_ERROR_LOG_ENTRY_RESULT, - status_code=403 - ) + self.assertNotContains( + response=response, text=TEST_ERROR_LOG_ENTRY_RESULT, + status_code=403 + ) diff --git a/mayan/apps/common/utils.py b/mayan/apps/common/utils.py index 24cdbcd433..df53507ed9 100644 --- a/mayan/apps/common/utils.py +++ b/mayan/apps/common/utils.py @@ -1,9 +1,6 @@ from __future__ import unicode_literals import logging -import os -import shutil -import tempfile import types from django.conf import settings diff --git a/mayan/apps/events/migrations/0005_auto_20170731_0452.py b/mayan/apps/events/migrations/0005_auto_20170731_0452.py index f2ab813adf..fe36950fac 100644 --- a/mayan/apps/events/migrations/0005_auto_20170731_0452.py +++ b/mayan/apps/events/migrations/0005_auto_20170731_0452.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2017-07-31 04:52 from __future__ import unicode_literals import re @@ -40,12 +38,12 @@ def revert_event_types_names(apps, schema_editor): StoredEventType = apps.get_model('events', 'StoredEventType') known_namespaces = { - 'documents\.': 'documents_', - 'checkouts\.': 'checkouts_', - 'document_comments\.': 'document_comment_', - 'document_parsing\.': 'parsing_document_', - 'ocr\.': 'ocr_', - 'tags\.': 'tag_', + r'documents\.': 'documents_', + r'checkouts\.': 'checkouts_', + r'document_comments\.': 'document_comment_', + r'document_parsing\.': 'parsing_document_', + r'ocr\.': 'ocr_', + r'tags\.': 'tag_', } pattern = re.compile('|'.join(known_namespaces.keys())) diff --git a/mayan/apps/metadata/tests/test_views.py b/mayan/apps/metadata/tests/test_views.py index acd2827692..25b771f240 100644 --- a/mayan/apps/metadata/tests/test_views.py +++ b/mayan/apps/metadata/tests/test_views.py @@ -311,7 +311,9 @@ class DocumentMetadataTestCase(GenericDocumentViewTestCase): 'metadata_type', flat=True ) self.assertTrue( - self.metadata_type.pk in document_metadata_types and + self.metadata_type.pk in document_metadata_types + ) + self.assertTrue( metadata_type_2.pk in document_metadata_types ) diff --git a/mayan/apps/storage/utils.py b/mayan/apps/storage/utils.py index da99718149..df97cbaf7a 100644 --- a/mayan/apps/storage/utils.py +++ b/mayan/apps/storage/utils.py @@ -4,20 +4,6 @@ import logging import os import shutil import tempfile -import types - -from django.conf import settings -from django.urls import resolve as django_resolve -from django.urls.base import get_script_prefix -from django.utils.datastructures import MultiValueDict -from django.utils.http import ( - urlencode as django_urlencode, urlquote as django_urlquote -) -from django.utils.six.moves import reduce as reduce_function, xmlrpc_client -from django.utils.translation import ugettext_lazy as _ - -import mayan -from mayan.apps.common.compat import dict_type, dictionary_type from .settings import setting_temporary_directory