Skip to content

Commit ffcf8c3

Browse files
committed
flake8/black reformatting
1 parent b35485a commit ffcf8c3

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
per-file-ignores = __init__.py:F401 sogs/session_pb2.py:E501
33
max-line-length = 100
44
extend-ignore = E203 # See https://github.com/psf/black/issues/315
5+
exclude=sogs/config.py

sogs/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from . import config
88
from . import model
99
from . import crypto
10-
from . import logging
10+
from . import logging # noqa: F401
1111

1212
ap = AP(epilog="""
1313
@@ -25,7 +25,7 @@
2525
# List room info:
2626
python3 -msogs -L
2727
28-
""", formatter_class=RawDescriptionHelpFormatter)
28+
""", formatter_class=RawDescriptionHelpFormatter) # noqa: E501
2929

3030
actions = ap.add_mutually_exclusive_group()
3131

sogs/model.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ def messages_size(self):
126126
actually used to store the message, and does not include various ancillary metadata such as
127127
edit history, the signature, deleted entries, etc."""
128128
return db.conn.execute(
129-
"SELECT COUNT(*), COALESCE(SUM(data_size), 0) FROM messages WHERE room = ? AND data IS NOT NULL",
129+
"""
130+
SELECT COUNT(*), COALESCE(SUM(data_size), 0)
131+
FROM messages
132+
WHERE room = ? AND data IS NOT NULL
133+
""",
130134
(self.id,),
131135
).fetchone()[0:2]
132136

@@ -438,8 +442,8 @@ def get_all_global_moderators():
438442
m, hm, a, ha = [], [], [], []
439443
for row in db.conn.execute("SELECT * FROM users WHERE moderator"):
440444
u = User(row=row)
441-
l = ((a if u.global_admin else m) if u.visible_mod else (ha if u.global_admin else hm))
442-
l.append(u)
445+
lst = (a if u.global_admin else m) if u.visible_mod else (ha if u.global_admin else hm)
446+
lst.append(u)
443447

444448
return (m, a, hm, ha)
445449

sogs/onion_request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ def handle_onionreq_plaintext(body):
9090
response = app.full_dispatch_request()
9191
if response.status_code == 200:
9292
data = response.get_data()
93-
app.logger.debug("Onion sub-request for {} returned success, {} bytes".format(endpoint, len(data)))
93+
app.logger.debug(
94+
"Onion sub-request for {} returned success, {} bytes".format(
95+
endpoint, len(data)
96+
)
97+
)
9498
return data
9599
app.logger.warn(
96100
"Onion sub-request for {} {} returned status {}".format(

sogs/web.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
app = flask.Flask(__name__)
44

5-
from . import logging
6-
from . import routes
7-
from . import onion_request
8-
from . import legacy_routes
9-
from . import cleanup
5+
from . import logging # noqa: F401, E402
6+
from . import routes # noqa: F401, E402
7+
from . import onion_request # noqa: F401, E402
8+
from . import legacy_routes # noqa: F401, E402
9+
from . import cleanup # noqa: F401, E402
1010

1111
# Monkey-patch app.get/post/etc. for Flask <2 compatibility
1212
if not hasattr(flask.Flask, 'post'):

0 commit comments

Comments
 (0)