From f3ef2a186ce891259a28a808f6ccfb6089a917ff Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Sat, 30 Mar 2019 02:34:05 +0000 Subject: [PATCH] mypy: Enable strict-optional for calculate_first_visible_message_id. --- mypy.ini | 2 -- .../commands/calculate_first_visible_message_id.py | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mypy.ini b/mypy.ini index 730215df00..93d4cc4838 100644 --- a/mypy.ini +++ b/mypy.ini @@ -102,8 +102,6 @@ strict_optional = False [mypy-zerver.migrations.0077_add_file_name_field_to_realm_emoji] #73: error: Argument 2 to "upload_files" of "Uploader" has incompatible type "Optional[bytes]"; expected "bytes" strict_optional = False -[mypy-zilencer.management.commands.calculate_first_visible_message_id] #33: error: Argument 1 to "maybe_update_first_visible_message_id" has incompatible type "Optional[Realm]"; expected "Realm" -strict_optional = False [mypy-zilencer.management.commands.add_new_realm] #22: error: List item 0 has incompatible type "Optional[Stream]"; expected "Stream" strict_optional = False diff --git a/zilencer/management/commands/calculate_first_visible_message_id.py b/zilencer/management/commands/calculate_first_visible_message_id.py index cc18030232..103e10c14b 100644 --- a/zilencer/management/commands/calculate_first_visible_message_id.py +++ b/zilencer/management/commands/calculate_first_visible_message_id.py @@ -22,12 +22,12 @@ class Command(ZulipBaseCommand): ) def handle(self, *args: Any, **options: Any) -> None: - realm = self.get_realm(options) + target_realm = self.get_realm(options) - if realm is None: + if target_realm is None: realms = Realm.objects.all() else: - realms = [realm] + realms = [target_realm] for realm in realms: maybe_update_first_visible_message_id(realm, options['lookback_hours'])