From 753e58b0b2e68d807a4205324dd67a083c0334a9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 8 Jul 2023 11:33:09 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- iembot/iembot.tac | 28 +++++++++++++++++----------- punjab/punjab.tac | 17 ++++++++++------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/iembot/iembot.tac b/iembot/iembot.tac index 7777dff..857d8a0 100644 --- a/iembot/iembot.tac +++ b/iembot/iembot.tac @@ -3,36 +3,42 @@ import json from psycopg2.extras import DictCursor + # Twisted Bits -from twisted.application import service, internet -from twisted.web import server -from twisted.internet import reactor +from twisted.application import internet, service from twisted.enterprise import adbapi +from twisted.internet import reactor +from twisted.web import server from txyam.client import YamClient # Local Import from iembot import iemchatbot, webservices -with open('settings.json', encoding="utf-8") as fh: +with open("settings.json", encoding="utf-8") as fh: dbconfig = json.load(fh) application = service.Application("Public IEMBOT") serviceCollection = service.IServiceCollection(application) # This provides DictCursors! -dbrw = dbconfig.get('databaserw') +dbrw = dbconfig.get("databaserw") dbpool = adbapi.ConnectionPool( "psycopg2", cp_reconnect=True, - database=dbrw.get('openfire'), - host=dbrw.get('host'), - password=dbrw.get('password'), - user=dbrw.get('user'), + database=dbrw.get("openfire"), + host=dbrw.get("host"), + password=dbrw.get("password"), + user=dbrw.get("user"), gssencmode="disable", cursor_factory=DictCursor, ) -memcache_client = YamClient(reactor, ['tcp:iem-memcached:11211', ]) +memcache_client = YamClient( + reactor, + [ + "tcp:iem-memcached:11211", + ], +) memcache_client.connect() jabber = iemchatbot.JabberClient("iembot", dbpool, memcache_client) @@ -41,7 +47,7 @@ defer = dbpool.runQuery("select propname, propvalue from properties") defer.addCallback(jabber.fire_client_with_config, serviceCollection) # 2. JSON channel requests -json = server.Site(webservices.JSONRootResource(jabber), logPath='/dev/null') +json = server.Site(webservices.JSONRootResource(jabber), logPath="/dev/null") x = internet.TCPServer(9003, json) # pylint: disable=no-member x.setServiceParent(serviceCollection) diff --git a/punjab/punjab.tac b/punjab/punjab.tac index 0181946..99346e8 100644 --- a/punjab/punjab.tac +++ b/punjab/punjab.tac @@ -1,10 +1,11 @@ from twisted.python import syslog -syslog.startLogging(prefix='punjab', facility=syslog.syslog.LOG_LOCAL1) -from twisted.web import server, resource, static -from twisted.application import service, internet +syslog.startLogging(prefix="punjab", facility=syslog.syslog.LOG_LOCAL1) -from punjab.httpb import Httpb, HttpbService +from twisted.application import internet, service +from twisted.web import resource, server, static + +from punjab.httpb import HttpbService root = static.File("./html") @@ -14,14 +15,16 @@ bosh = HttpbService(0) # You can limit servers with a whitelist. # The whitelist is a list of strings to match domain names. -bosh.white_list = ['weather.im', ] +bosh.white_list = [ + "weather.im", +] # or a black list # bosh.block_list = ['jabber.org', '.thetofu.com'] -root.putChild('http-bind', resource.IResource(bosh)) +root.putChild("http-bind", resource.IResource(bosh)) -site = server.Site(root, logPath='/dev/null') +site = server.Site(root, logPath="/dev/null") application = service.Application("punjab") internet.TCPServer(5280, site).setServiceParent(application)