Skip to content

Commit

Permalink
Merge pull request #37 from jelmer/isort
Browse files Browse the repository at this point in the history
Sort Python import definitions with isort
  • Loading branch information
jelmer authored Jan 31, 2023
2 parents 0543ba0 + bd8b1d9 commit c4d7b33
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
8 changes: 4 additions & 4 deletions prometheus_xmpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
# $ python3 prometheus-xmpp-alerts --config=xmpp-alerts.yml.example

import json
import re
from datetime import datetime
import logging
import re
import subprocess
import traceback

from datetime import datetime

__version__ = (0, 5, 6)
version_string = '.'.join(map(str, __version__))
Expand Down Expand Up @@ -89,8 +88,9 @@ def render_text_template(template, alert):


def render_html_template(template, alert):
from jinja2 import Template, TemplateError
from xml.etree import ElementTree as ET

from jinja2 import Template, TemplateError
try:
output = Template(template).render(**alert)
except TemplateError as e:
Expand Down
21 changes: 6 additions & 15 deletions prometheus_xmpp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,24 @@
#
# Edit xmpp-alerts.yml.example, then run:
# $ python3 prometheus-xmpp-alerts --config=xmpp-alerts.yml.example
import subprocess
import argparse
import json
import logging
import shlex
import socket
import subprocess
import sys
import traceback

import slixmpp
import yaml
from aiohttp import web
from aiohttp_openmetrics import (
Counter,
Gauge,
metrics as serve_metrics,
)

from prometheus_xmpp import (
create_message_short,
create_message_full,
render_text_template,
render_html_template,
run_amtool,
strip_html_tags,
)
from aiohttp_openmetrics import Counter, Gauge
from aiohttp_openmetrics import metrics as serve_metrics

from prometheus_xmpp import (create_message_full, create_message_short,
render_html_template, render_text_template,
run_amtool, strip_html_tags)

DEFAULT_CONF_PATH = '/etc/prometheus/xmpp-alerts.yml'

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/python3
from setuptools import setup

setup()
7 changes: 4 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (C) 2018 Jelmer Vernooij <[email protected]>
#

import unittest
from datetime import datetime

import pytz
import unittest

from prometheus_xmpp import \
create_message_short, create_message_full, parse_timestring
from prometheus_xmpp import (create_message_full, create_message_short,
parse_timestring)


class CreateMessageTests(unittest.TestCase):
Expand Down

0 comments on commit c4d7b33

Please sign in to comment.