From 017476cdfb082151be38a604c1eb2c41eb79e29a Mon Sep 17 00:00:00 2001 From: Marco Burstein Date: Tue, 19 Dec 2017 09:51:39 -0800 Subject: [PATCH] mypy: Use Python 3 type syntax in `zerver/lib/create_user.py`. --- zerver/lib/create_user.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/zerver/lib/create_user.py b/zerver/lib/create_user.py index 4e676d9515..35349d14ba 100644 --- a/zerver/lib/create_user.py +++ b/zerver/lib/create_user.py @@ -21,11 +21,13 @@ def random_api_key() -> Text: # Only use this for bulk_create -- for normal usage one should use # create_user (below) which will also make the Subscription and # Recipient objects -def create_user_profile(realm, email, password, active, bot_type, full_name, - short_name, bot_owner, is_mirror_dummy, tos_version, - timezone, tutorial_status=UserProfile.TUTORIAL_WAITING, - enter_sends=False): - # type: (Realm, Text, Optional[Text], bool, Optional[int], Text, Text, Optional[UserProfile], bool, Text, Optional[Text], Optional[Text], bool) -> UserProfile +def create_user_profile(realm: Realm, email: Text, password: Optional[Text], + active: bool, bot_type: Optional[int], full_name: Text, + short_name: Text, bot_owner: Optional[UserProfile], + is_mirror_dummy: bool, tos_version: Text, + timezone: Optional[Text], + tutorial_status: Optional[Text] = UserProfile.TUTORIAL_WAITING, + enter_sends: bool = False) -> UserProfile: now = timezone_now() email = UserManager.normalize_email(email) @@ -48,13 +50,17 @@ def create_user_profile(realm, email, password, active, bot_type, full_name, user_profile.api_key = random_api_key() return user_profile -def create_user(email, password, realm, full_name, short_name, - active=True, is_realm_admin=False, bot_type=None, bot_owner=None, tos_version=None, - timezone="", avatar_source=UserProfile.AVATAR_FROM_GRAVATAR, - is_mirror_dummy=False, default_sending_stream=None, - default_events_register_stream=None, - default_all_public_streams=None, user_profile_id=None): - # type: (Text, Optional[Text], Realm, Text, Text, bool, bool, Optional[int], Optional[UserProfile], Optional[Text], Text, Text, bool, Optional[Stream], Optional[Stream], Optional[bool], Optional[int]) -> UserProfile +def create_user(email: Text, password: Optional[Text], realm: Realm, + full_name: Text, short_name: Text, active: bool = True, + is_realm_admin: bool = False, bot_type: Optional[int] = None, + bot_owner: Optional[UserProfile] = None, + tos_version: Optional[Text] = None, timezone: Text = "", + avatar_source: Text = UserProfile.AVATAR_FROM_GRAVATAR, + is_mirror_dummy: bool = False, + default_sending_stream: Optional[Stream] = None, + default_events_register_stream: Optional[Stream] = None, + default_all_public_streams: Optional[bool] = None, + user_profile_id: Optional[int] = None) -> UserProfile: user_profile = create_user_profile(realm, email, password, active, bot_type, full_name, short_name, bot_owner, is_mirror_dummy, tos_version, timezone)