mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
mypy: Use Python 3 type syntax in zerver/lib/create_user.py.
This commit is contained in:
@@ -21,11 +21,13 @@ def random_api_key() -> Text:
|
|||||||
# Only use this for bulk_create -- for normal usage one should use
|
# Only use this for bulk_create -- for normal usage one should use
|
||||||
# create_user (below) which will also make the Subscription and
|
# create_user (below) which will also make the Subscription and
|
||||||
# Recipient objects
|
# Recipient objects
|
||||||
def create_user_profile(realm, email, password, active, bot_type, full_name,
|
def create_user_profile(realm: Realm, email: Text, password: Optional[Text],
|
||||||
short_name, bot_owner, is_mirror_dummy, tos_version,
|
active: bool, bot_type: Optional[int], full_name: Text,
|
||||||
timezone, tutorial_status=UserProfile.TUTORIAL_WAITING,
|
short_name: Text, bot_owner: Optional[UserProfile],
|
||||||
enter_sends=False):
|
is_mirror_dummy: bool, tos_version: Text,
|
||||||
# type: (Realm, Text, Optional[Text], bool, Optional[int], Text, Text, Optional[UserProfile], bool, Text, Optional[Text], Optional[Text], bool) -> UserProfile
|
timezone: Optional[Text],
|
||||||
|
tutorial_status: Optional[Text] = UserProfile.TUTORIAL_WAITING,
|
||||||
|
enter_sends: bool = False) -> UserProfile:
|
||||||
now = timezone_now()
|
now = timezone_now()
|
||||||
email = UserManager.normalize_email(email)
|
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()
|
user_profile.api_key = random_api_key()
|
||||||
return user_profile
|
return user_profile
|
||||||
|
|
||||||
def create_user(email, password, realm, full_name, short_name,
|
def create_user(email: Text, password: Optional[Text], realm: Realm,
|
||||||
active=True, is_realm_admin=False, bot_type=None, bot_owner=None, tos_version=None,
|
full_name: Text, short_name: Text, active: bool = True,
|
||||||
timezone="", avatar_source=UserProfile.AVATAR_FROM_GRAVATAR,
|
is_realm_admin: bool = False, bot_type: Optional[int] = None,
|
||||||
is_mirror_dummy=False, default_sending_stream=None,
|
bot_owner: Optional[UserProfile] = None,
|
||||||
default_events_register_stream=None,
|
tos_version: Optional[Text] = None, timezone: Text = "",
|
||||||
default_all_public_streams=None, user_profile_id=None):
|
avatar_source: Text = UserProfile.AVATAR_FROM_GRAVATAR,
|
||||||
# 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
|
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,
|
user_profile = create_user_profile(realm, email, password, active, bot_type,
|
||||||
full_name, short_name, bot_owner,
|
full_name, short_name, bot_owner,
|
||||||
is_mirror_dummy, tos_version, timezone)
|
is_mirror_dummy, tos_version, timezone)
|
||||||
|
|||||||
Reference in New Issue
Block a user