Skip to content

Commit 87c49a8

Browse files
Ruff updates:
120 line length Single quotes
1 parent ab44b1c commit 87c49a8

26 files changed

+590
-732
lines changed

config.env.py

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,68 +8,70 @@
88

99
# Flask config
1010
DEBUG = False
11-
IP = environ.get("PACKET_IP", "localhost")
12-
PORT = environ.get("PACKET_PORT", "8000")
13-
PROTOCOL = environ.get("PACKET_PROTOCOL", "https://")
14-
SERVER_NAME = environ.get("PACKET_SERVER_NAME", IP + ":" + PORT)
15-
SECRET_KEY = environ.get("PACKET_SECRET_KEY", "PLEASE_REPLACE_ME")
11+
IP = environ.get('PACKET_IP', 'localhost')
12+
PORT = environ.get('PACKET_PORT', '8000')
13+
PROTOCOL = environ.get('PACKET_PROTOCOL', 'https://')
14+
SERVER_NAME = environ.get('PACKET_SERVER_NAME', IP + ':' + PORT)
15+
SECRET_KEY = environ.get('PACKET_SECRET_KEY', 'PLEASE_REPLACE_ME')
1616

1717
# Logging config
18-
LOG_LEVEL = environ.get("PACKET_LOG_LEVEL", "INFO")
18+
LOG_LEVEL = environ.get('PACKET_LOG_LEVEL', 'INFO')
1919

2020
# OpenID Connect SSO config
21-
REALM = environ.get("PACKET_REALM", "csh")
21+
REALM = environ.get('PACKET_REALM', 'csh')
2222

23-
OIDC_ISSUER = environ.get("PACKET_OIDC_ISSUER", "https://sso.csh.rit.edu/auth/realms/csh")
24-
OIDC_CLIENT_ID = environ.get("PACKET_OIDC_CLIENT_ID", "packet")
25-
OIDC_CLIENT_SECRET = environ.get("PACKET_OIDC_CLIENT_SECRET", "PLEASE_REPLACE_ME")
23+
OIDC_ISSUER = environ.get('PACKET_OIDC_ISSUER', 'https://sso.csh.rit.edu/auth/realms/csh')
24+
OIDC_CLIENT_ID = environ.get('PACKET_OIDC_CLIENT_ID', 'packet')
25+
OIDC_CLIENT_SECRET = environ.get('PACKET_OIDC_CLIENT_SECRET', 'PLEASE_REPLACE_ME')
2626

2727
# SQLAlchemy config
28-
SQLALCHEMY_DATABASE_URI = environ.get("PACKET_DATABASE_URI", "postgresql://postgres:mysecretpassword@localhost:5432/postgres")
28+
SQLALCHEMY_DATABASE_URI = environ.get(
29+
'PACKET_DATABASE_URI', 'postgresql://postgres:mysecretpassword@localhost:5432/postgres'
30+
)
2931
SQLALCHEMY_TRACK_MODIFICATIONS = False
3032

3133
# LDAP config
32-
LDAP_BIND_DN = environ.get("PACKET_LDAP_BIND_DN", None)
33-
LDAP_BIND_PASS = environ.get("PACKET_LDAP_BIND_PASS", None)
34+
LDAP_BIND_DN = environ.get('PACKET_LDAP_BIND_DN', None)
35+
LDAP_BIND_PASS = environ.get('PACKET_LDAP_BIND_PASS', None)
3436
LDAP_MOCK_MEMBERS = [
35-
{'uid':'evals', 'groups': ['eboard', 'eboard-evaluations', 'active']},
36-
{'uid':'imps-3da', 'groups': ['eboard', 'eboard-imps', '3da', 'active']},
37-
{
38-
'uid':'rtp-cm-webs-onfloor',
39-
'groups': ['active-rtp', 'rtp', 'constitutional_maintainers', 'webmaster', 'active', 'onfloor'],
40-
'room_number': 1024
41-
},
42-
{'uid':'misc-rtp', 'groups': ['rtp']},
43-
{'uid':'onfloor', 'groups': ['active', 'onfloor'], 'room_number': 1024},
44-
{'uid':'active-offfloor', 'groups': ['active']},
45-
{'uid':'alum', 'groups': ['member']},
46-
]
37+
{'uid': 'evals', 'groups': ['eboard', 'eboard-evaluations', 'active']},
38+
{'uid': 'imps-3da', 'groups': ['eboard', 'eboard-imps', '3da', 'active']},
39+
{
40+
'uid': 'rtp-cm-webs-onfloor',
41+
'groups': ['active-rtp', 'rtp', 'constitutional_maintainers', 'webmaster', 'active', 'onfloor'],
42+
'room_number': 1024,
43+
},
44+
{'uid': 'misc-rtp', 'groups': ['rtp']},
45+
{'uid': 'onfloor', 'groups': ['active', 'onfloor'], 'room_number': 1024},
46+
{'uid': 'active-offfloor', 'groups': ['active']},
47+
{'uid': 'alum', 'groups': ['member']},
48+
]
4749

4850
# Mail Config
49-
MAIL_PROD = strtobool(environ.get("PACKET_MAIL_PROD", "False"))
50-
MAIL_SERVER = environ.get("PACKET_MAIL_SERVER", "thoth.csh.rit.edu")
51-
MAIL_USERNAME = environ.get("PACKET_MAIL_USERNAME", "[email protected]")
52-
MAIL_PASSWORD = environ.get("PACKET_MAIL_PASSWORD", None)
53-
MAIL_USE_TLS = strtobool(environ.get("PACKET_MAIL_TLS", "True"))
51+
MAIL_PROD = strtobool(environ.get('PACKET_MAIL_PROD', 'False'))
52+
MAIL_SERVER = environ.get('PACKET_MAIL_SERVER', 'thoth.csh.rit.edu')
53+
MAIL_USERNAME = environ.get('PACKET_MAIL_USERNAME', '[email protected]')
54+
MAIL_PASSWORD = environ.get('PACKET_MAIL_PASSWORD', None)
55+
MAIL_USE_TLS = strtobool(environ.get('PACKET_MAIL_TLS', 'True'))
5456

5557
# OneSignal Config
56-
ONESIGNAL_USER_AUTH_KEY = environ.get("PACKET_ONESIGNAL_USER_AUTH_KEY", None)
57-
ONESIGNAL_CSH_APP_AUTH_KEY = environ.get("PACKET_ONESIGNAL_CSH_APP_AUTH_KEY", None)
58-
ONESIGNAL_CSH_APP_ID = environ.get("PACKET_ONESIGNAL_CSH_APP_ID", "6eff123a-0852-4027-804e-723044756f00")
59-
ONESIGNAL_INTRO_APP_AUTH_KEY = environ.get("PACKET_ONESIGNAL_INTRO_APP_AUTH_KEY", None)
60-
ONESIGNAL_INTRO_APP_ID = environ.get("PACKET_ONESIGNAL_INTRO_APP_ID", "6eff123a-0852-4027-804e-723044756f00")
58+
ONESIGNAL_USER_AUTH_KEY = environ.get('PACKET_ONESIGNAL_USER_AUTH_KEY', None)
59+
ONESIGNAL_CSH_APP_AUTH_KEY = environ.get('PACKET_ONESIGNAL_CSH_APP_AUTH_KEY', None)
60+
ONESIGNAL_CSH_APP_ID = environ.get('PACKET_ONESIGNAL_CSH_APP_ID', '6eff123a-0852-4027-804e-723044756f00')
61+
ONESIGNAL_INTRO_APP_AUTH_KEY = environ.get('PACKET_ONESIGNAL_INTRO_APP_AUTH_KEY', None)
62+
ONESIGNAL_INTRO_APP_ID = environ.get('PACKET_ONESIGNAL_INTRO_APP_ID', '6eff123a-0852-4027-804e-723044756f00')
6163

6264
# Sentry Config
63-
SENTRY_DSN = environ.get("PACKET_SENTRY_DSN", "")
65+
SENTRY_DSN = environ.get('PACKET_SENTRY_DSN', '')
6466

6567
# Slack URL for pushing to #general
66-
SLACK_WEBHOOK_URL = environ.get("PACKET_SLACK_URL", None)
68+
SLACK_WEBHOOK_URL = environ.get('PACKET_SLACK_URL', None)
6769

6870
# Packet Config
69-
PACKET_UPPER = environ.get("PACKET_UPPER", "packet.csh.rit.edu")
70-
PACKET_INTRO = environ.get("PACKET_INTRO", "freshmen-packet.csh.rit.edu")
71+
PACKET_UPPER = environ.get('PACKET_UPPER', 'packet.csh.rit.edu')
72+
PACKET_INTRO = environ.get('PACKET_INTRO', 'freshmen-packet.csh.rit.edu')
7173

7274
# RUM
73-
RUM_APP_ID = environ.get("PACKET_RUM_APP_ID", "")
74-
RUM_CLIENT_TOKEN = environ.get("PACKET_RUM_CLIENT_TOKEN","")
75-
DD_ENV = environ.get("DD_ENV", "local-dev")
75+
RUM_APP_ID = environ.get('PACKET_RUM_APP_ID', '')
76+
RUM_CLIENT_TOKEN = environ.get('PACKET_RUM_CLIENT_TOKEN', '')
77+
DD_ENV = environ.get('DD_ENV', 'local-dev')

migrations/env.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
# from myapp import mymodel
1919
# target_metadata = mymodel.Base.metadata
2020
from flask import current_app
21-
config.set_main_option('sqlalchemy.url',
22-
current_app.config.get('SQLALCHEMY_DATABASE_URI'))
21+
22+
config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI'))
2323
target_metadata = current_app.extensions['migrate'].db.metadata
2424

2525
# other values from the config, defined by the needs of env.py,
@@ -40,7 +40,7 @@ def run_migrations_offline():
4040
script output.
4141
4242
"""
43-
url = config.get_main_option("sqlalchemy.url")
43+
url = config.get_main_option('sqlalchemy.url')
4444
context.configure(url=url)
4545

4646
with context.begin_transaction():
@@ -65,22 +65,25 @@ def process_revision_directives(context, revision, directives):
6565
directives[:] = []
6666
logger.info('No changes in schema detected.')
6767

68-
engine = engine_from_config(config.get_section(config.config_ini_section),
69-
prefix='sqlalchemy.',
70-
poolclass=pool.NullPool)
68+
engine = engine_from_config(
69+
config.get_section(config.config_ini_section), prefix='sqlalchemy.', poolclass=pool.NullPool
70+
)
7171

7272
connection = engine.connect()
73-
context.configure(connection=connection,
74-
target_metadata=target_metadata,
75-
process_revision_directives=process_revision_directives,
76-
**current_app.extensions['migrate'].configure_args)
73+
context.configure(
74+
connection=connection,
75+
target_metadata=target_metadata,
76+
process_revision_directives=process_revision_directives,
77+
**current_app.extensions['migrate'].configure_args,
78+
)
7779

7880
try:
7981
with context.begin_transaction():
8082
context.run_migrations()
8183
finally:
8284
connection.close()
8385

86+
8487
if context.is_offline_mode():
8588
run_migrations_offline()
8689
else:

migrations/versions/0eeabc7d8f74_general_schema_cleanup_and_improvements.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2018-08-31 18:07:19.767140
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

migrations/versions/53768f0a4850_notifications.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2019-08-06 22:15:04.400982
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

@@ -18,12 +19,16 @@
1819

1920
def upgrade():
2021
# ### commands auto generated by Alembic - please adjust! ###
21-
op.create_table('notification_subscriptions',
22-
sa.Column('member', sa.String(length=36), nullable=True),
23-
sa.Column('freshman_username', sa.String(length=10), nullable=True),
24-
sa.Column('token', sa.String(length=256), nullable=False),
25-
sa.ForeignKeyConstraint(['freshman_username'], ['freshman.rit_username'], ),
26-
sa.PrimaryKeyConstraint('token')
22+
op.create_table(
23+
'notification_subscriptions',
24+
sa.Column('member', sa.String(length=36), nullable=True),
25+
sa.Column('freshman_username', sa.String(length=10), nullable=True),
26+
sa.Column('token', sa.String(length=256), nullable=False),
27+
sa.ForeignKeyConstraint(
28+
['freshman_username'],
29+
['freshman.rit_username'],
30+
),
31+
sa.PrimaryKeyConstraint('token'),
2732
)
2833
# ### end Alembic commands ###
2934

@@ -32,4 +37,3 @@ def downgrade():
3237
# ### commands auto generated by Alembic - please adjust! ###
3338
op.drop_table('notification_subscriptions')
3439
# ### end Alembic commands ###
35-

migrations/versions/a243fac8a399_add_wiki_maintainers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2020-09-02 15:20:48.285910
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

migrations/versions/b1c013f236ab_initial_db_schema.py

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""Initial db schema
22
33
Revision ID: b1c013f236ab
4-
Revises:
4+
Revises:
55
Create Date: 2018-07-28 18:26:53.716828
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

@@ -18,47 +19,67 @@
1819

1920
def upgrade():
2021
# ### commands auto generated by Alembic - please adjust! ###
21-
op.create_table('freshman',
22-
sa.Column('rit_username', sa.String(length=10), nullable=False),
23-
sa.Column('name', sa.String(length=64), nullable=False),
24-
sa.Column('onfloor', sa.Boolean(), nullable=False),
25-
sa.PrimaryKeyConstraint('rit_username')
22+
op.create_table(
23+
'freshman',
24+
sa.Column('rit_username', sa.String(length=10), nullable=False),
25+
sa.Column('name', sa.String(length=64), nullable=False),
26+
sa.Column('onfloor', sa.Boolean(), nullable=False),
27+
sa.PrimaryKeyConstraint('rit_username'),
2628
)
27-
op.create_table('packet',
28-
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
29-
sa.Column('freshman_username', sa.String(length=10), nullable=True),
30-
sa.Column('start', sa.DateTime(), nullable=False),
31-
sa.Column('end', sa.DateTime(), nullable=False),
32-
sa.Column('info_eboard', sa.Text(), nullable=True),
33-
sa.Column('info_events', sa.Text(), nullable=True),
34-
sa.Column('info_achieve', sa.Text(), nullable=True),
35-
sa.ForeignKeyConstraint(['freshman_username'], ['freshman.rit_username'], ),
36-
sa.PrimaryKeyConstraint('id')
29+
op.create_table(
30+
'packet',
31+
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
32+
sa.Column('freshman_username', sa.String(length=10), nullable=True),
33+
sa.Column('start', sa.DateTime(), nullable=False),
34+
sa.Column('end', sa.DateTime(), nullable=False),
35+
sa.Column('info_eboard', sa.Text(), nullable=True),
36+
sa.Column('info_events', sa.Text(), nullable=True),
37+
sa.Column('info_achieve', sa.Text(), nullable=True),
38+
sa.ForeignKeyConstraint(
39+
['freshman_username'],
40+
['freshman.rit_username'],
41+
),
42+
sa.PrimaryKeyConstraint('id'),
3743
)
38-
op.create_table('signature_fresh',
39-
sa.Column('packet_id', sa.Integer(), nullable=False),
40-
sa.Column('freshman', sa.String(length=10), nullable=False),
41-
sa.Column('signed', sa.Boolean(), nullable=False),
42-
sa.Column('updated', sa.DateTime(), nullable=False),
43-
sa.ForeignKeyConstraint(['freshman'], ['freshman.rit_username'], ),
44-
sa.ForeignKeyConstraint(['packet_id'], ['packet.id'], ),
45-
sa.PrimaryKeyConstraint('packet_id', 'freshman')
44+
op.create_table(
45+
'signature_fresh',
46+
sa.Column('packet_id', sa.Integer(), nullable=False),
47+
sa.Column('freshman', sa.String(length=10), nullable=False),
48+
sa.Column('signed', sa.Boolean(), nullable=False),
49+
sa.Column('updated', sa.DateTime(), nullable=False),
50+
sa.ForeignKeyConstraint(
51+
['freshman'],
52+
['freshman.rit_username'],
53+
),
54+
sa.ForeignKeyConstraint(
55+
['packet_id'],
56+
['packet.id'],
57+
),
58+
sa.PrimaryKeyConstraint('packet_id', 'freshman'),
4659
)
47-
op.create_table('signature_misc',
48-
sa.Column('packet_id', sa.Integer(), nullable=False),
49-
sa.Column('member', sa.String(length=36), nullable=False),
50-
sa.Column('updated', sa.DateTime(), nullable=False),
51-
sa.ForeignKeyConstraint(['packet_id'], ['packet.id'], ),
52-
sa.PrimaryKeyConstraint('packet_id', 'member')
60+
op.create_table(
61+
'signature_misc',
62+
sa.Column('packet_id', sa.Integer(), nullable=False),
63+
sa.Column('member', sa.String(length=36), nullable=False),
64+
sa.Column('updated', sa.DateTime(), nullable=False),
65+
sa.ForeignKeyConstraint(
66+
['packet_id'],
67+
['packet.id'],
68+
),
69+
sa.PrimaryKeyConstraint('packet_id', 'member'),
5370
)
54-
op.create_table('signature_upper',
55-
sa.Column('packet_id', sa.Integer(), nullable=False),
56-
sa.Column('member', sa.String(length=36), nullable=False),
57-
sa.Column('signed', sa.Boolean(), nullable=False),
58-
sa.Column('eboard', sa.Boolean(), nullable=False),
59-
sa.Column('updated', sa.DateTime(), nullable=False),
60-
sa.ForeignKeyConstraint(['packet_id'], ['packet.id'], ),
61-
sa.PrimaryKeyConstraint('packet_id', 'member')
71+
op.create_table(
72+
'signature_upper',
73+
sa.Column('packet_id', sa.Integer(), nullable=False),
74+
sa.Column('member', sa.String(length=36), nullable=False),
75+
sa.Column('signed', sa.Boolean(), nullable=False),
76+
sa.Column('eboard', sa.Boolean(), nullable=False),
77+
sa.Column('updated', sa.DateTime(), nullable=False),
78+
sa.ForeignKeyConstraint(
79+
['packet_id'],
80+
['packet.id'],
81+
),
82+
sa.PrimaryKeyConstraint('packet_id', 'member'),
6283
)
6384
# ### end Alembic commands ###
6485

migrations/versions/eecf30892d0e_demote_eboard_deluxe.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2019-02-14 17:41:18.469840
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

@@ -23,19 +24,13 @@ def upgrade():
2324
op.add_column('signature_upper', sa.Column('drink_admin', sa.Boolean(), nullable=False, server_default='f'))
2425
op.add_column('signature_upper', sa.Column('three_da', sa.Boolean(), nullable=False, server_default='f'))
2526
op.add_column('signature_upper', sa.Column('webmaster', sa.Boolean(), nullable=False, server_default='f'))
26-
op.alter_column('signature_upper', 'eboard',
27-
existing_type=sa.BOOLEAN(),
28-
type_=sa.String(length=12),
29-
nullable=True)
27+
op.alter_column('signature_upper', 'eboard', existing_type=sa.BOOLEAN(), type_=sa.String(length=12), nullable=True)
3028
# ### end Alembic commands ###
3129

3230

3331
def downgrade():
3432
# ### commands auto generated by Alembic - please adjust! ###
35-
op.alter_column('signature_upper', 'eboard',
36-
existing_type=sa.String(length=12),
37-
type_=sa.BOOLEAN(),
38-
nullable=False)
33+
op.alter_column('signature_upper', 'eboard', existing_type=sa.String(length=12), type_=sa.BOOLEAN(), nullable=False)
3934
op.drop_column('signature_upper', 'webmaster')
4035
op.drop_column('signature_upper', 'three_da')
4136
op.drop_column('signature_upper', 'drink_admin')

migrations/versions/fe83600ef3fa_remove_essays.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2018-10-22 21:55:15.257440
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

0 commit comments

Comments
 (0)