python: Normalize quotes with Black.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-11 23:20:45 -08:00
committed by Tim Abbott
parent 11741543da
commit 6e4c3e41dc
989 changed files with 32792 additions and 32792 deletions

View File

@@ -19,14 +19,14 @@ states = {
3: "UNKNOWN",
}
if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
if "USER" in os.environ and not os.environ["USER"] in ["root", "rabbitmq"]:
print("This script must be run as the root or rabbitmq user")
usage = """Usage: check-rabbitmq-consumers --queue=[queue-name] --min-threshold=[min-threshold]"""
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('--min-threshold', dest='min_count', type=int, default=1)
parser.add_argument("--min-threshold", dest="min_count", type=int, default=1)
options = parser.parse_args()
@@ -34,7 +34,7 @@ config_file = get_config_file()
TORNADO_PROCESSES = len(get_tornado_ports(config_file))
output = subprocess.check_output(
['/usr/sbin/rabbitmqctl', 'list_consumers'], universal_newlines=True
["/usr/sbin/rabbitmqctl", "list_consumers"], universal_newlines=True
)
consumers: Dict[str, int] = defaultdict(int)
@@ -42,15 +42,15 @@ consumers: Dict[str, int] = defaultdict(int)
queues = {
*normal_queues,
# These queues may not be present if settings.TORNADO_PROCESSES > 1
'notify_tornado',
"notify_tornado",
}
for queue_name in queues:
queue_name = queue_name.strip()
consumers[queue_name] = 0
for line in output.split('\n'):
parts = line.split('\t')
for line in output.split("\n"):
parts = line.split("\t")
if len(parts) >= 2:
queue_name = parts[0]
if queue_name.startswith("notify_tornado_"):

View File

@@ -15,14 +15,14 @@ def nagios_from_file(results_file: str) -> Tuple[int, str]:
with open(results_file) as f:
data = f.read().strip()
except FileNotFoundError:
state = 'UNKNOWN'
state = "UNKNOWN"
ret = 3
data = "Results file is missing"
else:
pieces = data.split('|')
pieces = data.split("|")
if not len(pieces) == 4:
state = 'UNKNOWN'
state = "UNKNOWN"
ret = 3
data = "Results file malformed"
else:
@@ -31,7 +31,7 @@ def nagios_from_file(results_file: str) -> Tuple[int, str]:
time_diff = time.time() - timestamp
if time_diff > 60 * 2:
ret = 3
state = 'UNKNOWN'
state = "UNKNOWN"
data = "Results file is stale"
else:
ret = int(pieces[1])