mypy: Enable strict-optional for calculate_first_visible_message_id.

This commit is contained in:
neiljp (Neil Pilgrim) 2019-03-30 02:34:05 +00:00 committed by Tim Abbott
parent edb956091f
commit f3ef2a186c
2 changed files with 3 additions and 5 deletions

View File

@ -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" [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 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" [mypy-zilencer.management.commands.add_new_realm] #22: error: List item 0 has incompatible type "Optional[Stream]"; expected "Stream"
strict_optional = False strict_optional = False

View File

@ -22,12 +22,12 @@ class Command(ZulipBaseCommand):
) )
def handle(self, *args: Any, **options: Any) -> None: 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() realms = Realm.objects.all()
else: else:
realms = [realm] realms = [target_realm]
for realm in realms: for realm in realms:
maybe_update_first_visible_message_id(realm, options['lookback_hours']) maybe_update_first_visible_message_id(realm, options['lookback_hours'])