mirror of https://github.com/zulip/zulip.git
docs: Use python 3 syntax for typing.
This commit is contained in:
parent
26b6b893e6
commit
ada9979f51
|
@ -15,8 +15,8 @@
|
|||
import sys
|
||||
import os
|
||||
import shlex
|
||||
if False:
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
|
@ -206,8 +206,7 @@ html_static_path = ['_static']
|
|||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'zulip-contributor-docsdoc'
|
||||
|
||||
def setup(app):
|
||||
# type: (Any) -> None
|
||||
def setup(app: Any) -> None:
|
||||
|
||||
# overrides for wide tables in RTD theme
|
||||
app.add_stylesheet('theme_overrides.css') # path relative to _static
|
||||
|
|
|
@ -14,8 +14,7 @@ using in Zulip:
|
|||
```
|
||||
user_dict = {} # type: Dict[str, UserProfile]
|
||||
|
||||
def get_user(email, realm):
|
||||
# type: (str, Realm) -> UserProfile
|
||||
def get_user(email: str, realm: Realm) -> UserProfile:
|
||||
... # Actual code of the function here
|
||||
```
|
||||
|
||||
|
|
|
@ -273,8 +273,7 @@ active users in a realm.
|
|||
|
||||
# zerver/lib/actions.py
|
||||
|
||||
def do_set_realm_property(realm, name, value):
|
||||
# type: (Realm, str, Union[Text, bool, int]) -> None
|
||||
def do_set_realm_property(realm: Realm, name: str, value: bool) -> None:
|
||||
"""Takes in a realm object, the name of an attribute to update, and the
|
||||
value to update.
|
||||
"""
|
||||
|
@ -300,8 +299,7 @@ field and send an event. For example:
|
|||
|
||||
# zerver/lib/actions.py
|
||||
|
||||
def do_set_realm_authentication_methods(realm, authentication_methods):
|
||||
# type: (Realm, Dict[str, bool]) -> None
|
||||
def do_set_realm_authentication_methods(realm: Realm, authentication_methods: Dict[str, bool]) -> None:
|
||||
for key, value in list(authentication_methods.items()):
|
||||
index = getattr(realm.authentication_methods, key).number
|
||||
realm.authentication_methods.set_bit(index, int(value))
|
||||
|
|
|
@ -233,7 +233,6 @@ class HelloWorldHookTests(WebhookTestCase):
|
|||
content_type="application/x-www-form-urlencoded")
|
||||
|
||||
def get_body(self, fixture_name: Text) -> Text:
|
||||
# type: (Text) -> Text
|
||||
return self.fixture_data("helloworld", fixture_name, file_type="json")
|
||||
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue