id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
34,800 | mythtv.py | mqtt-tools_mqttwarn/mqttwarn/services/mythtv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Stefan Roellin <stefan()roellin-baumann.ch>'
__copyright__ = 'Copyright 2015 Stefan Roellin'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from future import standard_library
standard_library.install_aliases(... | 1,387 | Python | .py | 29 | 39.551724 | 115 | 0.623328 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,801 | serial.py | mqtt-tools_mqttwarn/mqttwarn/services/serial.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Daniel Lindner <andann83()gmail.com>'
__copyright__ = 'Copyright 2016 Daniel Lindner'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import serial
from builtins import bytes
_serialport = None
... | 2,202 | Python | .py | 50 | 35.68 | 106 | 0.62771 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,802 | pastebinpub.py | mqtt-tools_mqttwarn/mqttwarn/services/pastebinpub.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__copyright__ = 'Copyright 2014 Fabian Affolter'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from pastebin import PastebinAPI
def plugin(srv, item):
... | 1,587 | Python | .py | 43 | 29.418605 | 92 | 0.622309 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,803 | gss2.py | mqtt-tools_mqttwarn/mqttwarn/services/gss2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Philipp Adelt <autosort-github@philipp.adelt.net>, based on code by Jan Badenhorst'
__copyright__ = 'Copyright 2016 Philipp Adelt, 2014 Jan Badenhorst'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import os
... | 4,586 | Python | .py | 90 | 39.777778 | 110 | 0.624665 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,804 | pipe.py | mqtt-tools_mqttwarn/mqttwarn/services/pipe.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import errno
import subprocess
def plugin(srv, item):
srv.logging.debug("... | 1,092 | Python | .py | 31 | 29.483871 | 98 | 0.626667 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,805 | chromecast.py | mqtt-tools_mqttwarn/mqttwarn/services/chromecast.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Text To Speech (TTS) for Chromecast devices, including Google Home Speakers
pip install pychromecast
See also https://github.com/skorokithakis/catt.
"""
__author__ = 'Chris Clark <clach04()gmail.com>'
__copyright__ = 'Copyright 2020 Chris Clark'
__license__ = 'Eclips... | 2,160 | Python | .py | 50 | 37.2 | 144 | 0.655057 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,806 | mysql_dynamic.py | mqtt-tools_mqttwarn/mqttwarn/services/mysql_dynamic.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'João Paulo Barraca <jpbarraca()gmail.com>'
__copyright__ = 'Copyright 2014 João Paulo Barraca'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
# Credits to Jan-Piet Mens for the mysql.py code which served as basis f... | 4,557 | Python | .py | 113 | 30.893805 | 114 | 0.56192 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,807 | emoncms.py | mqtt-tools_mqttwarn/mqttwarn/services/emoncms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Ben Jones <ben.jones12()gmail.com>'
__copyright__ = 'Copyright 2014 Ben Jones'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from future import standard_library
standard_library.install_aliases()
from builtin... | 1,371 | Python | .py | 33 | 36.636364 | 98 | 0.661132 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,808 | irccat.py | mqtt-tools_mqttwarn/mqttwarn/services/irccat.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import socket
def plugin(srv, item):
srv.logging.debug("*** MODULE=%s: service=... | 1,315 | Python | .py | 35 | 31.657143 | 111 | 0.63959 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,809 | file.py | mqtt-tools_mqttwarn/mqttwarn/services/file.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import io
import tempfile
def plugin(srv, item):
srv.logging.debug("*** M... | 2,242 | Python | .py | 55 | 34.727273 | 98 | 0.651613 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,810 | alexa-notify-me.py | mqtt-tools_mqttwarn/mqttwarn/services/alexa-notify-me.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'Bram Hendrickx'
__copyright__ = 'Copyright 2016 Bram Hendrickx'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
Original script by Bram Hendrickx. https://github.com/mqtt-tools/mqttwarn/blob/main/mqttwarn/se... | 1,321 | Python | .py | 30 | 39.066667 | 110 | 0.675 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,811 | asterisk.py | mqtt-tools_mqttwarn/mqttwarn/services/asterisk.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Artem Alexandrov <alexandrov@devexperts.com>'
__copyright__ = 'Copyright 2014 Artem Alexandrov'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
# Please install pyst2
import asterisk.manager
def plugin(srv... | 1,916 | Python | .py | 46 | 35.043478 | 132 | 0.658405 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,812 | freeswitch.py | mqtt-tools_mqttwarn/mqttwarn/services/freeswitch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Ben Jones <ben.jones12()gmail.com>'
__copyright__ = 'Copyright 2014 Ben Jones'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from future import standard_library
standard_library.install_aliases()
from xmlrpc... | 2,609 | Python | .py | 56 | 38.107143 | 122 | 0.595351 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,813 | azure_iot.py | mqtt-tools_mqttwarn/mqttwarn/services/azure_iot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from six import string_types
__author__ = 'Morten Høybye Frederiksen <morten()mfd-consult.dk>'
__copyright__ = 'Copyright 2016-2020 Morten Høybye Frederiksen'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from builtins imp... | 2,331 | Python | .py | 61 | 31.770492 | 135 | 0.620018 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,814 | apprise_util.py | mqtt-tools_mqttwarn/mqttwarn/services/apprise_util.py | # -*- coding: utf-8 -*-
# (c) 2021-2023 The mqttwarn developers
from __future__ import absolute_import
from functools import lru_cache
from urllib.parse import urlparse, urlencode
from apprise import Apprise, ContentLocation
from mqttwarn.model import ProcessorItem
@lru_cache(maxsize=None)
def get_all_template_arg... | 1,392 | Python | .py | 40 | 29.625 | 75 | 0.679344 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,815 | prowl.py | mqtt-tools_mqttwarn/mqttwarn/services/prowl.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014-2021 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import pyprowl
def plugin(srv, item):
srv.logging.debug("*** MODULE=... | 1,164 | Python | .py | 29 | 33.62069 | 98 | 0.643556 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,816 | amqp.py | mqtt-tools_mqttwarn/mqttwarn/services/amqp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import pytest
puka = pytest.importorskip("puka")
def plugin(srv, item):
srv.lo... | 1,360 | Python | .py | 32 | 32.59375 | 112 | 0.578267 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,817 | fbchat.py | mqtt-tools_mqttwarn/mqttwarn/services/fbchat.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Przemek Anuszek <przemas75()gmail.com>'
__copyright__ = 'Copyright 2016 Przemek Anuszek'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from fbchat import Client
from fbchat.models import *
def plugin(srv, i... | 1,084 | Python | .py | 26 | 36.807692 | 98 | 0.669209 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,818 | mysql_remap.py | mqtt-tools_mqttwarn/mqttwarn/services/mysql_remap.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Halacs <halacs87()gmail.com>'
__copyright__ = 'Copyright 2018 Halacs'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import MySQLdb
# https://mail.python.org/pipermail/tutor/2010-December/080701.html
def add... | 3,075 | Python | .py | 74 | 34.108108 | 98 | 0.618439 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,819 | log.py | mqtt-tools_mqttwarn/mqttwarn/services/log.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
def plugin(srv, item):
srv.logging.debug("*** MODULE=%s: service=%s, target=%s",... | 881 | Python | .py | 23 | 32.565217 | 98 | 0.619552 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,820 | desktopnotify.py | mqtt-tools_mqttwarn/mqttwarn/services/desktopnotify.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Alexander Gräf <portalzine.projects()gmail.com>'
__copyright__ = 'Copyright 2022 Alexander Gräf'
__version__ = '1.0.0'
__license__ = 'Eclipse Public License - v 2.0 - https://www.eclipse.org/legal/epl-2.0/'
import json
import typing as t
from desktop... | 1,604 | Python | .py | 44 | 31.363636 | 98 | 0.673786 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,821 | websocket.py | mqtt-tools_mqttwarn/mqttwarn/services/websocket.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Giovanni Angoli <juzam76()gmail.com>'
__copyright__ = 'Copyright 2018 Giovanni Angoli'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
# This is basically the file.py service but designed for websockets, not mo... | 1,210 | Python | .py | 27 | 39.666667 | 102 | 0.665243 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,822 | sqlite_json2cols.py | mqtt-tools_mqttwarn/mqttwarn/services/sqlite_json2cols.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Vium https://github.com/Vium'
__copyright__ = 'Copyright 2016'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
# Based on the great SQLITE code by Jan-Piet Mens.
from builtins import str
import sqlite3
import ... | 3,024 | Python | .py | 68 | 37.852941 | 128 | 0.617947 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,823 | apprise_multi.py | mqtt-tools_mqttwarn/mqttwarn/services/apprise_multi.py | # -*- coding: utf-8 -*-
__author__ = 'Andreas Motl <andreas.motl@panodata.org>'
__copyright__ = 'Copyright 2021 Andreas Motl'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
# https://github.com/caronc/apprise#developers
from collections import OrderedDict
import appri... | 2,639 | Python | .py | 58 | 35.706897 | 116 | 0.627198 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,824 | thingspeak.py | mqtt-tools_mqttwarn/mqttwarn/services/thingspeak.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The code for thingspeak plugin for mqttwarn is based on other plugins
__author__ = 'Marcel Verpaalen'
__copyright__ = 'Copyright 2015 Marcel Verpaalen'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from future import standard... | 2,881 | Python | .py | 66 | 35.363636 | 116 | 0.62308 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,825 | xmpp.py | mqtt-tools_mqttwarn/mqttwarn/services/xmpp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__copyright__ = 'Copyright 2014 Fabian Affolter'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import xmpp
def plugin(srv, item):
"""Send a message to ... | 2,457 | Python | .py | 53 | 39 | 114 | 0.660385 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,826 | redispub.py | mqtt-tools_mqttwarn/mqttwarn/services/redispub.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import redis
def plugin(srv, item):
""" redispub. Expects addrs to contain... | 955 | Python | .py | 24 | 34.541667 | 98 | 0.625407 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,827 | postgres.py | mqtt-tools_mqttwarn/mqttwarn/services/postgres.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Based on the mysql.py service by Jan-Piet Mens
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>, Martyn Whitwell <martyn.whitwell()gmail.com>'
__copyright__ = 'Copyright 2016 Jan-Piet Mens, Martyn Whitwell'
__license__ = 'Eclipse Public License - v 1.0 (http://www.... | 3,360 | Python | .py | 89 | 30.674157 | 98 | 0.611402 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,828 | pushbullet.py | mqtt-tools_mqttwarn/mqttwarn/services/pushbullet.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import requests
def plugin(srv, item):
"""
mqttwarn service for Pushbu... | 2,622 | Python | .py | 64 | 34.0625 | 108 | 0.643868 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,829 | telegram.py | mqtt-tools_mqttwarn/mqttwarn/services/telegram.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Artem Alexandrov <qk4l@tem4uk.ru>'
__copyright__ = 'Copyright 2016 Artem Alexandrov'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from builtins import str
from builtins import object
import requests
try:
... | 4,472 | Python | .py | 114 | 27.377193 | 103 | 0.532444 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,830 | mqttpub.py | mqtt-tools_mqttwarn/mqttwarn/services/mqttpub.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from six import string_types
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
def plugin(srv, item):
""" Publish via MQTT t... | 1,340 | Python | .py | 30 | 38.5 | 98 | 0.661278 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,831 | ionic.py | mqtt-tools_mqttwarn/mqttwarn/services/ionic.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'hubble2webb <hubble2webb@users.noreply.github.com>'
__copyright__ = 'Copyright 2015 hubble2webb'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from future import standard_library
standard_library.install_aliases()... | 2,615 | Python | .py | 59 | 38.440678 | 105 | 0.682177 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,832 | carbon.py | mqtt-tools_mqttwarn/mqttwarn/services/carbon.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import time
import socket
def plugin(srv, item):
srv.logging.debug("*** M... | 2,114 | Python | .py | 56 | 31.303571 | 102 | 0.622005 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,833 | smtp.py | mqtt-tools_mqttwarn/mqttwarn/services/smtp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from builtins import str
import smtplib
from email.mime.text import MIMEText
fro... | 2,156 | Python | .py | 49 | 36.897959 | 107 | 0.627385 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,834 | dnsupdate.py | mqtt-tools_mqttwarn/mqttwarn/services/dnsupdate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from builtins import str
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2015 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import dns.update
import dns.query
import dns.tsigkeyring
... | 1,580 | Python | .py | 36 | 35.527778 | 105 | 0.619764 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,835 | apns.py | mqtt-tools_mqttwarn/mqttwarn/services/apns.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import json
try:
from apns import APNs, Payload
except:
pass
def plugin(srv... | 1,310 | Python | .py | 37 | 29.837838 | 98 | 0.655556 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,836 | execute.py | mqtt-tools_mqttwarn/mqttwarn/services/execute.py | # -*- coding: utf-8 -*-
__author__ = 'Tobias Brunner <tobias()tobru.ch>'
__copyright__ = 'Copyright 2016 Tobias Brunner'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
import subprocess
def plugin(srv, item):
srv.logging.debug("*** MODULE=%s: service=%s, targ... | 878 | Python | .py | 20 | 38.7 | 122 | 0.650588 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,837 | autoremote.py | mqtt-tools_mqttwarn/mqttwarn/services/autoremote.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'Bram Hendrickx'
__copyright__ = 'Copyright 2016 Bram Hendrickx'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
Original script by Bram Hendrickx. https://github.com/mqtt-tools/mqttwarn/blob/main/mqttwarn/se... | 1,467 | Python | .py | 33 | 38.333333 | 110 | 0.647719 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,838 | twilio.py | mqtt-tools_mqttwarn/mqttwarn/services/twilio.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from twilio.rest import TwilioRestClient
def plugin(srv, item):
""" expect... | 1,050 | Python | .py | 26 | 33.038462 | 98 | 0.617734 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,839 | icinga2.py | mqtt-tools_mqttwarn/mqttwarn/services/icinga2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Ben Jones <ben.jones12()gmail.com>'
__copyright__ = 'Copyright 2016 Ben Jones'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import requests
from requests.auth import HTTPBasicAuth
try:
import simplejson as j... | 2,263 | Python | .py | 66 | 28 | 102 | 0.626606 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,840 | xbmc.py | mqtt-tools_mqttwarn/mqttwarn/services/xbmc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Ben Jones <ben.jones12()gmail.com>'
__copyright__ = 'Copyright 2014 Ben Jones'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from future import standard_library
standard_library.install_aliases()
import urll... | 2,168 | Python | .py | 55 | 32.672727 | 104 | 0.621133 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,841 | syslog.py | mqtt-tools_mqttwarn/mqttwarn/services/syslog.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__copyright__ = 'Copyright 2014 Fabian Affolter'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import syslog
def plugin(srv, item):
"""Transfer a messa... | 2,329 | Python | .py | 64 | 28.765625 | 92 | 0.563249 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,842 | mysql.py | mqtt-tools_mqttwarn/mqttwarn/services/mysql.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import MySQLdb
# https://mail.python.org/pipermail/tutor/2010-December/080701.html
... | 3,064 | Python | .py | 75 | 32.946667 | 105 | 0.611729 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,843 | zabbix.py | mqtt-tools_mqttwarn/mqttwarn/services/zabbix.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
try:
import simplejson as json
except ImportError:
import json # type: ... | 3,265 | Python | .py | 73 | 35.876712 | 126 | 0.611794 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,844 | ntfy.py | mqtt-tools_mqttwarn/mqttwarn/services/ntfy.py | __author__ = "Andreas Motl <andreas.motl@panodata.org>"
__copyright__ = "Copyright 2023 Andreas Motl"
__license__ = "Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"
import dataclasses
import logging
import re
from collections import OrderedDict
import typing as t
from email.header import He... | 12,003 | Python | .py | 285 | 35.442105 | 127 | 0.666867 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,845 | mqtt_filter.py | mqtt-tools_mqttwarn/mqttwarn/services/mqtt_filter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Joerg Gollnick <github+mqttwarn()wurzelbenutzer.de>'
__copyright__ = 'Copyright 2016 Tobias Brunner / 2021 Joerg Gollnick'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
import subprocess
import json
from ... | 2,337 | Python | .py | 50 | 40.08 | 131 | 0.639525 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,846 | mqtt.py | mqtt-tools_mqttwarn/mqttwarn/services/mqtt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from six import string_types
from future import standard_library
standard_library.ins... | 3,468 | Python | .py | 93 | 29.494624 | 98 | 0.596837 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,847 | hangbot.py | mqtt-tools_mqttwarn/mqttwarn/services/hangbot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'Bram Hendrickx'
__copyright__ = 'Copyright 2016 Bram Hendrickx'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
Original script by Bram Hendrickx. https://github.com/mqtt-tools/mqttwarn/blob/main/mqttwarn/se... | 1,418 | Python | .py | 32 | 39.65625 | 110 | 0.668119 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,848 | ifttt.py | mqtt-tools_mqttwarn/mqttwarn/services/ifttt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Bram Hendrickx'
__copyright__ = 'Copyright 2016 Bram Hendrickx'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import requests
def plugin(srv, item):
''' expects (apikey, event) in adddrs '''
srv.lo... | 1,084 | Python | .py | 29 | 30.965517 | 98 | 0.623327 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,849 | apprise.py | mqtt-tools_mqttwarn/mqttwarn/services/apprise.py | import warnings
from mqttwarn.services.apprise_single import plugin
warnings.warn("`mqttwarn.services.apprise` will be removed in a future release of mqttwarn. "
"Please use `mqttwarn.services.apprise_single` or `mqttwarn.services.apprise_multi` instead.",
category=DeprecationWarning)
| 316 | Python | .py | 5 | 56.2 | 108 | 0.757282 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,850 | noop.py | mqtt-tools_mqttwarn/mqttwarn/services/noop.py | from mqttwarn.model import Service, ProcessorItem
def plugin(srv: Service, item: ProcessorItem) -> bool:
"""
An mqttwarn plugin with little overhead, suitable for unit- and integration-testing.
"""
if hasattr(item, "message") and item.message and "fail" in item.message:
srv.logging.error("Fail... | 468 | Python | .py | 11 | 36.636364 | 88 | 0.707692 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,851 | fixtures.py | mqtt-tools_mqttwarn/mqttwarn/testing/fixtures.py | import logging
import pytest
from mqttwarn.model import Service
@pytest.fixture
def mqttwarn_service():
"""
A service instance for propagating to the plugin.
"""
logger = logging.getLogger(__name__)
# FIXME: Should propagate `mqttwarn.core.globals()` to `mwcore`.
return Service(mqttc=None, l... | 375 | Python | .py | 11 | 30.545455 | 86 | 0.733333 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,852 | ZabbixSender.py | mqtt-tools_mqttwarn/mqttwarn/vendor/ZabbixSender.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from builtins import str
import socket
import struct
# Single file, imported from https://github.com/BlueSkyDetector/code-snippet/tree/master/ZabbixSender
# Lincense: DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Ve... | 2,307 | Python | .py | 58 | 33.241379 | 131 | 0.625678 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,853 | mqttwarn-zabbix-iot.py | mqtt-tools_mqttwarn/examples/zabbix-iot/mqttwarn-zabbix-iot.py | def decode_for_zabbix(topic, data, srv=None):
status_key = None
# the first part (part[0]) is always tele
# the second part (part[1]) is the device, the value comes from
# the third part (part[2]) is the name of the metric (e.g. temperature/humidity/voltage...)
parts = topic.split('/')
client =... | 413 | Python | .py | 9 | 41.111111 | 95 | 0.669154 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,854 | warntoggle.py | mqtt-tools_mqttwarn/examples/warntoggle/www/warntoggle.py | #!/usr/bin/python
import json
def index(req):
filename = "/var/www/html/warntoggle/warntoggle.json"
writetoggles = {}
readtoggles = {}
scriptname = __file__.split('/')[-1:][0]
# write form data to the file if applicable
if bool(req.form):
for k,v in req.form.items():
... | 1,441 | Python | .py | 35 | 33.571429 | 215 | 0.564342 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,855 | customfunctions.py | mqtt-tools_mqttwarn/examples/warntoggle/mqttwarn/customfunctions.py | import json
def togglestate(topic, payload, section, srv):
filename = "warntoggle.json"
default_topicblock = False
try:
with open(filename) as infile:
toggles = json.load(infile)
infile.close()
if topic in toggles:
# file found, topic found
... | 1,343 | Python | .py | 30 | 34.066667 | 107 | 0.603369 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,856 | frigate.py | mqtt-tools_mqttwarn/examples/frigate/frigate.py | # -*- coding: utf-8 -*-
"""
Frigate » Forward events and snapshots to Ntfy, using mqttwarn.
https://mqttwarn.readthedocs.io/en/latest/examples/frigate/README.html
"""
import dataclasses
import json
import re
import typing as t
from collections import OrderedDict
from datetime import datetime, timezone
from mqttwarn.... | 6,521 | Python | .py | 162 | 32.469136 | 116 | 0.638766 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,857 | test_frigate.py | mqtt-tools_mqttwarn/examples/frigate/test_frigate.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
"""
Software test accompanying "Forwarding Frigate events to ntfy" example.
Full system test verifying mqttwarn end-to-end, using an MQTT broker, and an ntfy instance.
"""
import os
import subprocess
import sys
from pathlib import Path
import pytest
import req... | 9,414 | Python | .py | 196 | 42.760204 | 122 | 0.710469 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,858 | homie.py | mqtt-tools_mqttwarn/examples/homie/homie.py | # -*- coding: utf-8 -*-
# Homie function extensions for mqttwarn
import re
# ------------------------------------------
# Synopsis
# ------------------------------------------
#
# Run mqttwarn::
#
# export MQTTWARNINI=examples/homie/homie.ini
# mqttwarn
#
# Send some homie-like data::
#
# mosqu... | 838 | Python | .py | 30 | 23.166667 | 89 | 0.524284 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,859 | hiveeyes.py | mqtt-tools_mqttwarn/examples/hiveeyes/hiveeyes.py | # -*- coding: utf-8 -*-
# hiveeyes-schwarmalarm function extensions for mqttwarn
# https://hiveeyes.org/docs/system/schwarmalarm-mqttwarn.html
from builtins import object
from builtins import str
import re
import json
from datetime import datetime
from pprint import pformat
from collections import deque, defaultdict
... | 10,808 | Python | .py | 261 | 34.586207 | 108 | 0.63533 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,860 | mqttwarn-owntracks.py | mqtt-tools_mqttwarn/examples/owntracks-ntfy/mqttwarn-owntracks.py | """
Forward OwnTracks low-battery warnings to ntfy.
https://mqttwarn.readthedocs.io/en/latest/examples/owntracks-ntfy/readme.html
"""
import json
def owntracks_batteryfilter(topic: str, message: str):
ignore = True
try:
data = dict(json.loads(message).items())
except:
data = None
if d... | 432 | Python | .py | 14 | 26.428571 | 77 | 0.68599 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,861 | conf.py | mqtt-tools_mqttwarn/docs/conf.py | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... | 2,487 | Python | .py | 59 | 39.661017 | 105 | 0.619818 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,862 | test_e2e.py | mqtt-tools_mqttwarn/tests/test_e2e.py | # -*- coding: utf-8 -*-
# (c) 2022 The mqttwarn developers
"""
Full system tests verifying mqttwarn end-to-end, using an MQTT broker.
"""
import json
import os
import sys
import pytest
from pytest_mqtt import MqttMessage
from mqttwarn.configuration import load_configuration
from mqttwarn.core import bootstrap, connec... | 8,395 | Python | .py | 164 | 46.426829 | 120 | 0.735028 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,863 | conftest.py | mqtt-tools_mqttwarn/tests/conftest.py | # -*- coding: utf-8 -*-
# (c) 2018-2023 The mqttwarn developers
import importlib
import os
import pathlib
import shutil
import sys
import typing as t
from tempfile import NamedTemporaryFile
import pytest
# Needed to make Apprise not be mocked too much.
from mqttwarn.services.apprise_util import get_all_template_argum... | 2,404 | Python | .py | 72 | 29.236111 | 97 | 0.715461 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,864 | util.py | mqtt-tools_mqttwarn/tests/util.py | # -*- coding: utf-8 -*-
# (c) 2018-2021 The mqttwarn developers
import shlex
import threading
import time
from unittest.mock import patch
import paho
from paho.mqtt.client import MQTTMessage
import mqttwarn
from mqttwarn.commands import run as run_command
from mqttwarn.configuration import load_configuration
from mqt... | 2,404 | Python | .py | 73 | 28.013699 | 85 | 0.701952 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,865 | test_context.py | mqtt-tools_mqttwarn/tests/test_context.py | # -*- coding: utf-8 -*-
# (c) 2022 The mqttwarn developers
from unittest.mock import Mock
import pytest
from mqttwarn.configuration import Config
from mqttwarn.context import FunctionInvoker, RuntimeContext
@pytest.fixture
def runtime_ini_file(tmp_path):
"""
Provide an INI file to the `RuntimeContext` test ... | 4,494 | Python | .py | 105 | 37.771429 | 113 | 0.703118 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,866 | test_commands.py | mqtt-tools_mqttwarn/tests/test_commands.py | # -*- coding: utf-8 -*-
# (c) 2018-2022 The mqttwarn developers
import os
import sys
from unittest import mock
from unittest.mock import Mock, patch
import docopt
import pytest
import mqttwarn.commands
from mqttwarn.configuration import Config
from tests.util import invoke_command
def test_mqttwarn_main_void(capsys... | 6,434 | Python | .py | 158 | 35.411392 | 110 | 0.685242 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,867 | test_cron.py | mqtt-tools_mqttwarn/tests/test_cron.py | from unittest.mock import Mock, call
from mqttwarn.cron import PeriodicThread
from tests.util import delay
def test_periodic_thread_success_now():
"""
Proof that the `cron.PeriodicThread` implementation works as intended.
"""
callback = Mock()
pt = PeriodicThread(callback=callback, period=0.05, n... | 1,832 | Python | .py | 49 | 31.979592 | 118 | 0.653868 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,868 | __init__.py | mqtt-tools_mqttwarn/tests/__init__.py | # -*- coding: utf-8 -*-
# (c) 2018 The mqttwarn developers
# Configuration- and function files used by the test harness
configfile_full = "tests/etc/full.ini"
configfile_service_loading = "tests/etc/service-loading.ini"
configfile_no_functions = "tests/etc/no-functions.ini"
configfile_empty_functions = "tests/etc/empt... | 608 | Python | .py | 12 | 49.583333 | 62 | 0.786555 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,869 | test_core_main.py | mqtt-tools_mqttwarn/tests/test_core_main.py | # -*- coding: utf-8 -*-
# (c) 2018-2023 The mqttwarn developers
import io
import json
import os
import sys
import tempfile
import pytest
from mqttwarn.core import decode_payload
from tests import configfile_full, configfile_logging_levels, configfile_service_loading
from tests.util import core_bootstrap, send_message... | 27,163 | Python | .py | 551 | 44.206897 | 120 | 0.711556 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,870 | test_core_infra.py | mqtt-tools_mqttwarn/tests/test_core_infra.py | # -*- coding: utf-8 -*-
# (c) 2018-2023 The mqttwarn developers
import configparser
import socket
import sys
import threading
from concurrent.futures import ThreadPoolExecutor
from unittest import mock
from unittest.mock import Mock, call
import pytest
from paho.mqtt.client import Client as MqttClient
from paho.mqtt.c... | 25,177 | Python | .py | 626 | 34.934505 | 120 | 0.690159 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,871 | test_configuration.py | mqtt-tools_mqttwarn/tests/test_configuration.py | # -*- coding: utf-8 -*-
# (c) 2022 The mqttwarn developers
import os
import re
import ssl
from unittest.mock import Mock, call, patch
import pytest
import mqttwarn.configuration
from mqttwarn.configuration import load_configuration
from tests import configfile_better_addresses, configfile_with_variables
def test_co... | 5,786 | Python | .py | 138 | 35.905797 | 120 | 0.657881 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,872 | test_util.py | mqtt-tools_mqttwarn/tests/test_util.py | # -*- coding: utf-8 -*-
# (c) 2018-2023 The mqttwarn developers
from __future__ import division
import py_compile
import re
import time
import types
from builtins import str
import pytest
from mqttwarn.util import (
Formatter,
asbool,
get_resource_content,
import_symbol,
load_file,
load_funct... | 6,895 | Python | .py | 169 | 35.680473 | 115 | 0.697688 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,873 | test_core_job.py | mqtt-tools_mqttwarn/tests/test_core_job.py | # -*- coding: utf-8 -*-
# (c) 2018-2023 The mqttwarn developers
from mqttwarn.core import process_job
from mqttwarn.model import ProcessorItem
from tests.util import core_bootstrap
def test_process_job_without_target_addrs(tmp_ini, caplog):
"""
Verify job dispatching w/o any target address information works (... | 2,962 | Python | .py | 102 | 23.901961 | 107 | 0.673498 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,874 | test_model.py | mqtt-tools_mqttwarn/tests/test_model.py | # -*- coding: utf-8 -*-
# (c) 2018-2022 The mqttwarn developers
from copy import deepcopy
from mqttwarn.core import make_service
from mqttwarn.model import Job, ProcessorItem, Struct
JOB_PRIO1 = dict(
prio=1, service="service", section="section", topic="topic", payload="payload", data="data", target="target"
)
JO... | 1,895 | Python | .py | 62 | 25.677419 | 112 | 0.623348 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,875 | functions_bad.py | mqtt-tools_mqttwarn/tests/etc/functions_bad.py | # -*- coding: utf-8 -*-
# (c) 2020 The mqttwarn developers
def foobar():
"""
This function has an intentional indentation error, for
validating mqttwarn runtime behavior with bogus Python code.
"""
foo
return True
| 240 | Python | .py | 9 | 22.777778 | 64 | 0.682609 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,876 | functions_good.py | mqtt-tools_mqttwarn/tests/etc/functions_good.py | # -*- coding: utf-8 -*-
# (c) 2018-2022 The mqttwarn developers
import logging
logger = logging.getLogger(__name__)
def foobar():
return True
def cronfunc(srv):
logger.info("`cronfunc` called")
return True
def xform_func(data):
data["xform-key"] = "xform-value"
return data
def datamap_dummy... | 1,024 | Python | .py | 32 | 28.21875 | 50 | 0.701138 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,877 | foobar.py | mqtt-tools_mqttwarn/tests/acme/foobar.py | def plugin(srv, item):
srv.logging.debug("*** MODULE=%s: service=%s, target=%s", __file__, item.service, item.target)
srv.logging.info("Plugin invoked")
| 161 | Python | .py | 3 | 50 | 98 | 0.664557 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,878 | test_execute.py | mqtt-tools_mqttwarn/tests/services/test_execute.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
import sys
import pytest
import mqttwarn.services.execute
from mqttwarn.model import ProcessorItem as Item
@pytest.mark.skipif(sys.platform == "win32", reason="This test does not work on Windows")
def test_execute_success(tmp_path, srv, caplog, capfd):
... | 1,449 | Python | .py | 41 | 29.878049 | 120 | 0.66547 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,879 | test_apprise_single.py | mqtt-tools_mqttwarn/tests/services/test_apprise_single.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest import mock
from unittest.mock import Mock, call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.model import Service
from mqttwarn.util import load_module_from_file
def test_apprise_success(srv: Service, mocker, caplog):
... | 7,641 | Python | .py | 165 | 37.006061 | 156 | 0.632581 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,880 | test_apns.py | mqtt-tools_mqttwarn/tests/services/test_apns.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest import mock
from unittest.mock import call
import pytest
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
pytest.skip(reason="The `apns` package is not ready for Python3", allow_module_level=... | 4,035 | Python | .py | 103 | 32.621359 | 90 | 0.651241 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,881 | test_noop.py | mqtt-tools_mqttwarn/tests/services/test_noop.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
from mqttwarn.model import ProcessorItem
from mqttwarn.util import load_module_by_name
def test_noop_success(srv, caplog):
module = load_module_by_name("mqttwarn.services.noop")
item = ProcessorItem()
outcome = module.plugin(srv, item)
asser... | 680 | Python | .py | 16 | 38.5 | 68 | 0.745427 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,882 | test_alexa.py | mqtt-tools_mqttwarn/tests/services/test_alexa.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
def test_alexa_notify_me_success(srv, mocker, caplog):
module = load_module_from_file("mqttwarn/services/alexa-notify-me.py")
accessCode = "myToken... | 1,287 | Python | .py | 25 | 46.36 | 97 | 0.729686 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,883 | test_autoremote.py | mqtt-tools_mqttwarn/tests/services/test_autoremote.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
def test_autoremote_success(srv, mocker, caplog):
item = Item(
target="test",
addrs=["ApiKey", "Password", "Target", "Group", "TTL"],
... | 1,795 | Python | .py | 43 | 34.372093 | 94 | 0.655852 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,884 | test_asterisk.py | mqtt-tools_mqttwarn/tests/services/test_asterisk.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest import mock
from unittest.mock import Mock, call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
@mock.patch("asterisk.manager.Manager", create=True)
def test_asterisk_success(asterisk_mock,... | 6,967 | Python | .py | 185 | 29.52973 | 108 | 0.619872 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,885 | test_smtp.py | mqtt-tools_mqttwarn/tests/services/test_smtp.py | # -*- coding: utf-8 -*-
# (c) 2022 The mqttwarn developers
import sys
from unittest import mock
from unittest.mock import call
import pytest
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.model import Struct
from mqttwarn.util import load_module_from_file
@pytest.mark.skipif(sys.version_info < (3, 8... | 7,783 | Python | .py | 200 | 31.405 | 116 | 0.633036 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,886 | test_log.py | mqtt-tools_mqttwarn/tests/services/test_log.py | # -*- coding: utf-8 -*-
# (c) 2022 The mqttwarn developers
import json
from tests import configfile_full
from tests.util import core_bootstrap, send_message
def test_log_invalid_target(caplog):
"""
Verify that mqttwarn warns appropriately when evaluating
topic target interpolating yields an invalid log l... | 2,156 | Python | .py | 49 | 38.367347 | 116 | 0.706107 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,887 | test_carbon.py | mqtt-tools_mqttwarn/tests/services/test_carbon.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest import mock
from unittest.mock import Mock, call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
def test_carbon_success_metric_value_timestamp(mocker, srv, caplog):
item = Item(
... | 5,097 | Python | .py | 125 | 34.48 | 94 | 0.660489 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,888 | test_desktopnotify.py | mqtt-tools_mqttwarn/tests/services/test_desktopnotify.py | # -*- coding: utf-8 -*-
# (c) 2022 The mqttwarn developers
import json
from unittest.mock import Mock, call
import pytest
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.model import Service, Struct
from mqttwarn.util import load_module_by_name
@pytest.fixture
def desktop_notifier_mock(mocker):
n... | 3,599 | Python | .py | 85 | 35.764706 | 106 | 0.689039 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,889 | test_apprise_ntfy.py | mqtt-tools_mqttwarn/tests/services/test_apprise_ntfy.py | # -*- coding: utf-8 -*-
# (c) 2021-2023 The mqttwarn developers
from unittest import mock
from unittest.mock import call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_by_name
@mock.patch("apprise.Apprise", create=True)
@mock.patch("apprise.AppriseAsset", create=True)
def test... | 1,368 | Python | .py | 32 | 35.53125 | 104 | 0.653465 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,890 | test_ntfy_integration.py | mqtt-tools_mqttwarn/tests/services/test_ntfy_integration.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
import os
import sys
import pytest
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_by_name
if os.getenv("GITHUB_ACTIONS") == "true" and sys.platform != "linux":
raise pytest.skip(msg="On GHA, ntfy via Docker is only... | 2,659 | Python | .py | 61 | 38.196721 | 150 | 0.693085 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,891 | test_pushover.py | mqtt-tools_mqttwarn/tests/services/test_pushover.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
import base64
import os
from unittest.mock import Mock
import responses
from requests_toolbelt import MultipartDecoder
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
def add_successful_mock_response():
... | 19,303 | Python | .py | 475 | 33.911579 | 112 | 0.666201 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,892 | test_amqp.py | mqtt-tools_mqttwarn/tests/services/test_amqp.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest.mock import ANY, Mock, call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_by_name
def test_amqp_success(srv, mocker, caplog):
module = load_module_by_name("mqttwarn.services.amqp")
exchange... | 2,688 | Python | .py | 64 | 34.015625 | 113 | 0.62823 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,893 | test_ntfy.py | mqtt-tools_mqttwarn/tests/services/test_ntfy.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
import io
import re
from pathlib import Path
import pytest
import responses
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.services.ntfy import (
ascii_clean,
decode_jobitem,
dict_ascii_clean,
dict_with_titles,
encode_rfc20... | 15,320 | Python | .py | 347 | 38.293948 | 150 | 0.672337 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,894 | test_file.py | mqtt-tools_mqttwarn/tests/services/test_file.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
import os
import pytest as pytest
import mqttwarn.services.file
from mqttwarn.model import ProcessorItem as Item
@pytest.mark.parametrize(
"item",
[
Item(
target="test",
addrs=["/tmp/testdrive.log"],
... | 4,049 | Python | .py | 119 | 26.806723 | 112 | 0.610768 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,895 | test_azure.py | mqtt-tools_mqttwarn/tests/services/test_azure.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest import mock
from unittest.mock import PropertyMock
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
def test_azure_iot_success_string(srv, mocker, caplog):
item = Item(
config={"... | 4,578 | Python | .py | 114 | 32.359649 | 112 | 0.629386 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,896 | test_http.py | mqtt-tools_mqttwarn/tests/services/test_http.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
from mqttwarn.configuration import Config
from mqttwarn.core import bootstrap, load_services
def test_http_urllib_load_by_alias(caplog):
"""
Verify loading the `http` service works, even if its implementation module is called `http_urllib`.
"""
... | 436 | Python | .py | 12 | 32.75 | 103 | 0.72209 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,897 | test_apprise_multi.py | mqtt-tools_mqttwarn/tests/services/test_apprise_multi.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest import mock
from unittest.mock import call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_by_name
@mock.patch("apprise.Apprise", create=True)
@mock.patch("apprise.AppriseAsset", create=True)
def test... | 5,582 | Python | .py | 123 | 35.447154 | 113 | 0.611421 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,898 | test_pushbullet.py | mqtt-tools_mqttwarn/tests/services/test_pushbullet.py | # -*- coding: utf-8 -*-
# (c) 2023 The mqttwarn developers
import pytest
import responses
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_by_name
# Canonical API response used for all tests.
pushbullet_api_response = {
"active": True,
"body": "⚽ Notification message ⚽",
... | 8,987 | Python | .py | 257 | 28.178988 | 92 | 0.660877 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,899 | test_irccat.py | mqtt-tools_mqttwarn/tests/services/test_irccat.py | # -*- coding: utf-8 -*-
# (c) 2021-2022 The mqttwarn developers
from unittest.mock import Mock, call
from mqttwarn.model import ProcessorItem as Item
from mqttwarn.util import load_module_from_file
def test_irccat_normal_success(mocker, srv, caplog):
import socket
item = Item(
target="test",
... | 3,773 | Python | .py | 95 | 32.947368 | 109 | 0.657341 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |