Replace typing.Text with str.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-08-24 19:50:05 -07:00
parent 189cf48573
commit 626359596e
4 changed files with 12 additions and 12 deletions

View file

@ -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"