mirror of https://github.com/zulip/zulip.git
ruff: Collapse short multi-line import statements.
isort did this by default, though it’s unclear whether that was intended; see https://github.com/astral-sh/ruff/issues/4153. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
c419c6369e
commit
733083c65d
|
@ -178,3 +178,4 @@ extend-function-names = ["gettext_lazy"]
|
||||||
|
|
||||||
[tool.ruff.isort]
|
[tool.ruff.isort]
|
||||||
known-third-party = ["zulip"]
|
known-third-party = ["zulip"]
|
||||||
|
split-on-trailing-comma = false
|
||||||
|
|
|
@ -69,10 +69,7 @@ from zerver.lib.stream_topic import StreamTopicTarget
|
||||||
from zerver.lib.streams import access_stream_for_send_message, ensure_stream
|
from zerver.lib.streams import access_stream_for_send_message, ensure_stream
|
||||||
from zerver.lib.string_validation import check_stream_name
|
from zerver.lib.string_validation import check_stream_name
|
||||||
from zerver.lib.timestamp import timestamp_to_datetime
|
from zerver.lib.timestamp import timestamp_to_datetime
|
||||||
from zerver.lib.topic import (
|
from zerver.lib.topic import filter_by_exact_message_topic, participants_for_topic
|
||||||
filter_by_exact_message_topic,
|
|
||||||
participants_for_topic,
|
|
||||||
)
|
|
||||||
from zerver.lib.url_preview.types import UrlEmbedData
|
from zerver.lib.url_preview.types import UrlEmbedData
|
||||||
from zerver.lib.user_message import UserMessageLite, bulk_insert_ums
|
from zerver.lib.user_message import UserMessageLite, bulk_insert_ums
|
||||||
from zerver.lib.validator import check_widget_content
|
from zerver.lib.validator import check_widget_content
|
||||||
|
|
|
@ -23,13 +23,7 @@ from zerver.lib.cache import (
|
||||||
from zerver.lib.safe_session_cached_db import SessionStore
|
from zerver.lib.safe_session_cached_db import SessionStore
|
||||||
from zerver.lib.sessions import session_engine
|
from zerver.lib.sessions import session_engine
|
||||||
from zerver.lib.users import get_all_api_keys
|
from zerver.lib.users import get_all_api_keys
|
||||||
from zerver.models import (
|
from zerver.models import Client, Huddle, UserProfile, get_client_cache_key, huddle_hash_cache_key
|
||||||
Client,
|
|
||||||
Huddle,
|
|
||||||
UserProfile,
|
|
||||||
get_client_cache_key,
|
|
||||||
huddle_hash_cache_key,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def user_cache_items(
|
def user_cache_items(
|
||||||
|
|
|
@ -8,9 +8,7 @@ from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from version import API_FEATURE_LEVEL, ZULIP_MERGE_BASE, ZULIP_VERSION
|
from version import API_FEATURE_LEVEL, ZULIP_MERGE_BASE, ZULIP_VERSION
|
||||||
from zerver.actions.default_streams import (
|
from zerver.actions.default_streams import default_stream_groups_to_dicts_sorted
|
||||||
default_stream_groups_to_dicts_sorted,
|
|
||||||
)
|
|
||||||
from zerver.actions.users import get_owned_bot_dicts
|
from zerver.actions.users import get_owned_bot_dicts
|
||||||
from zerver.lib import emoji
|
from zerver.lib import emoji
|
||||||
from zerver.lib.alert_words import user_alert_words
|
from zerver.lib.alert_words import user_alert_words
|
||||||
|
|
|
@ -13,11 +13,7 @@ from django_otp.middleware import is_verified
|
||||||
from zulip_bots.custom_exceptions import ConfigValidationError
|
from zulip_bots.custom_exceptions import ConfigValidationError
|
||||||
|
|
||||||
from zerver.lib.avatar import avatar_url, get_avatar_field
|
from zerver.lib.avatar import avatar_url, get_avatar_field
|
||||||
from zerver.lib.cache import (
|
from zerver.lib.cache import cache_with_key, get_cross_realm_dicts_key, realm_user_dict_fields
|
||||||
cache_with_key,
|
|
||||||
get_cross_realm_dicts_key,
|
|
||||||
realm_user_dict_fields,
|
|
||||||
)
|
|
||||||
from zerver.lib.exceptions import (
|
from zerver.lib.exceptions import (
|
||||||
JsonableError,
|
JsonableError,
|
||||||
OrganizationAdministratorRequiredError,
|
OrganizationAdministratorRequiredError,
|
||||||
|
|
|
@ -43,11 +43,7 @@ from zerver.actions.users import change_user_is_active
|
||||||
from zerver.context_processors import common_context
|
from zerver.context_processors import common_context
|
||||||
from zerver.lib.create_user import create_user
|
from zerver.lib.create_user import create_user
|
||||||
from zerver.lib.default_streams import get_default_streams_for_realm_as_dicts
|
from zerver.lib.default_streams import get_default_streams_for_realm_as_dicts
|
||||||
from zerver.lib.send_email import (
|
from zerver.lib.send_email import FromAddress, deliver_scheduled_emails, send_future_email
|
||||||
FromAddress,
|
|
||||||
deliver_scheduled_emails,
|
|
||||||
send_future_email,
|
|
||||||
)
|
|
||||||
from zerver.lib.streams import ensure_stream
|
from zerver.lib.streams import ensure_stream
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import find_key_by_email
|
from zerver.lib.test_helpers import find_key_by_email
|
||||||
|
|
|
@ -18,16 +18,10 @@ from django.utils import translation
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from confirmation import settings as confirmation_settings
|
from confirmation import settings as confirmation_settings
|
||||||
from confirmation.models import (
|
from confirmation.models import Confirmation, one_click_unsubscribe_link
|
||||||
Confirmation,
|
|
||||||
one_click_unsubscribe_link,
|
|
||||||
)
|
|
||||||
from zerver.actions.create_realm import do_change_realm_subdomain, do_create_realm
|
from zerver.actions.create_realm import do_change_realm_subdomain, do_create_realm
|
||||||
from zerver.actions.create_user import add_new_user_history
|
from zerver.actions.create_user import add_new_user_history
|
||||||
from zerver.actions.default_streams import (
|
from zerver.actions.default_streams import do_add_default_stream, do_create_default_stream_group
|
||||||
do_add_default_stream,
|
|
||||||
do_create_default_stream_group,
|
|
||||||
)
|
|
||||||
from zerver.actions.realm_settings import (
|
from zerver.actions.realm_settings import (
|
||||||
do_deactivate_realm,
|
do_deactivate_realm,
|
||||||
do_set_realm_authentication_methods,
|
do_set_realm_authentication_methods,
|
||||||
|
@ -50,11 +44,7 @@ from zerver.lib.mobile_auth_otp import (
|
||||||
xor_hex_strings,
|
xor_hex_strings,
|
||||||
)
|
)
|
||||||
from zerver.lib.name_restrictions import is_disposable_domain
|
from zerver.lib.name_restrictions import is_disposable_domain
|
||||||
from zerver.lib.send_email import (
|
from zerver.lib.send_email import EmailNotDeliveredError, FromAddress, send_future_email
|
||||||
EmailNotDeliveredError,
|
|
||||||
FromAddress,
|
|
||||||
send_future_email,
|
|
||||||
)
|
|
||||||
from zerver.lib.stream_subscription import get_stream_subscriptions_for_user
|
from zerver.lib.stream_subscription import get_stream_subscriptions_for_user
|
||||||
from zerver.lib.streams import create_stream_if_needed
|
from zerver.lib.streams import create_stream_if_needed
|
||||||
from zerver.lib.subdomains import is_root_domain_available
|
from zerver.lib.subdomains import is_root_domain_available
|
||||||
|
|
|
@ -10,10 +10,7 @@ from PIL import Image
|
||||||
import zerver.lib.upload
|
import zerver.lib.upload
|
||||||
from zerver.lib.avatar_hash import user_avatar_path
|
from zerver.lib.avatar_hash import user_avatar_path
|
||||||
from zerver.lib.test_classes import UploadSerializeMixin, ZulipTestCase
|
from zerver.lib.test_classes import UploadSerializeMixin, ZulipTestCase
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import get_test_image_file, read_test_image_file
|
||||||
get_test_image_file,
|
|
||||||
read_test_image_file,
|
|
||||||
)
|
|
||||||
from zerver.lib.upload import (
|
from zerver.lib.upload import (
|
||||||
all_message_attachments,
|
all_message_attachments,
|
||||||
delete_export_tarball,
|
delete_export_tarball,
|
||||||
|
@ -24,18 +21,9 @@ from zerver.lib.upload import (
|
||||||
upload_export_tarball,
|
upload_export_tarball,
|
||||||
upload_message_attachment,
|
upload_message_attachment,
|
||||||
)
|
)
|
||||||
from zerver.lib.upload.base import (
|
from zerver.lib.upload.base import DEFAULT_EMOJI_SIZE, MEDIUM_AVATAR_SIZE, resize_avatar
|
||||||
DEFAULT_EMOJI_SIZE,
|
|
||||||
MEDIUM_AVATAR_SIZE,
|
|
||||||
resize_avatar,
|
|
||||||
)
|
|
||||||
from zerver.lib.upload.local import write_local_file
|
from zerver.lib.upload.local import write_local_file
|
||||||
from zerver.models import (
|
from zerver.models import Attachment, RealmEmoji, get_realm, get_system_bot
|
||||||
Attachment,
|
|
||||||
RealmEmoji,
|
|
||||||
get_realm,
|
|
||||||
get_system_bot,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class LocalStorageTest(UploadSerializeMixin, ZulipTestCase):
|
class LocalStorageTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
|
|
|
@ -36,13 +36,7 @@ from zerver.lib.upload.base import (
|
||||||
resize_avatar,
|
resize_avatar,
|
||||||
)
|
)
|
||||||
from zerver.lib.upload.s3 import S3UploadBackend
|
from zerver.lib.upload.s3 import S3UploadBackend
|
||||||
from zerver.models import (
|
from zerver.models import Attachment, RealmEmoji, UserProfile, get_realm, get_system_bot
|
||||||
Attachment,
|
|
||||||
RealmEmoji,
|
|
||||||
UserProfile,
|
|
||||||
get_realm,
|
|
||||||
get_system_bot,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class S3Test(ZulipTestCase):
|
class S3Test(ZulipTestCase):
|
||||||
|
|
|
@ -7,10 +7,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
from zerver.actions.user_topics import do_set_user_topic_visibility_policy
|
from zerver.actions.user_topics import do_set_user_topic_visibility_policy
|
||||||
from zerver.lib.stream_topic import StreamTopicTarget
|
from zerver.lib.stream_topic import StreamTopicTarget
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.user_topics import (
|
from zerver.lib.user_topics import get_topic_mutes, topic_has_visibility_policy
|
||||||
get_topic_mutes,
|
|
||||||
topic_has_visibility_policy,
|
|
||||||
)
|
|
||||||
from zerver.models import UserProfile, UserTopic, get_stream
|
from zerver.models import UserProfile, UserTopic, get_stream
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,7 @@ from zerver.lib.topic import REQ_topic
|
||||||
from zerver.lib.validator import check_string_in, to_float
|
from zerver.lib.validator import check_string_in, to_float
|
||||||
from zerver.lib.zcommand import process_zcommands
|
from zerver.lib.zcommand import process_zcommands
|
||||||
from zerver.lib.zephyr import compute_mit_user_fullname
|
from zerver.lib.zephyr import compute_mit_user_fullname
|
||||||
from zerver.models import (
|
from zerver.models import Client, Message, RealmDomain, UserProfile, get_user_including_cross_realm
|
||||||
Client,
|
|
||||||
Message,
|
|
||||||
RealmDomain,
|
|
||||||
UserProfile,
|
|
||||||
get_user_including_cross_realm,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidMirrorInputError(Exception):
|
class InvalidMirrorInputError(Exception):
|
||||||
|
|
|
@ -7,11 +7,7 @@ from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.validator import (
|
from zerver.lib.validator import WildValue, check_string, to_wild_value
|
||||||
WildValue,
|
|
||||||
check_string,
|
|
||||||
to_wild_value,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
|
|
|
@ -9,10 +9,7 @@ from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
from zerver.lib.outgoing_http import OutgoingSession
|
from zerver.lib.outgoing_http import OutgoingSession
|
||||||
from zerver.lib.validator import (
|
from zerver.lib.validator import check_url, to_wild_value
|
||||||
check_url,
|
|
||||||
to_wild_value,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class SentryTunnelSession(OutgoingSession):
|
class SentryTunnelSession(OutgoingSession):
|
||||||
|
|
|
@ -130,9 +130,7 @@ from zerver.views.registration import (
|
||||||
realm_register,
|
realm_register,
|
||||||
signup_send_confirm,
|
signup_send_confirm,
|
||||||
)
|
)
|
||||||
from zerver.views.report import (
|
from zerver.views.report import report_csp_violations
|
||||||
report_csp_violations,
|
|
||||||
)
|
|
||||||
from zerver.views.scheduled_messages import (
|
from zerver.views.scheduled_messages import (
|
||||||
create_scheduled_message_backend,
|
create_scheduled_message_backend,
|
||||||
delete_scheduled_messages,
|
delete_scheduled_messages,
|
||||||
|
|
Loading…
Reference in New Issue