zerver/lib: Change use of typing.Text to str.

This commit is contained in:
Aditya Bansal
2018-05-10 22:43:36 +05:30
committed by Tim Abbott
parent 2f3b2fbf59
commit 1f9244e060
43 changed files with 233 additions and 241 deletions

View File

@@ -18,7 +18,7 @@ import configparser
if False:
from mypy_extensions import NoReturn
from typing import Any, Optional, List, Dict, Text
from typing import Any, Optional, List, Dict
from types import ModuleType
our_dir = os.path.dirname(os.path.abspath(__file__))
@@ -45,16 +45,16 @@ class StateHandler:
self.marshal = lambda obj: json.dumps(obj)
self.demarshal = lambda obj: json.loads(obj)
def get(self, key: Text) -> Text:
def get(self, key: str) -> str:
return self.demarshal(get_bot_storage(self.user_profile, key))
def put(self, key: Text, value: Text) -> None:
def put(self, key: str, value: str) -> None:
set_bot_storage(self.user_profile, [(key, self.marshal(value))])
def remove(self, key: Text) -> None:
def remove(self, key: str) -> None:
remove_bot_storage(self.user_profile, [key])
def contains(self, key: Text) -> bool:
def contains(self, key: str) -> bool:
return is_key_in_bot_storage(self.user_profile, key)
class EmbeddedBotQuitException(Exception):
@@ -109,7 +109,7 @@ class EmbeddedBotHandler:
))
# The bot_name argument exists only to comply with ExternalBotHandler.get_config_info().
def get_config_info(self, bot_name: str, optional: bool=False) -> Dict[Text, Text]:
def get_config_info(self, bot_name: str, optional: bool=False) -> Dict[str, str]:
try:
return get_bot_config(self.user_profile)
except ConfigError: