mypy: Clean zerver/views/users.py for strict-optional.

This commit is contained in:
Tim Abbott 2018-06-01 08:47:50 -07:00
parent 27e7770540
commit 0d84eb0a8b
4 changed files with 4 additions and 4 deletions

View File

@ -315,8 +315,6 @@ strict_optional = False
strict_optional = False
[mypy-zerver.views.messages] # Other issues in this file too
strict_optional = False
[mypy-zerver.views.users] # Other issues in this file too
strict_optional = False
# One change required?

View File

@ -483,7 +483,7 @@ def do_create_user(email: str, password: Optional[str], realm: Realm, full_name:
timezone: str="", avatar_source: str=UserProfile.AVATAR_FROM_GRAVATAR,
default_sending_stream: Optional[Stream]=None,
default_events_register_stream: Optional[Stream]=None,
default_all_public_streams: bool=None,
default_all_public_streams: Optional[bool]=None,
prereg_user: Optional[PreregistrationUser]=None,
newsletter_data: Optional[Dict[str, str]]=None,
default_stream_groups: List[DefaultStreamGroup]=[],

View File

@ -67,7 +67,7 @@ def check_valid_bot_type(user_profile: UserProfile, bot_type: int) -> None:
if bot_type not in user_profile.allowed_bot_types:
raise JsonableError(_('Invalid bot type'))
def check_valid_interface_type(interface_type: int) -> None:
def check_valid_interface_type(interface_type: Optional[int]) -> None:
if interface_type not in Service.ALLOWED_INTERFACE_TYPES:
raise JsonableError(_('Invalid interface type'))

View File

@ -141,6 +141,7 @@ def avatar(request: HttpRequest, email_or_id: str, medium: bool=False) -> HttpRe
# our templates depend on being able to use the ampersand to
# add query parameters to our url, get_avatar_url does '?x=x'
# hacks to prevent us from having to jump through decode/encode hoops.
assert url is not None
assert '?' in url
url += '&' + request.META['QUERY_STRING']
return redirect(url)
@ -198,6 +199,7 @@ def patch_bot_backend(
if service_payload_url is not None:
check_valid_interface_type(service_interface)
assert service_interface is not None
do_update_outgoing_webhook_service(bot, service_interface, service_payload_url)
if config_data is not None: