views: Remove unused imports.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2019-02-02 14:53:22 -08:00 committed by Tim Abbott
parent 13b9e90a40
commit 4e21cc0152
32 changed files with 67 additions and 134 deletions

View File

@ -1,12 +1,12 @@
import logging
import stripe
from typing import Any, Dict, Optional, Tuple, cast
from typing import Any, Dict, cast
from django.core import signing
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.utils.timezone import now as timezone_now
from django.utils.translation import ugettext as _, ugettext as err_
from django.shortcuts import redirect, render
from django.utils.translation import ugettext as _
from django.shortcuts import render
from django.urls import reverse
from django.conf import settings
@ -14,9 +14,8 @@ from zerver.decorator import zulip_login_required, require_billing_access
from zerver.lib.json_encoder_for_html import JSONEncoderForHTML
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_error, json_success
from zerver.lib.validator import check_string, check_int, check_bool
from zerver.lib.timestamp import timestamp_to_datetime
from zerver.models import UserProfile, Realm
from zerver.lib.validator import check_string, check_int
from zerver.models import UserProfile
from corporate.lib.stripe import STRIPE_PUBLISHABLE_KEY, \
stripe_get_customer, get_seat_count, \
process_initial_upgrade, sign_string, \
@ -24,7 +23,7 @@ from corporate.lib.stripe import STRIPE_PUBLISHABLE_KEY, \
MIN_INVOICED_LICENSES, DEFAULT_INVOICE_DAYS_UNTIL_DUE, \
next_renewal_date, renewal_amount, \
add_plan_renewal_to_license_ledger_if_needed
from corporate.models import Customer, CustomerPlan, LicenseLedger, \
from corporate.models import Customer, CustomerPlan, \
get_active_plan
billing_logger = logging.getLogger('corporate.stripe')

View File

@ -5,7 +5,7 @@ from django.shortcuts import render
from django.template import loader
from zerver.lib.streams import get_stream_by_id
from zerver.models import Message, UserProfile, get_stream_recipient
from zerver.models import Message, get_stream_recipient
from zerver.lib.avatar import get_gravatar_url
from zerver.lib.response import json_success
from zerver.lib.timestamp import datetime_to_timestamp

View File

@ -2,7 +2,6 @@ from django.http import HttpRequest, HttpResponse
from zerver.models import UserProfile
from zerver.lib.actions import notify_attachment_update
from zerver.lib.validator import check_int
from zerver.lib.response import json_success
from zerver.lib.attachments import user_attachments, remove_attachment, \
access_attachment_by_id

View File

@ -1,16 +1,13 @@
from django.forms import Form
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.contrib.auth import authenticate, get_backends
from django.contrib.auth import authenticate
from django.contrib.auth.views import login as django_login_page, \
logout_then_login as django_logout_then_login
from django.contrib.auth.views import password_reset as django_password_reset
from django.urls import reverse
from zerver.decorator import authenticated_json_post_view, require_post, \
from zerver.decorator import require_post, \
process_client, do_login, log_view_func
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, \
HttpResponseNotFound
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.template.response import SimpleTemplateResponse
from django.middleware.csrf import get_token
from django.shortcuts import redirect, render
@ -48,7 +45,6 @@ import jwt
import logging
import requests
import time
import ujson
from two_factor.forms import BackupTokenForm
from two_factor.views import LoginView as BaseTwoFactorLoginView

View File

@ -1,7 +1,7 @@
from django.http import HttpResponse, HttpRequest
import re
from typing import Any, List, Dict, Optional, Tuple, Union
from typing import List, Optional, Tuple
from django.utils.translation import ugettext as _

View File

@ -1,10 +1,7 @@
from typing import Union, List, Dict, Optional, cast
import logging
from typing import Union, List, Dict
import ujson
from django.core.exceptions import ValidationError
from django.db import IntegrityError, connection
from django.db import IntegrityError
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
@ -15,14 +12,13 @@ from zerver.lib.actions import (try_add_realm_custom_profile_field,
try_update_realm_custom_profile_field,
do_update_user_custom_profile_data,
try_reorder_realm_custom_profile_fields,
check_remove_custom_profile_field_value,
notify_user_update_custom_profile_data)
check_remove_custom_profile_field_value)
from zerver.lib.response import json_success, json_error
from zerver.lib.types import ProfileFieldData
from zerver.lib.validator import (check_dict, check_list, check_int,
validate_field_data, check_capped_string)
from zerver.models import (custom_profile_fields_for_realm, UserProfile, CustomProfileFieldValue,
from zerver.models import (UserProfile,
CustomProfileField, custom_profile_fields_for_realm)
from zerver.lib.exceptions import JsonableError
from zerver.lib.users import validate_user_custom_profile_data

View File

@ -2,7 +2,6 @@ from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render, redirect
from django.views.decorators.http import require_GET
from django.views.decorators.csrf import csrf_exempt
from zerver.models import (
get_realm, get_user_by_delivery_email, get_realm_stream, Realm,
@ -19,8 +18,6 @@ import urllib
from confirmation.models import Confirmation, confirmation_url
import os
from typing import List, Dict, Any, Optional
import datetime
import subprocess
import ujson

View File

@ -1,4 +1,4 @@
from typing import Any, List, Dict, Optional, Iterator
from typing import List, Dict, Optional
from django.conf import settings
from django.urls import reverse
@ -6,20 +6,18 @@ from django.http import HttpResponseRedirect, HttpResponse, HttpRequest
from django.shortcuts import redirect, render
from django.utils import translation
from django.utils.cache import patch_cache_control
from itertools import zip_longest
from zerver.context_processors import get_realm_from_request
from zerver.decorator import zulip_login_required, process_client, \
from zerver.decorator import zulip_login_required, \
redirect_to_login
from zerver.forms import ToSForm
from zerver.lib.realm_icon import realm_icon_url
from zerver.models import Message, UserProfile, Stream, Subscription, Huddle, \
Recipient, Realm, UserMessage, DefaultStream, RealmEmoji, RealmDomain, \
RealmFilter, PreregistrationUser, UserActivity, \
UserPresence, get_stream_recipient, name_changes_disabled, email_to_username, \
get_realm_domains, get_usermessage_by_message_id
from zerver.models import Message, UserProfile, \
Realm, UserMessage, \
PreregistrationUser, \
get_stream_recipient, \
get_usermessage_by_message_id
from zerver.lib.events import do_events_register
from zerver.lib.actions import update_user_presence, do_change_tos_version, \
from zerver.lib.actions import do_change_tos_version, \
realm_user_count
from zerver.lib.avatar import avatar_url
from zerver.lib.i18n import get_language_list, get_language_name, \
@ -32,10 +30,8 @@ from zerver.lib.utils import statsd, generate_random_token
from two_factor.utils import default_device
import calendar
import datetime
import logging
import os
import re
import time
@zulip_login_required

View File

@ -1,18 +1,14 @@
from typing import Optional, Any, Dict, Tuple
from typing import Any, Dict, Tuple
from collections import OrderedDict
from django.views.generic import TemplateView
from django.conf import settings
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
from django.template import loader
from django.shortcuts import render
import lxml
import os
import random
import re
import ujson
from zerver.lib import bugdown
from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, HubotIntegration, \
WebhookIntegration, EmailIntegration
from zerver.lib.request import has_request_variables, REQ

View File

@ -1,19 +1,16 @@
from django.conf import settings
from django.core.exceptions import ValidationError
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from typing import List, Optional, Set
from zerver.decorator import require_realm_admin, to_non_negative_int, \
from zerver.decorator import require_realm_admin, \
require_non_guest_human_user
from zerver.lib.actions import do_invite_users, do_revoke_user_invite, do_resend_user_invite_email, \
get_default_subs, do_get_user_invites, do_create_multiuse_invite_link
do_get_user_invites, do_create_multiuse_invite_link
from zerver.lib.request import REQ, has_request_variables, JsonableError
from zerver.lib.response import json_success, json_error, json_response
from zerver.lib.streams import access_stream_by_name, access_stream_by_id
from zerver.lib.validator import check_string, check_list, check_bool, check_int
from zerver.lib.response import json_success, json_error
from zerver.lib.streams import access_stream_by_id
from zerver.lib.validator import check_list, check_int
from zerver.models import PreregistrationUser, Stream, UserProfile
import re

View File

@ -5,7 +5,7 @@ from django.core import validators
from django.core.exceptions import ValidationError
from django.db import connection, IntegrityError
from django.http import HttpRequest, HttpResponse
from typing import Dict, List, Set, Any, Callable, Iterable, \
from typing import Dict, List, Set, Any, Iterable, \
Optional, Tuple, Union, Sequence, cast
from zerver.lib.exceptions import JsonableError, ErrorCode
from zerver.lib.html_diff import highlight_html_differences
@ -54,7 +54,7 @@ from zerver.models import Message, UserProfile, Stream, Subscription, Client,\
from sqlalchemy import func
from sqlalchemy.sql import select, join, column, literal_column, literal, and_, \
or_, not_, union_all, alias, Selectable, Select, ColumnElement, table
or_, not_, union_all, alias, Selectable, ColumnElement, table
from dateutil.parser import parse as dateparser
import re

View File

@ -2,8 +2,6 @@
from django.http import HttpResponse, HttpRequest
from typing import Optional
import ujson
from django.utils.translation import ugettext as _
from zerver.lib.actions import do_mute_topic, do_unmute_topic
from zerver.lib.request import has_request_variables, REQ
@ -17,7 +15,7 @@ from zerver.lib.streams import (
check_for_exactly_one_stream_arg,
)
from zerver.lib.validator import check_int
from zerver.models import get_stream, Stream, UserProfile
from zerver.models import UserProfile
def mute_topic(user_profile: UserProfile,
stream_id: Optional[int],

View File

@ -6,7 +6,7 @@ from zerver.decorator import to_non_negative_int
from zerver.lib.actions import do_update_pointer
from zerver.lib.request import has_request_variables, JsonableError, REQ
from zerver.lib.response import json_success
from zerver.models import UserProfile, UserMessage, get_usermessage_by_message_id
from zerver.models import UserProfile, get_usermessage_by_message_id
def get_pointer_backend(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
return json_success({'pointer': user_profile.pointer})

View File

@ -1,9 +1,3 @@
import requests
import json
from typing import Optional
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
@ -12,8 +6,7 @@ from zerver.decorator import human_users_only
from zerver.lib.push_notifications import add_push_device_token, \
b64_to_hex, remove_push_device_token
from zerver.lib.request import has_request_variables, REQ, JsonableError
from zerver.lib.response import json_success, json_error
from zerver.lib.validator import check_string, check_list, check_bool
from zerver.lib.response import json_success
from zerver.models import PushDeviceToken, UserProfile
def validate_token(token_str: bytes, kind: int) -> None:

View File

@ -2,7 +2,7 @@ from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import \
has_request_variables, REQ, to_non_negative_int
has_request_variables, REQ
from zerver.lib.actions import do_add_reaction, do_add_reaction_legacy, \
do_remove_reaction, do_remove_reaction_legacy
from zerver.lib.emoji import check_emoji_request, check_valid_emoji, \

View File

@ -1,9 +1,7 @@
from typing import Any, Dict, Optional, List
from typing import Any, Dict, Optional
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.utils.translation import ugettext as _
from django.conf import settings
from django.core.exceptions import ValidationError
from django.views.decorators.http import require_GET

View File

@ -1,10 +1,9 @@
from django.conf import settings
from django.core.exceptions import ValidationError
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import RealmEmoji, UserProfile
from zerver.lib.emoji import check_emoji_admin, check_valid_emoji_name, check_valid_emoji
from zerver.lib.emoji import check_emoji_admin, check_valid_emoji_name
from zerver.lib.request import JsonableError, REQ, has_request_variables
from zerver.lib.response import json_success, json_error
from zerver.lib.actions import check_add_realm_emoji, do_remove_realm_emoji

View File

@ -1,14 +1,11 @@
from django.core.exceptions import ValidationError
from django.http import HttpRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.utils.translation import ugettext as _
from zerver.decorator import require_realm_admin
from zerver.lib.actions import do_add_realm_filter, do_remove_realm_filter
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_success, json_error
from zerver.lib.rest import rest_dispatch as _rest_dispatch
from zerver.lib.validator import check_string
from zerver.models import realm_filters_for_realm, UserProfile, RealmFilter

View File

@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
from typing import Any, List, Dict, Mapping, Optional
from typing import List, Dict, Optional
from django.utils.translation import ugettext as _
from django.conf import settings
from django.contrib.auth import authenticate, get_backends
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden, HttpResponse, HttpRequest
from django.http import HttpResponseRedirect, HttpResponse, HttpRequest
from django.shortcuts import redirect, render
from django.template import RequestContext, loader
from django.utils.timezone import now
from django.core.exceptions import ValidationError
from django.core import validators
from zerver.context_processors import get_realm_from_request
@ -18,19 +16,17 @@ from zerver.models import UserProfile, Realm, Stream, MultiuseInvite, \
DomainNotAllowedForRealmError, get_source_profile, EmailContainsPlusError, \
PreregistrationUser
from zerver.lib.send_email import send_email, FromAddress
from zerver.lib.events import do_events_register
from zerver.lib.actions import do_change_password, do_change_full_name, do_change_is_admin, \
from zerver.lib.actions import do_change_password, do_change_full_name, \
do_activate_user, do_create_user, do_create_realm, \
email_not_system_bot, validate_email_for_realm, \
validate_email_for_realm, \
do_set_user_display_setting, lookup_default_stream_groups, bulk_add_subscriptions
from zerver.forms import RegistrationForm, HomepageForm, RealmCreationForm, \
CreateUserForm, FindMyTeamForm, RealmRedirectForm
FindMyTeamForm, RealmRedirectForm
from django_auth_ldap.backend import LDAPBackend, _LDAPUser
from zerver.decorator import require_post, has_request_variables, \
JsonableError, REQ, do_login
from zerver.decorator import require_post, \
do_login
from zerver.lib.onboarding import setup_initial_streams, \
send_initial_realm_messages, setup_realm_internal_bots
from zerver.lib.response import json_success
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
from zerver.lib.timezone import get_all_timezones
from zerver.lib.users import get_accounts_for_email
@ -38,7 +34,7 @@ from zerver.lib.zephyr import compute_mit_user_fullname
from zerver.views.auth import create_preregistration_user, redirect_and_log_into_subdomain, \
redirect_to_deactivation_notice, get_safe_redirect_to
from zproject.backends import ldap_auth_enabled, password_auth_enabled, ZulipLDAPAuthBackend, \
from zproject.backends import ldap_auth_enabled, password_auth_enabled, \
ZulipLDAPExceptionOutsideDomain, email_auth_enabled
from confirmation.models import Confirmation, RealmCreationKey, ConfirmationKeyException, \
@ -46,9 +42,7 @@ from confirmation.models import Confirmation, RealmCreationKey, ConfirmationKeyE
render_confirmation_key_error
import logging
import requests
import smtplib
import ujson
import urllib

View File

@ -1,17 +1,16 @@
# System documented in https://zulip.readthedocs.io/en/latest/subsystems/logging.html
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from zerver.decorator import human_users_only, \
to_non_negative_int
from zerver.lib.bugdown import privacy_clean_markdown
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_success, json_error
from zerver.lib.response import json_success
from zerver.lib.queue import queue_json_publish
from zerver.lib.unminify import SourceMap
from zerver.lib.utils import statsd, statsd_key
@ -21,7 +20,6 @@ from zerver.models import UserProfile
import subprocess
import os
import logging
import ujson
js_source_map = None # type: Optional[SourceMap]

View File

@ -1,11 +1,9 @@
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.lib.bot_storage import (
get_bot_storage,
set_bot_storage,
remove_bot_storage,
get_keys_in_bot_storage,
is_key_in_bot_storage,
StateError,
)
from zerver.decorator import has_request_variables, REQ

View File

@ -5,7 +5,6 @@ from django.utils.translation import ugettext as _
from django.conf import settings
from django.db import transaction
from django.http import HttpRequest, HttpResponse
from django.utils.timezone import now as timezone_now
from zerver.lib.exceptions import JsonableError, ErrorCode
from zerver.lib.request import REQ, has_request_variables
@ -14,7 +13,7 @@ from zerver.decorator import authenticated_json_post_view, \
from zerver.lib.actions import bulk_remove_subscriptions, \
do_change_subscription_property, internal_prep_private_message, \
internal_prep_stream_message, \
gather_subscriptions, subscribed_to_stream, \
gather_subscriptions, \
bulk_add_subscriptions, do_send_messages, get_subscriber_emails, do_rename_stream, \
do_deactivate_stream, do_change_stream_invite_only, do_add_default_stream, \
do_change_stream_description, do_get_streams, \
@ -24,15 +23,15 @@ from zerver.lib.actions import bulk_remove_subscriptions, \
do_change_default_stream_group_description, do_change_default_stream_group_name, \
prep_stream_welcome_message, do_change_stream_announcement_only, \
do_delete_messages
from zerver.lib.response import json_success, json_error, json_response
from zerver.lib.response import json_success, json_error
from zerver.lib.streams import access_stream_by_id, access_stream_by_name, \
check_stream_name, check_stream_name_available, filter_stream_authorization, \
list_to_streams, access_stream_for_delete_or_update, access_default_stream_group_by_id
from zerver.lib.topic import get_topic_history_for_stream, messages_for_topic
from zerver.lib.validator import check_string, check_int, check_list, check_dict, \
check_bool, check_variable_type, check_capped_string, check_color, check_dict_only
from zerver.models import UserProfile, Stream, Realm, Subscription, \
Recipient, Message, UserMessage, get_recipient, get_stream, \
from zerver.models import UserProfile, Stream, \
UserMessage, \
get_system_bot, get_active_user
from collections import defaultdict

View File

@ -1,9 +1,7 @@
import logging
import ujson
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from django.conf import settings
from zerver.decorator import (
has_request_variables,

View File

@ -3,12 +3,10 @@
from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden
from django.conf import settings
from typing import Optional
from zerver.models import UserProfile, validate_attachment_request
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.thumbnail import generate_thumbnail_url
import urllib
def validate_thumbnail_request(user_profile: UserProfile, path: str) -> Optional[bool]:
# path here does not have a leading / as it is parsed from request hitting the

View File

@ -2,7 +2,7 @@
from django.http import HttpRequest, HttpResponse
from typing import List
from zerver.decorator import has_request_variables, REQ, JsonableError
from zerver.decorator import has_request_variables, REQ
from zerver.lib.actions import check_send_typing_notification, \
extract_recipients
from zerver.lib.response import json_success

View File

@ -1,11 +1,9 @@
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from typing import Callable
from confirmation.models import Confirmation, get_object_from_key, \
render_confirmation_key_error, ConfirmationKeyException
ConfirmationKeyException
from zerver.lib.actions import do_change_notification_settings, clear_scheduled_emails
from zerver.models import UserProfile, ScheduledEmail
from zerver.context_processors import common_context

View File

@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, FileResponse, \
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, \
HttpResponseNotFound
from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_success, json_error
from zerver.lib.upload import upload_message_image_from_request, get_local_file_path, \
get_signed_upload_url, get_realm_for_filename, check_upload_within_quota
from zerver.lib.validator import check_bool
get_signed_upload_url, check_upload_within_quota
from zerver.models import UserProfile, validate_attachment_request
from django.conf import settings
from sendfile import sendfile

View File

@ -4,7 +4,6 @@ from django.utils.translation import ugettext as _
from typing import List
from zerver.decorator import require_non_guest_human_user
from zerver.context_processors import get_realm_from_request
from zerver.lib.actions import check_add_user_group, do_update_user_group_name, \
do_update_user_group_description, bulk_add_members_to_user_group, \
remove_members_from_user_group, check_delete_user_group
@ -12,11 +11,10 @@ from zerver.lib.exceptions import JsonableError
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_success, json_error
from zerver.lib.users import user_ids_to_users
from zerver.lib.validator import check_list, check_string, check_int, \
check_short_string
from zerver.lib.validator import check_list, check_int
from zerver.lib.user_groups import access_user_group_by_id, get_memberships_of_users, \
get_user_group_members, user_groups_in_realm_serialized
from zerver.models import UserProfile, UserGroup, UserGroupMembership
from zerver.models import UserProfile
from zerver.views.streams import compose_views, FuncKwargPair
@require_non_guest_human_user

View File

@ -4,15 +4,14 @@ from django.utils.translation import ugettext as _
from django.conf import settings
from django.contrib.auth import authenticate, update_session_auth_hash
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.urls import reverse
from django.shortcuts import render
from zerver.decorator import has_request_variables, \
zulip_login_required, REQ, human_users_only
REQ, human_users_only
from zerver.lib.actions import do_change_password, do_change_notification_settings, \
do_change_enter_sends, do_regenerate_api_key, do_change_avatar_fields, \
do_set_user_display_setting, validate_email, do_change_user_delivery_email, \
do_start_email_change_process, check_change_full_name, do_change_user_delivery_email, \
do_start_email_change_process, check_change_full_name, \
get_available_notification_sounds
from zerver.lib.avatar import avatar_url
from zerver.lib.send_email import send_email, FromAddress
@ -22,8 +21,7 @@ from zerver.lib.upload import upload_avatar_image
from zerver.lib.validator import check_bool, check_string
from zerver.lib.request import JsonableError
from zerver.lib.timezone import get_all_timezones
from zerver.models import UserProfile, Realm, name_changes_disabled, \
EmailChangeStatus
from zerver.models import UserProfile, name_changes_disabled
from confirmation.models import get_object_from_key, render_confirmation_key_error, \
ConfirmationKeyException, Confirmation
from zproject.backends import email_belongs_to_ldap

View File

@ -1,6 +1,5 @@
from typing import Callable, Union, Optional, Dict, Any, List, Tuple
from typing import Union, Optional, Dict, Any, List
import os
import ujson
from django.http import HttpRequest, HttpResponse
@ -8,9 +7,8 @@ from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from django.shortcuts import redirect, render
from django.conf import settings
from django.core.exceptions import ValidationError
from zerver.decorator import require_realm_admin, zulip_login_required, \
from zerver.decorator import require_realm_admin, \
require_non_guest_human_user
from zerver.forms import CreateUserForm
from zerver.lib.actions import do_change_avatar_fields, do_change_bot_owner, \
@ -22,7 +20,7 @@ from zerver.lib.actions import do_change_avatar_fields, do_change_bot_owner, \
do_update_user_custom_profile_data, check_remove_custom_profile_field_value
from zerver.lib.avatar import avatar_url, get_gravatar_url, get_avatar_field
from zerver.lib.bot_config import set_bot_config
from zerver.lib.exceptions import JsonableError, CannotDeactivateLastUserError
from zerver.lib.exceptions import CannotDeactivateLastUserError
from zerver.lib.integrations import EMBEDDED_BOTS
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_error, json_success

View File

@ -1,11 +1,9 @@
from typing import Any, List, Dict, Optional, Callable, Tuple, Iterable, Sequence
from django.conf import settings
from django.http import HttpResponse, HttpRequest
from django.utils.translation import ugettext as _
from zerver.decorator import authenticated_json_view
from zerver.lib.ccache import make_ccache
from zerver.lib.request import has_request_variables, REQ, JsonableError
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_success, json_error
from zerver.lib.users import get_api_key
from zerver.models import UserProfile

View File

@ -1,13 +1,12 @@
from typing import Any, Dict, List, Optional, Union, cast
import datetime
import logging
from django.core.exceptions import ValidationError
from django.core.validators import validate_email, URLValidator
from django.db import IntegrityError, transaction
from django.http import HttpRequest, HttpResponse
from django.utils import timezone
from django.utils.timezone import utc as timezone_utc, now as timezone_now
from django.utils.timezone import utc as timezone_utc
from django.utils.translation import ugettext as _, ugettext as err_
from django.views.decorators.csrf import csrf_exempt
@ -20,7 +19,7 @@ from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_error, json_success
from zerver.lib.validator import check_int, check_string, \
check_capped_string, check_string_fixed_length, check_float, check_none_or, \
check_dict, check_dict_only, check_list
check_dict_only, check_list
from zerver.models import UserProfile
from zerver.views.push_notifications import validate_token
from zilencer.models import RemotePushDeviceToken, RemoteZulipServer, \