mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
typing: Fix typical typing typos.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
3dcb4ca20a
commit
4cf3ba5744
@@ -612,7 +612,7 @@ def is_free_trial_offer_enabled() -> bool:
|
|||||||
return settings.FREE_TRIAL_DAYS not in (None, 0)
|
return settings.FREE_TRIAL_DAYS not in (None, 0)
|
||||||
|
|
||||||
|
|
||||||
def ensure_realm_does_not_have_active_plan(realm: Customer) -> None:
|
def ensure_realm_does_not_have_active_plan(realm: Realm) -> None:
|
||||||
if get_current_plan_by_realm(realm) is not None:
|
if get_current_plan_by_realm(realm) is not None:
|
||||||
# Unlikely race condition from two people upgrading (clicking "Make payment")
|
# Unlikely race condition from two people upgrading (clicking "Make payment")
|
||||||
# at exactly the same time. Doesn't fully resolve the race condition, but having
|
# at exactly the same time. Doesn't fully resolve the race condition, but having
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ class ZulipPasswordResetForm(PasswordResetForm):
|
|||||||
use_https: bool = False,
|
use_https: bool = False,
|
||||||
token_generator: PasswordResetTokenGenerator = default_token_generator,
|
token_generator: PasswordResetTokenGenerator = default_token_generator,
|
||||||
from_email: Optional[str] = None,
|
from_email: Optional[str] = None,
|
||||||
request: HttpRequest = None,
|
request: Optional[HttpRequest] = None,
|
||||||
html_email_template_name: Optional[str] = None,
|
html_email_template_name: Optional[str] = None,
|
||||||
extra_email_context: Optional[Dict[str, Any]] = None,
|
extra_email_context: Optional[Dict[str, Any]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -312,6 +312,9 @@ class ZulipPasswordResetForm(PasswordResetForm):
|
|||||||
are an artifact of using Django's password reset framework).
|
are an artifact of using Django's password reset framework).
|
||||||
"""
|
"""
|
||||||
email = self.cleaned_data["email"]
|
email = self.cleaned_data["email"]
|
||||||
|
# The form is only used in zerver.views.auth.password_rest, we know that
|
||||||
|
# the request must not be None
|
||||||
|
assert request is not None
|
||||||
|
|
||||||
realm = get_realm(get_subdomain(request))
|
realm = get_realm(get_subdomain(request))
|
||||||
|
|
||||||
|
|||||||
@@ -129,12 +129,12 @@ class UploadSerializeMixin(SerializeMixin):
|
|||||||
lockfile = "var/upload_lock"
|
lockfile = "var/upload_lock"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls: Any, *args: Any, **kwargs: Any) -> None:
|
def setUpClass(cls: Any) -> None:
|
||||||
if not os.path.exists(cls.lockfile):
|
if not os.path.exists(cls.lockfile):
|
||||||
with open(cls.lockfile, "w"): # nocoverage - rare locking case
|
with open(cls.lockfile, "w"): # nocoverage - rare locking case
|
||||||
pass
|
pass
|
||||||
|
|
||||||
super().setUpClass(*args, **kwargs)
|
super().setUpClass()
|
||||||
|
|
||||||
|
|
||||||
# We could be more specific about which arguments are bool (Django's
|
# We could be more specific about which arguments are bool (Django's
|
||||||
@@ -1659,9 +1659,9 @@ You can fix this by adding "{complete_event_type}" to ALL_EVENT_TYPES for this w
|
|||||||
content_type: Optional[str] = "application/json",
|
content_type: Optional[str] = "application/json",
|
||||||
expect_noop: bool = False,
|
expect_noop: bool = False,
|
||||||
**kwargs: ClientArg,
|
**kwargs: ClientArg,
|
||||||
) -> "TestHttpResponse":
|
) -> None:
|
||||||
kwargs["HTTP_AUTHORIZATION"] = self.encode_user(user)
|
kwargs["HTTP_AUTHORIZATION"] = self.encode_user(user)
|
||||||
return self.check_webhook(
|
self.check_webhook(
|
||||||
fixture_name, expected_topic, expected_message, content_type, expect_noop, **kwargs
|
fixture_name, expected_topic, expected_message, content_type, expect_noop, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-03-23 04:32
|
# Generated by Django 3.2.12 on 2022-03-23 04:32
|
||||||
|
|
||||||
|
from typing import Type
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
|
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
@@ -14,7 +16,9 @@ def fix_attachment_caches(apps: StateApps, schema_editor: BaseDatabaseSchemaEdit
|
|||||||
|
|
||||||
BATCH_SIZE = 10000
|
BATCH_SIZE = 10000
|
||||||
|
|
||||||
def update_batch(attachment_model: Model, message_model: Model, lower_bound: int) -> None:
|
def update_batch(
|
||||||
|
attachment_model: Type[Model], message_model: Type[Model], lower_bound: int
|
||||||
|
) -> None:
|
||||||
attachment_model.objects.filter(
|
attachment_model.objects.filter(
|
||||||
id__gt=lower_bound, id__lte=lower_bound + BATCH_SIZE
|
id__gt=lower_bound, id__lte=lower_bound + BATCH_SIZE
|
||||||
).update(
|
).update(
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ def serve_local(
|
|||||||
|
|
||||||
def serve_file_download_backend(
|
def serve_file_download_backend(
|
||||||
request: HttpRequest, user_profile: UserProfile, realm_id_str: str, filename: str
|
request: HttpRequest, user_profile: UserProfile, realm_id_str: str, filename: str
|
||||||
) -> HttpRequest:
|
) -> HttpResponse:
|
||||||
return serve_file(request, user_profile, realm_id_str, filename, url_only=False, download=True)
|
return serve_file(request, user_profile, realm_id_str, filename, url_only=False, download=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user