Replace typing.Text with str.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
189cf48573
commit
626359596e
|
@ -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"
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue