python: Fix mypy no_implicit_reexport errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-07-16 13:11:10 -07:00 committed by Tim Abbott
parent 1a985911ef
commit fb3ddf50d4
86 changed files with 168 additions and 142 deletions

View File

@ -5,7 +5,7 @@ from datetime import datetime, timedelta
from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union
from django.conf import settings
from django.db import connection
from django.db import connection, models
from django.db.models import F
from psycopg2.sql import SQL, Composable, Identifier, Literal
@ -20,15 +20,7 @@ from analytics.models import (
)
from zerver.lib.logging_util import log_to_file
from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, floor_to_hour, verify_UTC
from zerver.models import (
Message,
Realm,
RealmAuditLog,
Stream,
UserActivityInterval,
UserProfile,
models,
)
from zerver.models import Message, Realm, RealmAuditLog, Stream, UserActivityInterval, UserProfile
## Logging setup ##

View File

@ -5,7 +5,6 @@ import orjson
from django.http import HttpResponse
from django.utils.timezone import now as timezone_now
from analytics.views.support import get_org_type_display_name
from corporate.lib.stripe import add_months, update_sponsorship_status
from corporate.models import Customer, CustomerPlan, LicenseLedger, get_customer_by_realm
from zerver.lib.actions import (
@ -21,6 +20,7 @@ from zerver.models import (
Realm,
UserMessage,
UserProfile,
get_org_type_display_name,
get_realm,
)

View File

@ -9,7 +9,7 @@ from django.db import connection
from django.db.models.query import QuerySet
from django.template import loader
from django.urls import reverse
from jinja2 import Markup as mark_safe
from jinja2.utils import Markup as mark_safe
eastern_tz = pytz.timezone("US/Eastern")

View File

@ -10,7 +10,7 @@ from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.template import loader
from django.utils.timezone import now as timezone_now
from jinja2 import Markup as mark_safe
from jinja2.utils import Markup as mark_safe
from psycopg2.sql import SQL, Composable, Literal
from analytics.lib.counts import COUNT_STATS
@ -22,11 +22,11 @@ from analytics.views.activity_common import (
realm_stats_link,
remote_installation_stats_link,
)
from analytics.views.support import get_org_type_display_name, get_plan_name
from analytics.views.support import get_plan_name
from zerver.decorator import require_server_admin
from zerver.lib.request import has_request_variables
from zerver.lib.timestamp import timestamp_to_datetime
from zerver.models import Realm, UserActivityInterval, UserProfile
from zerver.models import Realm, UserActivityInterval, UserProfile, get_org_type_display_name
if settings.BILLING_ENABLED:
from corporate.lib.stripe import (

View File

@ -44,8 +44,6 @@ if settings.BILLING_ENABLED:
attach_discount_to_realm,
downgrade_at_the_end_of_billing_cycle,
downgrade_now_without_creating_additional_invoices,
get_current_plan_by_realm,
get_customer_by_realm,
get_discount_for_realm,
get_latest_seat_count,
make_end_of_cycle_updates_if_needed,
@ -53,6 +51,7 @@ if settings.BILLING_ENABLED:
update_sponsorship_status,
void_all_open_invoices,
)
from corporate.models import get_current_plan_by_realm, get_customer_by_realm
def get_plan_name(plan_type: int) -> str:

View File

@ -32,7 +32,7 @@ no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = false
no_implicit_reexport = false
no_implicit_reexport = true
strict_equality = true
# Display the codes needed for # type: ignore[code] annotations.
@ -41,6 +41,10 @@ show_error_codes = true
# Warn of unreachable or redundant code.
warn_unreachable = true
[[tool.mypy.overrides]]
module = ["zproject.configured_settings", "zproject.settings"]
no_implicit_reexport = false
[[tool.mypy.overrides]]
module = [
"ahocorasick.*",

View File

@ -33,12 +33,13 @@ from zerver.lib.exceptions import (
OrganizationAdministratorRequired,
OrganizationMemberRequired,
OrganizationOwnerRequired,
RateLimited,
RealmDeactivatedError,
UnsupportedWebhookEventType,
UserDeactivatedError,
)
from zerver.lib.queue import queue_json_publish
from zerver.lib.rate_limiter import RateLimited, RateLimitedIPAddr, RateLimitedUser
from zerver.lib.rate_limiter import RateLimitedIPAddr, RateLimitedUser
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_method_not_allowed, json_success, json_unauthorized
from zerver.lib.subdomains import get_subdomain, user_matches_subdomain

View File

@ -14,15 +14,15 @@ from django.http import HttpRequest
from django.urls import reverse
from django.utils.http import urlsafe_base64_encode
from django.utils.translation import gettext as _
from jinja2 import Markup as mark_safe
from jinja2.utils import Markup as mark_safe
from two_factor.forms import AuthenticationTokenForm as TwoFactorAuthenticationTokenForm
from two_factor.utils import totp_digits
from zerver.lib.actions import do_change_password, email_not_system_bot
from zerver.lib.email_validation import email_allowed_for_realm
from zerver.lib.exceptions import JsonableError, RateLimited
from zerver.lib.name_restrictions import is_disposable_domain, is_reserved_subdomain
from zerver.lib.rate_limiter import RateLimited, RateLimitedObject
from zerver.lib.request import JsonableError
from zerver.lib.rate_limiter import RateLimitedObject
from zerver.lib.send_email import FromAddress, send_email
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
from zerver.lib.users import check_full_name

View File

@ -40,8 +40,8 @@ from psycopg2.extras import execute_values
from psycopg2.sql import SQL
from typing_extensions import TypedDict
from analytics.lib.counts import COUNT_STATS, RealmCount, do_increment_logging_stat
from analytics.models import StreamCount
from analytics.lib.counts import COUNT_STATS, do_increment_logging_stat
from analytics.models import RealmCount, StreamCount
from confirmation import settings as confirmation_settings
from confirmation.models import (
Confirmation,
@ -70,6 +70,7 @@ from zerver.lib.cache import (
delete_user_profile_caches,
display_recipient_cache_key,
flush_user_profile,
get_stream_cache_key,
to_dict_cache_key_id,
user_profile_by_api_key_cache_key,
user_profile_delivery_email_cache_key,
@ -239,7 +240,6 @@ from zerver.models import (
get_realm_playgrounds,
get_stream,
get_stream_by_id_in_realm,
get_stream_cache_key,
get_system_bot,
get_user_by_delivery_email,
get_user_by_id_in_realm_including_cross_realm,

View File

@ -2,7 +2,7 @@ from typing import Any, Dict, List
from django.utils.translation import gettext as _
from zerver.lib.request import JsonableError
from zerver.lib.exceptions import JsonableError
from zerver.lib.upload import delete_message_image
from zerver.models import Attachment, UserProfile

View File

@ -16,6 +16,7 @@ from zerver.lib.cache import (
cache_set_many,
get_remote_cache_requests,
get_remote_cache_time,
get_stream_cache_key,
to_dict_cache_key_id,
user_profile_by_api_key_cache_key,
user_profile_cache_key,
@ -30,7 +31,6 @@ from zerver.models import (
Stream,
UserProfile,
get_client_cache_key,
get_stream_cache_key,
huddle_hash_cache_key,
)

View File

@ -5,8 +5,7 @@ from typing import Tuple
import orjson
from django.utils.translation import gettext as _
from zerver.lib.exceptions import OrganizationAdministratorRequired
from zerver.lib.request import JsonableError
from zerver.lib.exceptions import JsonableError, OrganizationAdministratorRequired
from zerver.lib.storage import static_path
from zerver.lib.upload import upload_backend
from zerver.models import Reaction, Realm, RealmEmoji, UserProfile

View File

@ -23,6 +23,7 @@ from zerver.lib.alert_words import user_alert_words
from zerver.lib.avatar import avatar_url
from zerver.lib.bot_config import load_bot_config_template
from zerver.lib.compatibility import is_outdated_server
from zerver.lib.exceptions import JsonableError
from zerver.lib.external_accounts import DEFAULT_EXTERNAL_ACCOUNTS
from zerver.lib.hotspots import get_next_hotspots
from zerver.lib.integrations import EMBEDDED_BOTS, WEBHOOK_INTEGRATIONS
@ -41,7 +42,6 @@ from zerver.lib.presence import get_presence_for_user, get_presences_for_realm
from zerver.lib.push_notifications import push_notifications_enabled
from zerver.lib.realm_icon import realm_icon_url
from zerver.lib.realm_logo import get_realm_logo_source, get_realm_logo_url
from zerver.lib.request import JsonableError
from zerver.lib.soft_deactivation import reactivate_user_if_soft_deactivated
from zerver.lib.stream_subscription import handle_stream_notifications_compatibility
from zerver.lib.topic import TOPIC_NAME

View File

@ -4,6 +4,7 @@ import multiprocessing
import os
import secrets
import shutil
from mimetypes import guess_type
from typing import Any, Dict, Iterable, List, Optional, Tuple
import orjson
@ -31,7 +32,7 @@ from zerver.lib.message import get_last_message_id
from zerver.lib.server_initialization import create_internal_realm, server_initialized
from zerver.lib.streams import render_stream_description
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.upload import BadImageError, get_bucket, guess_type, sanitize_name
from zerver.lib.upload import BadImageError, get_bucket, sanitize_name
from zerver.lib.utils import generate_api_key, process_list_in_batches
from zerver.models import (
AlertWord,

View File

@ -14,7 +14,8 @@ from django.utils.translation import gettext as _
from psycopg2.sql import SQL
from typing_extensions import TypedDict
from analytics.lib.counts import COUNT_STATS, RealmCount
from analytics.lib.counts import COUNT_STATS
from analytics.models import RealmCount
from zerver.lib.avatar import get_avatar_field
from zerver.lib.cache import (
cache_with_key,
@ -22,15 +23,11 @@ from zerver.lib.cache import (
to_dict_cache_key,
to_dict_cache_key_id,
)
from zerver.lib.display_recipient import (
DisplayRecipientT,
UserDisplayRecipient,
bulk_fetch_display_recipients,
)
from zerver.lib.display_recipient import bulk_fetch_display_recipients
from zerver.lib.exceptions import JsonableError
from zerver.lib.markdown import MessageRenderingResult, markdown_convert, topic_links
from zerver.lib.markdown import version as markdown_version
from zerver.lib.mention import MentionData
from zerver.lib.request import JsonableError
from zerver.lib.stream_subscription import (
get_stream_subscriptions_for_user,
get_subscribed_stream_recipient_ids_for_user,
@ -39,6 +36,7 @@ from zerver.lib.stream_subscription import (
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.topic import DB_TOPIC_NAME, MESSAGE__TOPIC, TOPIC_LINKS, TOPIC_NAME
from zerver.lib.topic_mutes import build_topic_mute_checker, topic_is_muted
from zerver.lib.types import DisplayRecipientT, UserDisplayRecipient
from zerver.models import (
MAX_TOPIC_NAME_LENGTH,
Message,

View File

@ -4,7 +4,7 @@ from typing import Any, Callable, Collection, Dict, Iterable, List, Mapping, Opt
from django.conf import settings
from django.utils.translation import gettext as _
from zerver.lib.request import JsonableError
from zerver.lib.exceptions import JsonableError
from zerver.lib.topic import RESOLVED_TOPIC_PREFIX, get_topic_from_message_info
stop_words_list: Optional[List[str]] = None

View File

@ -10,8 +10,8 @@ from django.utils.translation import gettext as _
from requests import Response
from version import ZULIP_VERSION
from zerver.decorator import JsonableError
from zerver.lib.actions import check_send_message
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import MessageDict
from zerver.lib.outgoing_http import OutgoingSession
from zerver.lib.queue import retry_event

View File

@ -5,9 +5,8 @@ from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from typing_extensions import TypedDict
from zerver.lib.exceptions import StreamAdministratorRequired
from zerver.lib.exceptions import JsonableError, StreamAdministratorRequired
from zerver.lib.markdown import markdown_convert
from zerver.lib.request import JsonableError
from zerver.lib.stream_subscription import get_active_subscriptions_for_stream_id
from zerver.models import (
DefaultStreamGroup,

View File

@ -24,7 +24,7 @@ from django.core.signing import BadSignature, TimestampSigner
from django.http import HttpRequest
from django.urls import reverse
from django.utils.translation import gettext as _
from jinja2 import Markup as mark_safe
from jinja2.utils import Markup as mark_safe
from PIL import ExifTags, Image, ImageOps
from PIL.GifImagePlugin import GifImageFile
from PIL.Image import DecompressionBombError

View File

@ -18,8 +18,7 @@ from zerver.lib.cache import (
user_profile_by_id_cache_key,
user_profile_cache_key_id,
)
from zerver.lib.exceptions import OrganizationAdministratorRequired
from zerver.lib.request import JsonableError
from zerver.lib.exceptions import JsonableError, OrganizationAdministratorRequired
from zerver.lib.timezone import canonicalize_timezone
from zerver.models import (
CustomProfileField,

View File

@ -1,8 +1,10 @@
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import CommandError
from zerver.lib.actions import do_deactivate_user, get_active_bots_owned_by_user
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.sessions import user_sessions

View File

@ -1,8 +1,10 @@
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import CommandError
from zerver.lib.actions import do_delete_user, get_active_bots_owned_by_user
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):

View File

@ -2,8 +2,10 @@ import sys
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import CommandError
from zerver.lib.actions import do_add_linkifier, do_remove_linkifier
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.models import linkifiers_for_realm

View File

@ -1,9 +1,10 @@
from typing import Any
from django.core.management.base import CommandError
from django.db import ProgrammingError
from confirmation.models import generate_realm_creation_url
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.models import Realm

View File

@ -1,7 +1,9 @@
from argparse import ArgumentParser
from typing import Any
from zerver.lib.management import CommandError, ZulipBaseCommand
from django.core.management.base import CommandError
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.rate_limiter import RateLimitedUser
from zerver.models import UserProfile, get_user_profile_by_api_key

View File

@ -3,10 +3,11 @@ from argparse import ArgumentParser
from typing import Any
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from django.db.utils import IntegrityError
from zerver.lib.domains import validate_domain
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.models import RealmDomain, get_realm_domains

View File

@ -2,8 +2,9 @@ from argparse import ArgumentParser
from typing import Any
from django.conf import settings
from django.core.management.base import CommandError
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.send_email import send_custom_email
from zerver.models import Realm, UserProfile

View File

@ -2,9 +2,10 @@ from argparse import ArgumentParser
from typing import Any, List
from django.contrib.auth.tokens import default_token_generator
from django.core.management.base import CommandError
from zerver.forms import generate_password_reset_url
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.send_email import FromAddress, send_email
from zerver.models import UserProfile

View File

@ -1,8 +1,10 @@
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import CommandError
from zerver.lib.actions import do_send_realm_reactivation_email
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):

View File

@ -7,11 +7,11 @@ from typing import Optional
import orjson
from django.conf import settings
from django.core.management.base import CommandParser
from django.core.management.base import CommandError, CommandParser
from zerver.lib.email_mirror import mirror_email_message
from zerver.lib.email_mirror_helpers import encode_email_address
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.models import Realm, get_realm, get_stream
# This command loads an email from a specified file and sends it

View File

@ -3,10 +3,10 @@ from typing import Dict, Optional, Union
import orjson
from django.conf import settings
from django.core.management.base import CommandParser
from django.core.management.base import CommandError, CommandParser
from django.test import Client
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.webhooks.common import standardize_headers
from zerver.models import get_realm

View File

@ -2,7 +2,7 @@ from django.db import migrations, models
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from zerver.lib.actions import render_stream_description
from zerver.lib.streams import render_stream_description
def render_all_stream_descriptions(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:

View File

@ -54,11 +54,10 @@ from zerver.lib.email_validation import (
get_realm_email_validator,
validate_email_is_valid,
)
from zerver.lib.exceptions import RateLimited
from zerver.lib.exceptions import JsonableError, RateLimited
from zerver.lib.initial_password import initial_password
from zerver.lib.mobile_auth_otp import otp_decrypt_api_key
from zerver.lib.rate_limiter import add_ratelimit_rule, remove_ratelimit_rule
from zerver.lib.request import JsonableError
from zerver.lib.storage import static_path
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import (
@ -67,10 +66,10 @@ from zerver.lib.test_helpers import (
load_subdomain_token,
use_s3_backend,
)
from zerver.lib.types import Validator
from zerver.lib.upload import MEDIUM_AVATAR_SIZE, resize_avatar
from zerver.lib.users import get_all_api_keys
from zerver.lib.validator import (
Validator,
check_bool,
check_dict_only,
check_int,

View File

@ -55,11 +55,11 @@ from zerver.lib.request import (
from zerver.lib.response import json_response, json_success
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import DummyHandler, HostRequestMock
from zerver.lib.types import Validator
from zerver.lib.user_agent import parse_user_agent
from zerver.lib.users import get_api_key
from zerver.lib.utils import generate_api_key, has_api_key_format
from zerver.lib.validator import (
Validator,
check_bool,
check_capped_string,
check_color,

View File

@ -18,7 +18,6 @@ from zerver.lib.actions import (
ensure_stream,
)
from zerver.lib.email_mirror import (
ZulipEmailForwardError,
create_missed_message_address,
filter_footer,
get_missed_message_token_from_address,
@ -31,6 +30,7 @@ from zerver.lib.email_mirror import (
strip_from_subject,
)
from zerver.lib.email_mirror_helpers import (
ZulipEmailForwardError,
decode_email_address,
encode_email_address,
get_email_gateway_message_string_from_address,

View File

@ -15,11 +15,11 @@ from zerver.lib.actions import (
do_update_user_presence,
)
from zerver.lib.event_schema import check_restart_event
from zerver.lib.events import fetch_initial_state_data, get_raw_user_data
from zerver.lib.events import fetch_initial_state_data
from zerver.lib.exceptions import AccessDeniedError
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import HostRequestMock, queries_captured, stub_event_queue_user_events
from zerver.lib.users import get_api_key
from zerver.lib.users import get_api_key, get_raw_user_data
from zerver.models import (
Realm,
UserMessage,

View File

@ -8,6 +8,7 @@ import orjson
import pytz
from django.conf import settings
from django.http import HttpResponse
from django.test import override_settings
from django.utils.timezone import now as timezone_now
from corporate.models import Customer, CustomerPlan
@ -20,7 +21,7 @@ from zerver.lib.home import (
)
from zerver.lib.soft_deactivation import do_soft_deactivate_users
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import get_user_messages, override_settings, queries_captured
from zerver.lib.test_helpers import get_user_messages, queries_captured
from zerver.models import (
DefaultStream,
Realm,

View File

@ -9,9 +9,9 @@ from django.utils.html import escape
from pyoembed.providers import get_provider
from requests.exceptions import ConnectionError
from zerver.lib.actions import queue_json_publish
from zerver.lib.cache import NotFoundInCache, cache_set, preview_url_cache_key
from zerver.lib.camo import get_camo_url
from zerver.lib.queue import queue_json_publish
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import mock_queue_publish
from zerver.lib.url_preview.oembed import get_oembed_data, strip_cdata

View File

@ -8,12 +8,13 @@ from unittest.mock import MagicMock, call, patch
from django.apps import apps
from django.conf import settings
from django.core.management import call_command, find_commands
from django.core.management.base import CommandError
from django.test import override_settings
from django.utils.timezone import now as timezone_now
from confirmation.models import RealmCreationKey, generate_realm_creation_url
from zerver.lib.actions import do_add_reaction, do_create_user
from zerver.lib.management import CommandError, ZulipBaseCommand, check_config
from zerver.lib.management import ZulipBaseCommand, check_config
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import most_recent_message, stdout_suppressed
from zerver.models import (

View File

@ -22,7 +22,7 @@ from zerver.lib.alert_words import get_alert_word_automaton
from zerver.lib.camo import get_camo_url
from zerver.lib.create_user import create_user
from zerver.lib.emoji import get_emoji_url
from zerver.lib.exceptions import MarkdownRenderingException
from zerver.lib.exceptions import JsonableError, MarkdownRenderingException
from zerver.lib.markdown import (
MarkdownListPreprocessor,
MessageRenderingResult,
@ -47,7 +47,6 @@ from zerver.lib.mention import (
possible_user_group_mentions,
)
from zerver.lib.message import render_markdown
from zerver.lib.request import JsonableError
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.tex import render_tex
from zerver.lib.user_groups import create_user_group

View File

@ -3,11 +3,10 @@ from unittest import mock
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import get_client
from zerver.lib.push_notifications import get_apns_badge_count, get_apns_badge_count_future
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import mock_queue_publish
from zerver.models import Subscription, UserPresence
from zerver.models import Subscription, UserPresence, get_client
from zerver.tornado.event_queue import maybe_enqueue_notifications

View File

@ -20,6 +20,7 @@ from zerver.lib.actions import (
do_update_message,
)
from zerver.lib.avatar import avatar_url
from zerver.lib.exceptions import JsonableError
from zerver.lib.mention import MentionData
from zerver.lib.message import (
MessageDict,
@ -29,7 +30,6 @@ from zerver.lib.message import (
update_first_visible_message_id,
)
from zerver.lib.narrow import build_narrow_filter, is_web_public_compatible
from zerver.lib.request import JsonableError
from zerver.lib.sqlalchemy_utils import get_sqlalchemy_connection
from zerver.lib.streams import StreamDict, create_streams_if_needed, get_public_streams_queryset
from zerver.lib.test_classes import ZulipTestCase

View File

@ -10,7 +10,6 @@ from django.http import HttpResponse
from django.test import override_settings
from django.utils.timezone import now as timezone_now
from zerver.decorator import JsonableError
from zerver.lib.actions import (
build_message_send_dict,
check_message,
@ -35,6 +34,7 @@ from zerver.lib.actions import (
)
from zerver.lib.addressee import Addressee
from zerver.lib.cache import cache_delete, get_stream_cache_key
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import MessageDict, get_raw_unread_data, get_recent_private_conversations
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import (

View File

@ -1,8 +1,8 @@
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import do_change_stream_invite_only, get_client
from zerver.lib.actions import do_change_stream_invite_only
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, UserMessage, get_realm, get_stream
from zerver.models import Message, UserMessage, get_client, get_realm, get_stream
class TopicHistoryTest(ZulipTestCase):

View File

@ -3,13 +3,14 @@ from typing import List
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import get_active_presence_idle_user_ids, get_client
from zerver.lib.actions import get_active_presence_idle_user_ids
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import (
Message,
UserPresence,
UserProfile,
bulk_get_huddle_user_ids,
get_client,
get_huddle_user_ids,
)

View File

@ -30,16 +30,15 @@ from zerver.lib.actions import (
do_regenerate_api_key,
do_update_message_flags,
)
from zerver.lib.avatar import absolute_avatar_url
from zerver.lib.exceptions import JsonableError
from zerver.lib.push_notifications import (
APNsContext,
DeviceToken,
absolute_avatar_url,
b64_to_hex,
datetime_to_timestamp,
get_apns_badge_count,
get_apns_badge_count_future,
get_apns_context,
get_display_recipient,
get_message_payload_apns,
get_message_payload_gcm,
get_mobile_push_content,
@ -52,18 +51,18 @@ from zerver.lib.push_notifications import (
send_android_push_notification_to_user,
send_apple_push_notification,
send_notifications_to_bouncer,
send_to_push_bouncer,
)
from zerver.lib.remote_server import (
PushNotificationBouncerException,
PushNotificationBouncerRetryLaterError,
build_analytics_data,
send_analytics_to_remote_server,
send_to_push_bouncer,
)
from zerver.lib.request import JsonableError
from zerver.lib.soft_deactivation import do_soft_deactivate_users
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import mock_queue_publish
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.user_groups import create_user_group
from zerver.models import (
Message,
@ -75,6 +74,7 @@ from zerver.models import (
Subscription,
UserMessage,
get_client,
get_display_recipient,
get_realm,
get_stream,
receives_offline_push_notifications,

View File

@ -11,8 +11,8 @@ from zerver.lib.actions import (
)
from zerver.lib.cache import cache_get, to_dict_cache_key_id
from zerver.lib.emoji import emoji_name_to_emoji_code
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import extract_message_dict
from zerver.lib.request import JsonableError
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import zulip_reaction_info
from zerver.models import Message, Reaction, RealmEmoji, UserMessage, get_realm

View File

@ -20,7 +20,6 @@ from confirmation import settings as confirmation_settings
from confirmation.models import (
Confirmation,
ConfirmationKeyException,
MultiuseInvite,
confirmation_url,
create_confirmation_link,
generate_key,
@ -47,7 +46,6 @@ from zerver.lib.actions import (
do_invite_users,
do_set_realm_property,
get_default_streams_for_realm,
get_stream,
)
from zerver.lib.email_notifications import enqueue_welcome_emails, followup_day2_email_delay
from zerver.lib.initial_password import initial_password
@ -88,6 +86,7 @@ from zerver.models import (
CustomProfileFieldValue,
DefaultStream,
Message,
MultiuseInvite,
PreregistrationUser,
Realm,
RealmAuditLog,
@ -99,6 +98,7 @@ from zerver.models import (
UserProfile,
flush_per_request_caches,
get_realm,
get_stream,
get_system_bot,
get_user,
get_user_by_delivery_email,

View File

@ -12,6 +12,7 @@ from django.utils.timezone import now as timezone_now
from requests.models import PreparedRequest
from zerver.data_import.import_util import (
ZerverFieldsT,
build_defaultstream,
build_recipient,
build_subscription,
@ -23,7 +24,6 @@ from zerver.data_import.slack import (
AddedChannelsT,
AddedMPIMsT,
DMMembersT,
ZerverFieldsT,
channel_message_to_zerver_message,
channels_to_zerver_stream,
convert_slack_workspace_messages,

View File

@ -10,13 +10,10 @@ from django.core.exceptions import ValidationError
from django.http import HttpResponse
from django.utils.timezone import now as timezone_now
from zerver.decorator import JsonableError
from zerver.lib.actions import (
bulk_add_subscriptions,
bulk_get_subscriber_user_ids,
bulk_remove_subscriptions,
can_access_stream_user_ids,
create_stream_if_needed,
do_add_default_stream,
do_add_streams_to_default_stream_group,
do_change_default_stream_group_description,
@ -39,11 +36,11 @@ from zerver.lib.actions import (
gather_subscriptions_helper,
get_average_weekly_stream_traffic,
get_default_streams_for_realm,
get_stream,
lookup_default_stream_groups,
round_to_2_significant_digits,
validate_user_access_to_subscribers_helper,
)
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import aggregate_unread_data, get_raw_unread_data
from zerver.lib.response import json_success
from zerver.lib.stream_subscription import (
@ -56,6 +53,8 @@ from zerver.lib.streams import (
access_stream_by_id,
access_stream_by_name,
can_access_stream_history,
can_access_stream_user_ids,
create_stream_if_needed,
create_streams_if_needed,
filter_stream_authorization,
list_to_streams,
@ -83,6 +82,7 @@ from zerver.models import (
get_client,
get_default_stream_groups,
get_realm,
get_stream,
get_user,
get_user_profile_by_id_in_realm,
)

View File

@ -38,11 +38,11 @@ from typing_extensions import TypedDict
from version import API_FEATURE_LEVEL, ZULIP_VERSION
from zerver.decorator import cachify
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import MessageDict
from zerver.lib.narrow import build_narrow_filter
from zerver.lib.notification_data import UserMessageNotificationsData
from zerver.lib.queue import queue_json_publish, retry_event
from zerver.lib.request import JsonableError
from zerver.lib.utils import statsd
from zerver.middleware import async_request_timer_restart
from zerver.tornado.autoreload import add_reload_hook

View File

@ -5,9 +5,9 @@ import orjson
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables, internal_notify_view, process_client
from zerver.decorator import internal_notify_view, process_client
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import get_request_notes
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.validator import (
check_bool,

View File

@ -27,7 +27,6 @@ from two_factor.views import LoginView as BaseTwoFactorLoginView
from confirmation.models import (
Confirmation,
ConfirmationKeyException,
MultiuseInvite,
create_confirmation_link,
get_object_from_key,
)
@ -44,6 +43,7 @@ from zerver.forms import (
from zerver.lib.exceptions import (
AuthenticationFailedError,
InvalidSubdomainError,
JsonableError,
PasswordAuthDisabledError,
PasswordResetRequiredError,
RealmDeactivatedError,
@ -53,7 +53,7 @@ from zerver.lib.mobile_auth_otp import otp_encrypt_api_key
from zerver.lib.push_notifications import push_notifications_enabled
from zerver.lib.pysa import mark_sanitized
from zerver.lib.realm_icon import realm_icon_url
from zerver.lib.request import REQ, JsonableError, get_request_notes, has_request_variables
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.sessions import set_expirable_session_var
from zerver.lib.subdomains import get_subdomain, is_subdomain_root_or_alias
@ -64,6 +64,7 @@ from zerver.lib.users import get_api_key
from zerver.lib.utils import has_api_key_format
from zerver.lib.validator import validate_login_email
from zerver.models import (
MultiuseInvite,
PreregistrationUser,
Realm,
UserProfile,

View File

@ -11,10 +11,11 @@ from zerver.decorator import do_login, require_post
from zerver.lib.exceptions import (
AuthenticationFailedError,
InvalidSubdomainError,
JsonableError,
RealmDeactivatedError,
UserDeactivatedError,
)
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.subdomains import get_subdomain
from zerver.lib.users import get_api_key

View File

@ -13,8 +13,8 @@ from zerver.lib.actions import (
do_revoke_multi_use_invite,
do_revoke_user_invite,
)
from zerver.lib.exceptions import OrganizationOwnerRequired
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.exceptions import JsonableError, OrganizationOwnerRequired
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.streams import access_stream_by_id
from zerver.lib.validator import check_int, check_list

View File

@ -7,12 +7,11 @@ from django.http import HttpRequest, HttpResponse
from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import check_update_message, do_delete_messages
from zerver.lib.exceptions import JsonableError
from zerver.lib.html_diff import highlight_html_differences
from zerver.lib.message import access_message
from zerver.lib.request import get_request_notes
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.topic import LEGACY_PREV_TOPIC, REQ_topic

View File

@ -32,13 +32,12 @@ from sqlalchemy.sql import (
from sqlalchemy.types import Boolean, Integer, Text
from zerver.context_processors import get_valid_realm_from_request
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import recipient_for_user_profiles
from zerver.lib.addressee import get_user_profiles, get_user_profiles_by_ids
from zerver.lib.exceptions import ErrorCode, JsonableError, MissingAuthenticationError
from zerver.lib.message import get_first_visible_message_id, messages_for_ids
from zerver.lib.narrow import is_web_public_compatible, is_web_public_narrow
from zerver.lib.request import get_request_notes
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.sqlalchemy_utils import get_sqlalchemy_connection
from zerver.lib.streams import (

View File

@ -3,14 +3,13 @@ from typing import List, Optional
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import (
do_mark_all_as_read,
do_mark_stream_messages_as_read,
do_update_message_flags,
)
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import get_request_notes
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.streams import access_stream_by_id
from zerver.lib.topic import user_message_exists_for_topic

View File

@ -8,7 +8,6 @@ from django.http import HttpRequest, HttpResponse
from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import (
check_schedule_message,
check_send_message,
@ -20,7 +19,7 @@ from zerver.lib.actions import (
)
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import render_markdown
from zerver.lib.request import get_request_notes
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.timestamp import convert_to_UTC
from zerver.lib.topic import REQ_topic

View File

@ -8,8 +8,9 @@ from django.utils.translation import gettext as _
from zerver.decorator import human_users_only
from zerver.lib.actions import do_update_user_status, update_user_presence
from zerver.lib.exceptions import JsonableError
from zerver.lib.presence import get_presence_for_user, get_presence_response
from zerver.lib.request import REQ, JsonableError, get_request_notes, has_request_variables
from zerver.lib.request import REQ, get_request_notes, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.validator import check_bool, check_capped_string

View File

@ -3,12 +3,13 @@ from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import human_users_only
from zerver.lib.exceptions import JsonableError
from zerver.lib.push_notifications import (
add_push_device_token,
b64_to_hex,
remove_push_device_token,
)
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.models import PushDeviceToken, UserProfile

View File

@ -4,11 +4,11 @@ from django.db import transaction
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import check_add_reaction, do_remove_reaction
from zerver.lib.emoji import emoji_name_to_emoji_code
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import access_message
from zerver.lib.request import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.models import Reaction, UserProfile

View File

@ -18,9 +18,9 @@ from zerver.lib.actions import (
do_set_realm_property,
do_set_realm_signup_notifications_stream,
)
from zerver.lib.exceptions import OrganizationOwnerRequired
from zerver.lib.exceptions import JsonableError, OrganizationOwnerRequired
from zerver.lib.i18n import get_available_language_codes
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.retention import parse_message_retention_days
from zerver.lib.streams import access_stream_by_id

View File

@ -10,7 +10,8 @@ from zerver.lib.emoji import (
check_valid_emoji_name,
name_to_codepoint,
)
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.models import RealmEmoji, UserProfile

View File

@ -6,8 +6,8 @@ from django.utils.translation import gettext as _
from zerver.decorator import require_realm_admin
from zerver.lib.actions import do_add_realm_playground, do_remove_realm_playground
from zerver.lib.exceptions import ValidationFailureError
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.exceptions import JsonableError, ValidationFailureError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.validator import check_capped_string, check_url
from zerver.models import Realm, RealmPlayground, UserProfile

View File

@ -2,7 +2,6 @@ from typing import Dict, List, Optional
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables
from zerver.lib.bot_storage import (
StateError,
get_bot_storage,
@ -11,6 +10,7 @@ from zerver.lib.bot_storage import (
set_bot_storage,
)
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.validator import check_dict, check_list, check_string
from zerver.models import UserProfile

View File

@ -4,10 +4,10 @@ from django.db import transaction
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import do_add_submessage, verify_submessage_sender
from zerver.lib.exceptions import JsonableError
from zerver.lib.message import access_message
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.validator import check_int, validate_poll_data, validate_todo_data
from zerver.lib.widget import get_widget_type

View File

@ -3,9 +3,9 @@ from typing import List, Optional
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables
from zerver.lib.actions import check_send_typing_notification, do_send_stream_typing_notification
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.streams import access_stream_by_id, access_stream_for_send_message
from zerver.lib.validator import check_int, check_list, check_string_in

View File

@ -17,7 +17,7 @@ from confirmation.models import (
get_object_from_key,
render_confirmation_key_error,
)
from zerver.decorator import REQ, has_request_variables, human_users_only
from zerver.decorator import human_users_only
from zerver.lib.actions import (
check_change_full_name,
do_change_avatar_fields,
@ -29,16 +29,16 @@ from zerver.lib.actions import (
do_set_user_display_setting,
do_start_email_change_process,
get_available_notification_sounds,
validate_email_is_valid,
)
from zerver.lib.avatar import avatar_url
from zerver.lib.email_validation import (
get_realm_email_validator,
validate_email_is_valid,
validate_email_not_already_in_realm,
)
from zerver.lib.exceptions import JsonableError, RateLimited
from zerver.lib.i18n import get_available_language_codes
from zerver.lib.rate_limiter import RateLimited
from zerver.lib.request import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.send_email import FromAddress, send_email
from zerver.lib.upload import upload_avatar_image

View File

@ -29,9 +29,13 @@ from zerver.lib.actions import (
from zerver.lib.avatar import avatar_url, get_gravatar_url
from zerver.lib.bot_config import set_bot_config
from zerver.lib.email_validation import email_allowed_for_realm
from zerver.lib.exceptions import CannotDeactivateLastUserError, OrganizationOwnerRequired
from zerver.lib.exceptions import (
CannotDeactivateLastUserError,
JsonableError,
OrganizationOwnerRequired,
)
from zerver.lib.integrations import EMBEDDED_BOTS
from zerver.lib.request import REQ, JsonableError, has_request_variables
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.streams import access_stream_by_id, access_stream_by_name, subscribed_to_stream
from zerver.lib.types import Validator

View File

@ -21,10 +21,11 @@ from django.views.decorators.http import require_POST
from oauthlib.oauth2 import OAuth2Error
from requests_oauthlib import OAuth2Session
from zerver.decorator import REQ, has_request_variables, zulip_login_required
from zerver.decorator import zulip_login_required
from zerver.lib.actions import do_set_zoom_token
from zerver.lib.exceptions import ErrorCode, JsonableError
from zerver.lib.pysa import mark_sanitized
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.subdomains import get_subdomain
from zerver.lib.url_encoding import add_query_arg_to_redirect_url, add_query_to_redirect_url

View File

@ -3,7 +3,8 @@ from typing import Any, Dict, List
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -2,7 +2,8 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -2,8 +2,8 @@ from typing import Optional
from django.http import HttpRequest, HttpResponse
from zerver.decorator import has_request_variables, webhook_view
from zerver.lib.request import REQ, RequestVariableMissingError
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, RequestVariableMissingError, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -3,7 +3,8 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -2,7 +2,8 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message
from zerver.models import UserProfile

View File

@ -4,9 +4,10 @@ import dateutil.parser
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.send_email import FromAddress
from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message

View File

@ -3,7 +3,8 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -3,7 +3,8 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -2,8 +2,9 @@ from typing import Any, Dict, List
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message
from zerver.models import UserProfile

View File

@ -2,8 +2,9 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message
from zerver.models import UserProfile

View File

@ -2,8 +2,9 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message
from zerver.models import UserProfile

View File

@ -3,8 +3,9 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile

View File

@ -3,9 +3,10 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.send_email import FromAddress
from zerver.lib.webhooks.common import check_send_webhook_message

View File

@ -3,9 +3,10 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import REQ, has_request_variables, webhook_view
from zerver.decorator import webhook_view
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.send_email import FromAddress
from zerver.lib.webhooks.common import check_send_webhook_message

View File

@ -67,10 +67,11 @@ from zerver.lib.avatar import avatar_url, is_avatar_new
from zerver.lib.avatar_hash import user_avatar_content_hash
from zerver.lib.dev_ldap_directory import init_fakeldap
from zerver.lib.email_validation import email_allowed_for_realm, validate_email_not_already_in_realm
from zerver.lib.exceptions import JsonableError
from zerver.lib.mobile_auth_otp import is_valid_otp
from zerver.lib.rate_limiter import RateLimitedObject
from zerver.lib.redis_utils import get_dict_from_redis, get_redis_client, put_dict_in_redis
from zerver.lib.request import JsonableError, get_request_notes
from zerver.lib.request import get_request_notes
from zerver.lib.subdomains import get_subdomain
from zerver.lib.users import check_full_name, validate_user_custom_profile_field
from zerver.models import (