Modernize legacy Python 2 syntax with pyupgrade.

Generated by `pyupgrade --py3-plus --keep-percent-format` followed by
manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-09 17:14:01 -07:00 committed by Tim Abbott
parent 543eb396b9
commit e30b3b094b
107 changed files with 192 additions and 244 deletions

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
if False:
@ -7,7 +6,7 @@ if False:
ZULIP_BOTSERVER_VERSION = "0.6.4"
with open("README.md", "r") as fh:
with open("README.md") as fh:
long_description = fh.read()
# We should be installable with either setuptools or distutils.

View file

@ -12,11 +12,11 @@ from zulip_botserver.input_parameters import parse_args
class BotServerTests(BotServerTestCase):
class MockMessageHandler(object):
class MockMessageHandler:
def handle_message(self, message: Dict[str, str], bot_handler: Any) -> None:
assert message == {'key': "test message"}
class MockLibModule(object):
class MockLibModule:
def handler_class(self) -> Any:
return BotServerTests.MockMessageHandler()

View file

@ -65,7 +65,7 @@ def read_config_file(config_file_path: str, bot_name: Optional[str]=None) -> Dic
def parse_config_file(config_file_path: str) -> configparser.ConfigParser:
config_file_path = os.path.abspath(os.path.expanduser(config_file_path))
if not os.path.isfile(config_file_path):
raise IOError("Could not read config file {}: File not found.".format(config_file_path))
raise OSError("Could not read config file {}: File not found.".format(config_file_path))
parser = configparser.ConfigParser()
parser.read(config_file_path)
return parser