Use structural blank lines conformant with PEP 8.

PEP 8 specifies:

* Surround top-level function and class definitions with two blank lines.

* Method definitions inside a class are surrounded by a single blank line.
This commit is contained in:
Ben Finney 2022-12-19 09:25:10 +11:00
parent dc09a6be92
commit e30ab77cf4

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python3
import os, sys, logging, struct, psycopg2, bcrypt, random, atexit, time
# Database connection details. The credentials here need access to the Mastodon database, which "ejabberd" is unlikely
# to have on your system by default. You shoud grant SELECT privileges to ejabberd on the "accounts" and "users" tables,
# to play it safe, or include the Mastodon DB user credentials here (don't).
@ -38,16 +40,21 @@ except:
time.sleep(10)
sys.exit(1)
@atexit.register
def close_db():
cursor.close()
database.close()
logging.info('auth-mastodon script started, waiting for ejabberd requests')
class EjabberdInputError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)