Replace typing.Text with str.
MODIFY
zulip/integrations/nagios/nagios-notify-zulip
zulip/integrations/nagios/nagios-notify-zulip
#!/usr/bin/env python3
import argparse
-from typing import Any, Dict, Text
+from typing import Any, Dict
import zulip
@@ -30,7 +30,7 @@ msg = dict(type="stream", to=opts.stream) # type: Dict[str, Any]
# We send PROBLEM and RECOVERY messages to the same subject.
if opts.service is None:
# Host notification
- thing = "host" # type: Text
+ thing = "host"
msg["subject"] = f"host {opts.host}"
else:
# Service notification
@@ -45,7 +45,7 @@ msg["content"] = f"**{opts.type}**: {thing} is {opts.state}"
# The "long output" can contain newlines represented by "\n" escape sequences.
# The Nagios mail command uses /usr/bin/printf "%b" to expand these.
# We will be more conservative and handle just this one escape sequence.
-output = (opts.output + "\n" + opts.long_output.replace(r"\n", "\n")).strip() # type: Text
+output = (opts.output + "\n" + opts.long_output.replace(r"\n", "\n")).strip()
if output:
# Put any command output in a code block.
msg["content"] += "\n\n~~~~\n" + output + "\n~~~~\n"

MODIFY
zulip/integrations/svn/post-commit
zulip/integrations/svn/post-commit
import os
import os.path
import sys
-from typing import Any, Dict, Optional, Text, Tuple
+from typing import Any, Dict
import pysvn
@@ -34,19 +34,19 @@ client = zulip.Client(
) # type: zulip.Client
svn = pysvn.Client() # type: pysvn.Client
-path, rev = sys.argv[1:] # type: Tuple[Text, Text]
+path, rev = sys.argv[1:]
# since its a local path, prepend "file://"
path = "file://" + path
entry = svn.log(path, revision_end=pysvn.Revision(pysvn.opt_revision_kind.number, rev))[
0
-] # type: Dict[Text, Any]
+] # type: Dict[str, Any]
message = "**{}** committed revision r{} to `{}`.\n\n> {}".format(
entry["author"], rev, path.split("/")[-1], entry["revprops"]["svn:log"]
-) # type: Text
+)
-destination = config.commit_notice_destination(path, rev) # type: Optional[Dict[Text, Text]]
+destination = config.commit_notice_destination(path, rev)
if destination is not None:
message_data = {

MODIFY
zulip/tests/__init__.py
zulip/tests/__init__.py
import pkgutil
-from typing import Iterable, Text
+from typing import Iterable
-__path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[Text]
+__path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[str]

MODIFY
zulip_botserver/tests/__init__.py
zulip_botserver/tests/__init__.py
import pkgutil
-from typing import Iterable, Text
+from typing import Iterable
-__path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[Text]
+__path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[str]

Replace typing.Text with str.

Signed-off-by: Anders Kaseorg <anders@zulip.com>