docs: Use python 3 syntax for typing.

This commit is contained in:
rht 2017-10-27 10:48:19 +02:00 committed by Tim Abbott
parent 26b6b893e6
commit ada9979f51
4 changed files with 6 additions and 11 deletions

View File

@ -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

View File

@ -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
```

View File

@ -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))

View File

@ -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")
```