mirror of https://github.com/zulip/zulip.git
zilencer: Change use of typing.Text to str.
This commit is contained in:
parent
ade00dd954
commit
67bf71472a
|
@ -2,7 +2,7 @@ import itertools
|
|||
import os
|
||||
import random
|
||||
from typing import Any, Callable, Dict, Iterable, List, \
|
||||
Mapping, Optional, Sequence, Set, Text, Tuple
|
||||
Mapping, Optional, Sequence, Set, Tuple
|
||||
|
||||
import ujson
|
||||
from django.conf import settings
|
||||
|
@ -34,10 +34,10 @@ settings.CACHES['default'] = {
|
|||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||
}
|
||||
|
||||
def create_users(realm: Realm, name_list: Iterable[Tuple[Text, Text]],
|
||||
def create_users(realm: Realm, name_list: Iterable[Tuple[str, str]],
|
||||
bot_type: Optional[int]=None,
|
||||
bot_owner: Optional[UserProfile]=None) -> None:
|
||||
user_set = set() # type: Set[Tuple[Text, Text, Text, bool]]
|
||||
user_set = set() # type: Set[Tuple[str, str, str, bool]]
|
||||
for full_name, email in name_list:
|
||||
short_name = email_to_username(email)
|
||||
user_set.add((email, full_name, short_name, True))
|
||||
|
@ -229,7 +229,7 @@ class Command(BaseCommand):
|
|||
"invite_only": False, "is_web_public": False},
|
||||
"Rome": {"description": "Yet another Italian city",
|
||||
"invite_only": False, "is_web_public": True}
|
||||
} # type: Dict[Text, Dict[Text, Any]]
|
||||
} # type: Dict[str, Dict[str, Any]]
|
||||
|
||||
bulk_create_streams(zulip_realm, stream_dict)
|
||||
recipient_streams = [Stream.objects.get(name=name, realm=zulip_realm).id
|
||||
|
@ -414,7 +414,7 @@ class Command(BaseCommand):
|
|||
"invite_only": False, "is_web_public": False},
|
||||
"sales": {"description": "For sales discussion",
|
||||
"invite_only": False, "is_web_public": False}
|
||||
} # type: Dict[Text, Dict[Text, Any]]
|
||||
} # type: Dict[str, Dict[str, Any]]
|
||||
|
||||
# Calculate the maximum number of digits in any extra stream's
|
||||
# number, since a stream with name "Extra Stream 3" could show
|
||||
|
@ -578,7 +578,7 @@ def send_messages(data: Tuple[int, Sequence[Sequence[int]], Mapping[str, Any],
|
|||
# Pick a random subscriber to the stream
|
||||
message.sender = random.choice(Subscription.objects.filter(
|
||||
recipient=message.recipient)).user_profile
|
||||
message.subject = stream.name + Text(random.randint(1, 3))
|
||||
message.subject = stream.name + str(random.randint(1, 3))
|
||||
saved_data['subject'] = message.subject
|
||||
|
||||
# Spoofing time not supported with threading
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import datetime
|
||||
from typing import Text
|
||||
|
||||
from django.db import models
|
||||
|
||||
from zerver.models import AbstractPushDeviceToken, Realm
|
||||
|
||||
def get_remote_server_by_uuid(uuid: Text) -> 'RemoteZulipServer':
|
||||
def get_remote_server_by_uuid(uuid: str) -> 'RemoteZulipServer':
|
||||
return RemoteZulipServer.objects.get(uuid=uuid)
|
||||
|
||||
class RemoteZulipServer(models.Model):
|
||||
|
@ -13,11 +12,11 @@ class RemoteZulipServer(models.Model):
|
|||
API_KEY_LENGTH = 64
|
||||
HOSTNAME_MAX_LENGTH = 128
|
||||
|
||||
uuid = models.CharField(max_length=UUID_LENGTH, unique=True) # type: Text
|
||||
api_key = models.CharField(max_length=API_KEY_LENGTH) # type: Text
|
||||
uuid = models.CharField(max_length=UUID_LENGTH, unique=True) # type: str
|
||||
api_key = models.CharField(max_length=API_KEY_LENGTH) # type: str
|
||||
|
||||
hostname = models.CharField(max_length=HOSTNAME_MAX_LENGTH) # type: Text
|
||||
contact_email = models.EmailField(blank=True, null=False) # type: Text
|
||||
hostname = models.CharField(max_length=HOSTNAME_MAX_LENGTH) # type: str
|
||||
contact_email = models.EmailField(blank=True, null=False) # type: str
|
||||
last_updated = models.DateTimeField('last updated', auto_now=True) # type: datetime.datetime
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
from typing import Any, Dict, Optional, Text, Union, cast
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import validate_email, URLValidator
|
||||
|
@ -84,7 +84,7 @@ def register_remote_server(
|
|||
def register_remote_push_device(request: HttpRequest, entity: Union[UserProfile, RemoteZulipServer],
|
||||
user_id: int=REQ(), token: bytes=REQ(),
|
||||
token_kind: int=REQ(validator=check_int),
|
||||
ios_app_id: Optional[Text]=None) -> HttpResponse:
|
||||
ios_app_id: Optional[str]=None) -> HttpResponse:
|
||||
validate_bouncer_token_request(entity, token, token_kind)
|
||||
server = cast(RemoteZulipServer, entity)
|
||||
|
||||
|
@ -110,7 +110,7 @@ def register_remote_push_device(request: HttpRequest, entity: Union[UserProfile,
|
|||
def unregister_remote_push_device(request: HttpRequest, entity: Union[UserProfile, RemoteZulipServer],
|
||||
token: bytes=REQ(),
|
||||
token_kind: int=REQ(validator=check_int),
|
||||
ios_app_id: Optional[Text]=None) -> HttpResponse:
|
||||
ios_app_id: Optional[str]=None) -> HttpResponse:
|
||||
validate_bouncer_token_request(entity, token, token_kind)
|
||||
server = cast(RemoteZulipServer, entity)
|
||||
deleted = RemotePushDeviceToken.objects.filter(token=token,
|
||||
|
|
Loading…
Reference in New Issue