diff --git a/analytics/views/support.py b/analytics/views/support.py index f4fc22f6d2..4c786301dc 100644 --- a/analytics/views/support.py +++ b/analytics/views/support.py @@ -142,11 +142,11 @@ def support( default=None, str_validator=check_string_in(VALID_BILLING_METHODS) ), sponsorship_pending: Optional[bool] = REQ(default=None, json_validator=check_bool), - approve_sponsorship: Optional[bool] = REQ(default=None, json_validator=check_bool), + approve_sponsorship: bool = REQ(default=False, json_validator=check_bool), downgrade_method: Optional[str] = REQ( default=None, str_validator=check_string_in(VALID_DOWNGRADE_METHODS) ), - scrub_realm: Optional[bool] = REQ(default=None, json_validator=check_bool), + scrub_realm: bool = REQ(default=False, json_validator=check_bool), query: Optional[str] = REQ("q", default=None), org_type: Optional[int] = REQ(default=None, converter=to_non_negative_int), ) -> HttpResponse: diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index faa7ca7cda..22f4514aa7 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -336,12 +336,10 @@ MOCKED_STRIPE_FUNCTION_NAMES = [ def mock_stripe( - tested_timestamp_fields: Sequence[str] = [], generate: Optional[bool] = None + tested_timestamp_fields: Sequence[str] = [], generate: bool = settings.GENERATE_STRIPE_FIXTURES ) -> Callable[[Callable[ParamT, ReturnT]], Callable[ParamT, ReturnT]]: def _mock_stripe(decorated_function: Callable[ParamT, ReturnT]) -> Callable[ParamT, ReturnT]: generate_fixture = generate - if generate_fixture is None: - generate_fixture = settings.GENERATE_STRIPE_FIXTURES if generate_fixture: # nocoverage assert stripe.api_key for mocked_function_name in MOCKED_STRIPE_FUNCTION_NAMES: diff --git a/zerver/actions/create_realm.py b/zerver/actions/create_realm.py index 6f19617398..fc0235a579 100644 --- a/zerver/actions/create_realm.py +++ b/zerver/actions/create_realm.py @@ -136,8 +136,8 @@ def do_create_realm( plan_type: Optional[int] = None, org_type: Optional[int] = None, date_created: Optional[datetime.datetime] = None, - is_demo_organization: Optional[bool] = False, - enable_spectator_access: Optional[bool] = False, + is_demo_organization: bool = False, + enable_spectator_access: Optional[bool] = None, ) -> Realm: if string_id == settings.SOCIAL_AUTH_SUBDOMAIN: raise AssertionError("Creating a realm on SOCIAL_AUTH_SUBDOMAIN is not allowed!") diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py index 8d15eca510..c67bce6de9 100644 --- a/zerver/lib/cache.py +++ b/zerver/lib/cache.py @@ -703,12 +703,12 @@ def flush_stream( def flush_used_upload_space_cache( *, instance: "Attachment", - created: Optional[bool] = None, + created: bool = True, **kwargs: object, ) -> None: attachment = instance - if created is None or created: + if created: cache_delete(get_realm_used_upload_space_cache_key(attachment.owner.realm)) diff --git a/zerver/lib/markdown/help_relative_links.py b/zerver/lib/markdown/help_relative_links.py index 3c0ba8fff3..a4ec8cf6f7 100644 --- a/zerver/lib/markdown/help_relative_links.py +++ b/zerver/lib/markdown/help_relative_links.py @@ -1,5 +1,5 @@ import re -from typing import Any, List, Match, Optional +from typing import Any, List, Match from markdown import Markdown from markdown.extensions import Extension @@ -81,7 +81,7 @@ class RelativeLinksHelpExtension(Extension): ) -relative_help_links: Optional[bool] = None +relative_help_links: bool = False def set_relative_help_links(value: bool) -> None: diff --git a/zerver/lib/markdown/help_settings_links.py b/zerver/lib/markdown/help_settings_links.py index 768f969191..10194092cd 100644 --- a/zerver/lib/markdown/help_settings_links.py +++ b/zerver/lib/markdown/help_settings_links.py @@ -1,5 +1,5 @@ import re -from typing import Any, List, Match, Optional +from typing import Any, List, Match from markdown import Markdown from markdown.extensions import Extension @@ -114,7 +114,7 @@ class SettingHelpExtension(Extension): md.preprocessors.register(Setting(), "setting", PREPROCESSOR_PRIORITES["setting"]) -relative_settings_links: Optional[bool] = None +relative_settings_links: bool = False def set_relative_settings_links(value: bool) -> None: diff --git a/zerver/lib/types.py b/zerver/lib/types.py index 66544dcdce..62a7930cd3 100644 --- a/zerver/lib/types.py +++ b/zerver/lib/types.py @@ -186,7 +186,7 @@ class SubscriptionStreamDict(TypedDict): email_notifications: Optional[bool] first_message_id: Optional[int] history_public_to_subscribers: bool - in_home_view: Optional[bool] + in_home_view: bool # Bug: invite_only should be bool. invite_only: Optional[bool] is_announcement_only: bool