Skip to content
Open
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def blind_user2(db):
@pytest.fixture
def no_rate_limit():
"""Disables post rate limiting for the test"""
import sogs.model.room as mroom
from sogs.model.room import Room as mroom

saved = (mroom.rate_limit_size, mroom.rate_limit_interval)
mroom.rate_limit_size, mroom.rate_limit_interval = None, None
Expand Down
1 change: 0 additions & 1 deletion contrib/auth-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def get_signing_headers(
body,
blinded: bool = True,
):

assert len(server_pk) == 32
assert len(nonce) == 16

Expand Down
2 changes: 0 additions & 2 deletions contrib/pg-import.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@


with pgsql.transaction():

curin = old.cursor()
curout = pgsql.cursor()

Expand Down Expand Up @@ -131,7 +130,6 @@
curout.execute("ALTER TABLE rooms DROP CONSTRAINT room_image_fk")

def copy(table):

cols = [r['name'] for r in curin.execute(f"PRAGMA table_info({table})")]
if not cols:
raise RuntimeError(f"Expected table {table} does not exist in sqlite db")
Expand Down
2 changes: 1 addition & 1 deletion contrib/uwsgi-sogs-standalone.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ processes = 2
enable-threads = true
http = :80
mount = /=sogs.web:app
mule = sogs.mule:run
mule = @(call://sogs.mule.Mule)
log-4xx = true
log-5xx = true
disable-logging = true
4 changes: 1 addition & 3 deletions sogs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def parse_and_set_perm_flags(flags, perm_setting):
sys.exit(2)

elif update_room:

rooms = []
all_rooms = False
global_rooms = False
Expand Down Expand Up @@ -577,8 +576,7 @@ def parse_and_set_perm_flags(flags, perm_setting):
if args.name is not None:
if global_rooms or all_rooms:
print(
"Error: --rooms cannot be '+' or '*' (i.e. global/all) with --name",
file=sys.stderr,
"Error: --rooms cannot be '+' or '*' (i.e. global/all) with --name", file=sys.stderr
)
sys.exit(1)

Expand Down
1 change: 0 additions & 1 deletion sogs/migrations/file_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


def migrate(conn, *, check_only):

from .. import db

fix_fk = False
Expand Down
2 changes: 1 addition & 1 deletion sogs/migrations/import_hacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def migrate(conn, *, check_only):
rows = conn.execute(
"SELECT room, old_message_id_max, message_id_offset FROM room_import_hacks"
)
for (room, id_max, offset) in rows:
for room, id_max, offset in rows:
db.ROOM_IMPORT_HACKS[room] = (id_max, offset)

if not db.HAVE_FILE_ID_HACKS and 'room_import_hacks' not in db.metadata.tables:
Expand Down
2 changes: 0 additions & 2 deletions sogs/migrations/reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


def migrate(conn, *, check_only):

from .. import db

if 'user_reactions' in db.metadata.tables:
Expand Down Expand Up @@ -177,7 +176,6 @@ def migrate(conn, *, check_only):
)

else: # postgresql

if 'seqno_data' not in db.metadata.tables['messages'].c:
conn.execute(
"""
Expand Down
5 changes: 0 additions & 5 deletions sogs/migrations/v_0_1_x.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def sqlite_connect_readonly(path):


def import_from_0_1_x(conn):

from .. import config, db, utils

# Old database database.db is a single table database containing just the list of rooms:
Expand Down Expand Up @@ -109,7 +108,6 @@ def ins_user(session_id):
)

with sqlite_connect_readonly(room_db_path) as rconn:

# Messages were stored in this:
#
# CREATE TABLE IF NOT EXISTS messages (
Expand Down Expand Up @@ -235,7 +233,6 @@ def ins_user(session_id):
and data in (None, "deleted")
and signature in (None, "deleted")
):

# Deleted message; we still need to insert a tombstone for it, and copy the
# deletion id as the "seqno" field. (We do this with a second query
# because the first query is going to trigger an automatic update of the
Expand Down Expand Up @@ -340,7 +337,6 @@ def ins_user(session_id):
n_files = rconn.execute("SELECT COUNT(*) FROM files").fetchone()[0]

for file_id, timestamp in rconn.execute("SELECT id, timestamp FROM files"):

# file_id is an integer value but stored in a TEXT field, of course.
file_id = int(file_id)

Expand Down Expand Up @@ -507,7 +503,6 @@ def ins_user(session_id):
""",
(import_cutoff,),
):

ins_user(session_id)
db.query(
"""
Expand Down
Loading