PEP8 cleanups.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -7,9 +7,8 @@ from django.contrib.auth.views import (
|
||||
login, password_change, password_reset, password_reset_confirm,
|
||||
password_reset_complete, password_reset_done
|
||||
)
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import redirect, resolve_url
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@@ -110,7 +110,7 @@ class CheckoutListView(DocumentListView):
|
||||
'time.'
|
||||
),
|
||||
'no_results_title': _('No documents have been checked out'),
|
||||
'title': _('Documents checked out'),
|
||||
'title': _('Documents checked out'),
|
||||
}
|
||||
)
|
||||
return context
|
||||
|
||||
@@ -15,6 +15,7 @@ class ActionError(BaseCommonException):
|
||||
it is used to announce that one item in the queryset failed to process.
|
||||
"""
|
||||
|
||||
|
||||
class CompressionFileError(BaseCommonException):
|
||||
"""
|
||||
Base exception for file decompression class
|
||||
|
||||
@@ -45,6 +45,7 @@ def check_sqlite():
|
||||
def get_collections():
|
||||
return Collection.get_all()
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_encoded_parameter(item, parameters_dict):
|
||||
result = {}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from common.tests import BaseTestCase
|
||||
from django.test import override_settings
|
||||
|
||||
from ..compressed_files import Archive, TarArchive, ZipArchive
|
||||
|
||||
from .literals import (
|
||||
TEST_COMPRESSED_FILE_CONTENTS, TEST_FILE_CONTENTS_1, TEST_FILE_CONTENTS_2,
|
||||
TEST_FILE3_PATH, TEST_FILENAME1, TEST_FILENAME2, TEST_FILENAME3,
|
||||
TEST_TAR_BZ2_FILE_PATH, TEST_TAR_FILE_PATH, TEST_TAR_GZ_FILE_PATH,
|
||||
TEST_ZIP_FILE_PATH
|
||||
TEST_COMPRESSED_FILE_CONTENTS, TEST_FILE_CONTENTS_1, TEST_FILE3_PATH,
|
||||
TEST_FILENAME1, TEST_FILENAME3, TEST_TAR_BZ2_FILE_PATH,
|
||||
TEST_TAR_FILE_PATH, TEST_TAR_GZ_FILE_PATH, TEST_ZIP_FILE_PATH
|
||||
)
|
||||
|
||||
|
||||
@@ -43,7 +41,8 @@ class TarArchiveClassTestCase(BaseTestCase):
|
||||
with open(self.archive_path) as file_object:
|
||||
archive = Archive.open(file_object=file_object)
|
||||
self.assertEqual(
|
||||
archive.member_contents(filename=self.member_name), self.member_contents
|
||||
archive.member_contents(filename=self.member_name),
|
||||
self.member_contents
|
||||
)
|
||||
|
||||
def test_open_member(self):
|
||||
|
||||
@@ -10,7 +10,6 @@ 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.encoding import force_text
|
||||
from django.utils.http import (
|
||||
urlencode as django_urlencode, urlquote as django_urlquote
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ def get_kwargs_factory(variable_name):
|
||||
|
||||
|
||||
link_transformation_create = Link(
|
||||
icon_class = icon_transformation_create,
|
||||
icon_class=icon_transformation_create,
|
||||
kwargs=get_kwargs_factory('content_object'),
|
||||
permissions=(permission_transformation_create,),
|
||||
text=_('Create new transformation'), view='converter:transformation_create'
|
||||
|
||||
@@ -216,7 +216,7 @@ class TransformationListView(SingleObjectListView):
|
||||
'no_results_icon': icon_transformation,
|
||||
'no_results_main_link': link_transformation_create.resolve(
|
||||
context=RequestContext(
|
||||
self.request, {'content_object': self.content_object,}
|
||||
self.request, {'content_object': self.content_object}
|
||||
)
|
||||
),
|
||||
'no_results_text': _(
|
||||
|
||||
@@ -12,7 +12,7 @@ from .permissions import (
|
||||
permission_document_indexing_create, permission_document_indexing_edit,
|
||||
permission_document_indexing_delete,
|
||||
permission_document_indexing_instance_view,
|
||||
permission_document_indexing_rebuild,permission_document_indexing_view
|
||||
permission_document_indexing_rebuild, permission_document_indexing_view
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from .permissions import (
|
||||
permission_document_indexing_create, permission_document_indexing_delete,
|
||||
permission_document_indexing_edit,
|
||||
permission_document_indexing_instance_view,
|
||||
permission_document_indexing_rebuild, permission_document_indexing_view
|
||||
permission_document_indexing_view
|
||||
)
|
||||
from .tasks import task_rebuild_index
|
||||
from .widgets import node_tree
|
||||
|
||||
@@ -27,16 +27,16 @@ def index_instance_item_link(index_instance_item):
|
||||
|
||||
if isinstance(index_instance_item, IndexInstanceNode):
|
||||
if index_instance_item.index_template_node.link_documents:
|
||||
icon = icon_node_with_documents
|
||||
icon = icon_node_with_documents.render()
|
||||
else:
|
||||
icon = icon_index_level_up
|
||||
icon = icon_index_level_up.render()
|
||||
else:
|
||||
icon_template = ''
|
||||
icon = ''
|
||||
|
||||
return mark_safe(
|
||||
'%(icon)s <a href="%(url)s">%(text)s</a>' % {
|
||||
'url': index_instance_item.get_absolute_url(),
|
||||
'icon': icon.render(),
|
||||
'icon': icon,
|
||||
'text': index_instance_item
|
||||
}
|
||||
)
|
||||
|
||||
@@ -154,6 +154,7 @@ class DocumentsApp(MayanAppConfig):
|
||||
ModelEventType.register(
|
||||
model=DocumentType, event_types=(
|
||||
event_document_create,
|
||||
event_document_type_created,
|
||||
event_document_type_edited,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -79,7 +79,7 @@ class DashboardWidgetDocumentsTypesTotal(DashboardWidgetNumeric):
|
||||
class DashboardWidgetDocumentsNewThisMonth(DashboardWidgetNumeric):
|
||||
icon_class = icon_dashboard_new_documents_this_month
|
||||
label = _('New documents this month')
|
||||
link=reverse_lazy(
|
||||
link = reverse_lazy(
|
||||
'statistics:statistic_detail',
|
||||
args=('new-documents-per-month',)
|
||||
)
|
||||
@@ -92,7 +92,7 @@ class DashboardWidgetDocumentsNewThisMonth(DashboardWidgetNumeric):
|
||||
class DashboardWidgetDocumentsPagesNewThisMonth(DashboardWidgetNumeric):
|
||||
icon_class = icon_dashboard_pages_per_month
|
||||
label = _('New pages this month')
|
||||
link=reverse_lazy(
|
||||
link = reverse_lazy(
|
||||
'statistics:statistic_detail',
|
||||
args=('new-document-pages-per-month',)
|
||||
)
|
||||
|
||||
@@ -15,8 +15,7 @@ from common.generics import (
|
||||
|
||||
from ..forms import DocumentTypeFilenameForm_create
|
||||
from ..icons import (
|
||||
icon_document_type_filename, icon_document_type_filename_create,
|
||||
icon_document_type_setup
|
||||
icon_document_type_filename, icon_document_type_setup
|
||||
)
|
||||
from ..links import (
|
||||
link_document_type_create, link_document_type_filename_create
|
||||
|
||||
@@ -15,9 +15,8 @@ from common.compressed_files import ZipArchive
|
||||
from common.exceptions import ActionError
|
||||
from common.generics import (
|
||||
ConfirmView, FormView, MultipleObjectConfirmActionView,
|
||||
MultipleObjectConfirmActionView, MultipleObjectFormActionView,
|
||||
SingleObjectDetailView, SingleObjectDownloadView, SingleObjectEditView,
|
||||
SingleObjectListView
|
||||
MultipleObjectFormActionView, SingleObjectDetailView,
|
||||
SingleObjectDownloadView, SingleObjectEditView, SingleObjectListView
|
||||
)
|
||||
from common.mixins import MultipleInstanceActionMixin
|
||||
from common.utils import encapsulate
|
||||
@@ -90,6 +89,7 @@ class DocumentListView(SingleObjectListView):
|
||||
else:
|
||||
return queryset
|
||||
|
||||
|
||||
class DeletedDocumentDeleteView(ConfirmView):
|
||||
extra_context = {
|
||||
'title': _('Delete the selected document?')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .classes import StatisticLineChart, StatisticNamespace
|
||||
from .classes import StatisticLineChart, StatisticNamespace # NOQA
|
||||
|
||||
default_app_config = 'mayan_statistics.apps.StatisticsApp'
|
||||
|
||||
@@ -9,7 +9,7 @@ from common import MayanAppConfig, menu_object, menu_secondary, menu_tools
|
||||
|
||||
from navigation import SourceColumn
|
||||
|
||||
from .classes import Statistic, StatisticLineChart, StatisticNamespace
|
||||
from .classes import StatisticLineChart, StatisticNamespace
|
||||
from .links import (
|
||||
link_execute, link_namespace_details, link_namespace_list,
|
||||
link_statistics, link_view
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
from django.apps import apps
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
|
||||
|
||||
@@ -2,13 +2,6 @@ from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
from django.apps import apps
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
|
||||
from celery.schedules import crontab
|
||||
|
||||
from mayan.celery import app
|
||||
|
||||
|
||||
class ChartRenderer(object):
|
||||
def __init__(self, data):
|
||||
|
||||
@@ -420,7 +420,6 @@ class DocumentMetadataListView(SingleObjectListView):
|
||||
'title': _('Metadata for document: %s') % document,
|
||||
}
|
||||
|
||||
|
||||
def get_object_list(self):
|
||||
return self.get_document().metadata.all()
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.apps import apps
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation import Link, get_cascade_condition
|
||||
from permissions import Permission
|
||||
|
||||
from .icons import icon_message_create, icon_message_list
|
||||
from .permissions import (
|
||||
|
||||
@@ -259,7 +259,7 @@ class Menu(object):
|
||||
for source in self.non_sorted_sources:
|
||||
if isinstance(resolved_navigation_object, source):
|
||||
unsorted_source = True
|
||||
break;
|
||||
break
|
||||
|
||||
if sort_results and not unsorted_source:
|
||||
result[0] = sorted(
|
||||
|
||||
@@ -2,7 +2,6 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.apps import apps
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from permissions import Permission
|
||||
|
||||
|
||||
@@ -36,8 +36,7 @@ from .exceptions import SourceException
|
||||
from .literals import (
|
||||
DEFAULT_INTERVAL, DEFAULT_POP3_TIMEOUT, DEFAULT_IMAP_MAILBOX,
|
||||
DEFAULT_METADATA_ATTACHMENT_NAME, SCANNER_ADF_MODE_CHOICES,
|
||||
SCANNER_ADF_MODE_SIMPLEX, SCANNER_MODE_COLOR, SCANNER_MODE_CHOICES,
|
||||
SCANNER_SOURCE_CHOICES, SCANNER_SOURCE_FLATBED,
|
||||
SCANNER_MODE_COLOR, SCANNER_MODE_CHOICES, SCANNER_SOURCE_CHOICES,
|
||||
SOURCE_CHOICES, SOURCE_CHOICE_STAGING, SOURCE_CHOICE_WATCH,
|
||||
SOURCE_CHOICE_WEB_FORM, SOURCE_INTERACTIVE_UNCOMPRESS_CHOICES,
|
||||
SOURCE_UNCOMPRESS_CHOICES, SOURCE_UNCOMPRESS_CHOICE_N,
|
||||
|
||||
Reference in New Issue
Block a user