python: Convert more variable type annotations to Python 3.6 style.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-05-08 15:10:17 -07:00
committed by Tim Abbott
parent 708c6f4f11
commit 8cdf2801f7
17 changed files with 122 additions and 113 deletions

View File

@@ -173,9 +173,9 @@ boolean field, `mandatory_topics`, to the Realm model in
class Realm(models.Model):
# ...
emails_restricted_to_domains = models.BooleanField(default=True) # type: bool
invite_required = models.BooleanField(default=False) # type: bool
+ mandatory_topics = models.BooleanField(default=False) # type: bool
emails_restricted_to_domains: bool = models.BooleanField(default=True)
invite_required: bool = models.BooleanField(default=False)
+ mandatory_topics: bool = models.BooleanField(default=False)
```
The Realm model also contains an attribute, `property_types`, which
@@ -405,12 +405,15 @@ annotation).
# zerver/views/realm.py
def update_realm(request, user_profile, name=REQ(validator=check_string, default=None),
# ...,
+ mandatory_topics=REQ(validator=check_bool, default=None),
# ...):
+ # type: (HttpRequest, UserProfile, ..., Optional[bool], ...
# ...
def update_realm(
request: HttpRequest,
user_profile: UserProfile,
name: Optional[str] = REQ(validator=check_string, default=None),
# ...
+ mandatory_topics: Optional[bool] = REQ(validator=check_bool, default=None),
# ...
):
# ...
```
If this feature fits the `property_types` framework and does