From 626359596eba0e3068d9e9cefccbd3f410933fcf Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 24 Aug 2021 19:50:05 -0700 Subject: [PATCH] Replace typing.Text with str. Signed-off-by: Anders Kaseorg --- zulip/integrations/nagios/nagios-notify-zulip | 6 +++--- zulip/integrations/svn/post-commit | 10 +++++----- zulip/tests/__init__.py | 4 ++-- zulip_botserver/tests/__init__.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/zulip/integrations/nagios/nagios-notify-zulip b/zulip/integrations/nagios/nagios-notify-zulip index 670d9bf..8fd0327 100755 --- a/zulip/integrations/nagios/nagios-notify-zulip +++ b/zulip/integrations/nagios/nagios-notify-zulip @@ -1,6 +1,6 @@ #!/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" diff --git a/zulip/integrations/svn/post-commit b/zulip/integrations/svn/post-commit index b58b410..4b271d4 100755 --- a/zulip/integrations/svn/post-commit +++ b/zulip/integrations/svn/post-commit @@ -12,7 +12,7 @@ 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 = { diff --git a/zulip/tests/__init__.py b/zulip/tests/__init__.py index 9c5ca6a..f1e69a3 100644 --- a/zulip/tests/__init__.py +++ b/zulip/tests/__init__.py @@ -1,4 +1,4 @@ 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] diff --git a/zulip_botserver/tests/__init__.py b/zulip_botserver/tests/__init__.py index 9c5ca6a..f1e69a3 100644 --- a/zulip_botserver/tests/__init__.py +++ b/zulip_botserver/tests/__init__.py @@ -1,4 +1,4 @@ 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]