diff --git a/zerver/apps.py b/zerver/apps.py index f41abb82b1..25c50e9640 100644 --- a/zerver/apps.py +++ b/zerver/apps.py @@ -1,12 +1,11 @@ -from django.apps import AppConfig -from django.db.models.signals import post_migrate -from django.core.cache import cache -from django.conf import settings -from typing import Any, Dict - import logging +from typing import Any, Dict +from django.apps import AppConfig +from django.conf import settings +from django.core.cache import cache +from django.db.models.signals import post_migrate def flush_cache(sender, **kwargs): # type: (AppConfig, **Any) -> None diff --git a/zerver/filters.py b/zerver/filters.py index 4ed40b2891..207c61d651 100644 --- a/zerver/filters.py +++ b/zerver/filters.py @@ -1,8 +1,8 @@ from typing import Any, Dict -from django.views.debug import SafeExceptionReporterFilter from django.http import HttpRequest +from django.views.debug import SafeExceptionReporterFilter class ZulipExceptionReporterFilter(SafeExceptionReporterFilter): def get_post_parameters(self, request): diff --git a/zerver/logging_handlers.py b/zerver/logging_handlers.py index 140a507e31..e459846bf2 100644 --- a/zerver/logging_handlers.py +++ b/zerver/logging_handlers.py @@ -1,12 +1,11 @@ # System documented in https://zulip.readthedocs.io/en/latest/logging.html -from django.conf import settings +import logging +import platform +import traceback from typing import Any, Dict, Optional -import logging -import traceback -import platform - +from django.conf import settings from django.core import mail from django.http import HttpRequest from django.utils.log import AdminEmailHandler diff --git a/zerver/middleware.py b/zerver/middleware.py index 460baffcec..48586455de 100644 --- a/zerver/middleware.py +++ b/zerver/middleware.py @@ -1,32 +1,31 @@ -from typing import Any, AnyStr, Callable, Dict, Iterable, List, MutableMapping, Optional, Text - -from django.conf import settings -from django.core.exceptions import DisallowedHost -from django.utils.translation import ugettext as _ -from django.utils.deprecation import MiddlewareMixin - -from zerver.lib.response import json_error, json_response_from_error -from zerver.lib.subdomains import get_subdomain -from zerver.lib.exceptions import JsonableError, ErrorCode -from django.db import connection -from django.http import HttpRequest, HttpResponse, StreamingHttpResponse -from zerver.lib.utils import statsd -from zerver.lib.queue import queue_json_publish -from zerver.lib.cache import get_remote_cache_time, get_remote_cache_requests -from zerver.lib.bugdown import get_bugdown_time, get_bugdown_requests -from zerver.models import Realm, flush_per_request_caches, get_realm -from zerver.lib.exceptions import RateLimited -from django.contrib.sessions.middleware import SessionMiddleware -from django.views.csrf import csrf_failure as html_csrf_failure -from django.utils.cache import patch_vary_headers -from django.utils.http import cookie_date -from django.shortcuts import redirect, render - +import cProfile import logging import time -import cProfile import traceback +from typing import Any, AnyStr, Callable, Dict, \ + Iterable, List, MutableMapping, Optional, Text + +from django.conf import settings +from django.contrib.sessions.middleware import SessionMiddleware +from django.core.exceptions import DisallowedHost +from django.db import connection +from django.http import HttpRequest, HttpResponse, StreamingHttpResponse +from django.shortcuts import redirect, render +from django.utils.cache import patch_vary_headers +from django.utils.deprecation import MiddlewareMixin +from django.utils.http import cookie_date +from django.utils.translation import ugettext as _ +from django.views.csrf import csrf_failure as html_csrf_failure + +from zerver.lib.bugdown import get_bugdown_requests, get_bugdown_time +from zerver.lib.cache import get_remote_cache_requests, get_remote_cache_time +from zerver.lib.exceptions import ErrorCode, JsonableError, RateLimited +from zerver.lib.queue import queue_json_publish +from zerver.lib.response import json_error, json_response_from_error +from zerver.lib.subdomains import get_subdomain +from zerver.lib.utils import statsd +from zerver.models import Realm, flush_per_request_caches, get_realm logger = logging.getLogger('zulip.requests') diff --git a/zerver/signals.py b/zerver/signals.py index 41a1ad18fe..c4fa77af2a 100644 --- a/zerver/signals.py +++ b/zerver/signals.py @@ -1,12 +1,15 @@ -from django.dispatch import receiver -from django.contrib.auth.signals import user_logged_in -from django.conf import settings -from django.template import loader -from django.utils.timezone import get_current_timezone_name as timezone_get_current_timezone_name -from django.utils.timezone import now as timezone_now from typing import Any, Dict, Optional -from zerver.lib.send_email import send_email, FromAddress + +from django.conf import settings +from django.contrib.auth.signals import user_logged_in +from django.dispatch import receiver +from django.template import loader +from django.utils.timezone import \ + get_current_timezone_name as timezone_get_current_timezone_name +from django.utils.timezone import now as timezone_now + +from zerver.lib.send_email import FromAddress, send_email from zerver.models import UserProfile def get_device_browser(user_agent): diff --git a/zerver/storage.py b/zerver/storage.py index 51427fb3c6..e26439993d 100644 --- a/zerver/storage.py +++ b/zerver/storage.py @@ -2,7 +2,7 @@ import os import shutil -from typing import Dict, List, Any, Tuple +from typing import Any, Dict, List, Tuple from django.conf import settings from django.contrib.staticfiles.storage import ManifestStaticFilesStorage