mypy: Prohibit unreachable code.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-03-04 15:17:09 -08:00
parent 30f241a126
commit 717a549f4b
9 changed files with 15 additions and 11 deletions

View file

@ -1,3 +1,5 @@
from typing import Optional
# Change these values to configure authentication for your codebase account
# Note that this is the Codebase API Username, found in the Settings page
# for your account
@ -23,14 +25,14 @@ ZULIP_TICKETS_STREAM_NAME = "tickets"
# If properly installed, the Zulip API should be in your import
# path, but if not, set a custom path below
ZULIP_API_PATH = None
ZULIP_API_PATH: Optional[str] = None
# Set this to your Zulip API server URI
ZULIP_SITE = "https://zulip.example.com"
# If you wish to log to a file rather than stdout/stderr,
# please fill this out your desired path
LOG_FILE = None
LOG_FILE: Optional[str] = None
# This file is used to resume this mirror in case the script shuts down.
# It is required and needs to be writeable.

View file

@ -293,8 +293,7 @@ def check_permissions() -> None:
sys.stderr.write(str(e))
if __name__ == "__main__":
if not isinstance(config.RESUME_FILE, str):
sys.stderr.write("RESUME_FILE path not given; refusing to continue")
assert isinstance(config.RESUME_FILE, str), "RESUME_FILE path not given; refusing to continue"
check_permissions()
if config.LOG_FILE:
logging.basicConfig(filename=config.LOG_FILE, level=logging.WARNING)