Skip to content

Commit 648c863

Browse files
committed
Fix linting issues and sorting
1 parent dc0ef54 commit 648c863

19 files changed

+65
-48
lines changed

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Import os
2-
from os import getenv, path
32
from datetime import timedelta
3+
from os import getenv, path
44

55
from dotenv import load_dotenv
66

db_init.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
Then pass an Executable into Session.execute()
77
"""
88

9-
import sys
10-
import requests
119
import re
12-
10+
import sys
1311
from datetime import date, datetime
1412

13+
import requests
14+
1515
from labconnect import create_app, db
1616
from labconnect.helpers import LocationEnum, SemesterEnum
17-
from labconnect.models import LabManager # Professors and Grad students
1817
from labconnect.models import (
1918
ClassYears,
2019
Courses,
20+
LabManager, # Professors and Grad students
2121
Leads,
2222
Majors,
2323
Opportunities,
@@ -395,7 +395,8 @@ def main() -> None:
395395
),
396396
(
397397
"Data Science Research",
398-
"Work with a team of researchers to analyze large datasets and extract meaningful insights.",
398+
"Work with a team of researchers to analyze large datasets and "
399+
"extract meaningful insights.",
399400
"Python, Machine Learning, Data Analysis",
400401
20.0,
401402
True,

labconnect/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import json
22
import os
33
from datetime import datetime, timedelta, timezone
4-
5-
import sentry_sdk
6-
7-
# Import logging
84
from logging.config import dictConfig
95

10-
# Import Flask modules
6+
import sentry_sdk
117
from flask import Flask
128
from flask_cors import CORS
139
from flask_jwt_extended import (

labconnect/main/auth_routes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
from datetime import datetime, timedelta
22
from uuid import uuid4
33

4-
from flask import current_app, make_response, redirect, request, abort
4+
from flask import abort, current_app, make_response, redirect, request
55
from flask_jwt_extended import (
6-
get_jwt_identity,
76
create_access_token,
87
create_refresh_token,
8+
get_jwt_identity,
9+
jwt_required,
910
set_access_cookies,
1011
set_refresh_cookies,
1112
unset_jwt_cookies,
12-
jwt_required,
1313
)
1414
from onelogin.saml2.auth import OneLogin_Saml2_Auth
1515
from werkzeug.wrappers.response import Response
1616

1717
from labconnect import db
1818
from labconnect.helpers import prepare_flask_request
1919
from labconnect.models import (
20+
Codes,
21+
ManagementPermissions,
2022
User,
2123
UserCourses,
2224
UserDepartments,
2325
UserMajors,
24-
ManagementPermissions,
25-
Codes,
2626
)
2727

2828
from . import main_blueprint

labconnect/main/opportunity_routes.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
from flask import abort, request
44
from flask_jwt_extended import get_jwt_identity, jwt_required
5-
from sqlalchemy import func, case
5+
from sqlalchemy import case, func
66

77
from labconnect import db
88
from labconnect.helpers import (
99
LocationEnum,
1010
SemesterEnum,
11-
format_credits,
1211
convert_to_enum,
12+
format_credits,
1313
)
1414
from labconnect.models import (
15+
Courses,
1516
LabManager,
1617
Leads,
1718
Opportunities,
18-
RecommendsClassYears,
19-
User,
20-
Courses,
2119
Participates,
20+
RecommendsClassYears,
2221
RecommendsMajors,
22+
User,
2323
UserSavedOpportunities,
2424
)
2525
from labconnect.serializers import serialize_opportunity
@@ -149,7 +149,8 @@ def getOpportunity(opp_id: int):
149149
query = db.session.execute(
150150
db.select(
151151
Opportunities,
152-
# Creates an array for all of the recommended class years for the opportunity labeled recommended_years
152+
# Creates an array for all of the recommended class years for the
153+
# opportunity labeled recommended_years
153154
func.array_agg(RecommendsClassYears.class_year).label("recommended_years"),
154155
)
155156
.join(
@@ -317,7 +318,8 @@ def filterOpportunities():
317318
opportunity[0],
318319
lab_managers=", ".join(
319320
[
320-
f"{name.get('preferred_name', None) or name.get('first_name')} {name.get('last_name')}"
321+
f"{name.get('preferred_name', None) or name.get('first_name')} "
322+
f"{name.get('last_name')}"
321323
for name in opportunity[1]
322324
]
323325
),
@@ -404,7 +406,8 @@ def getProfileOpportunities(rcs_id: str) -> list[dict[str, str]]:
404406
# function to search for lab managers
405407
@main_blueprint.get("/searchLabManagers/<string:query>")
406408
def searchLabManagers(query: str):
407-
# Perform a search on User table by first name, last name, or email using ILIKE for exact partial matches
409+
# Perform a search on User table by first name, last name, or email using ILIKE
410+
# for exact partial matches
408411
stmt = (
409412
db.select(User)
410413
.join(LabManager, User.lab_manager_id == LabManager.id)
@@ -444,7 +447,9 @@ def searchLabManagers(query: str):
444447

445448
@main_blueprint.get("/searchCourses/<string:query>")
446449
def searchCourses(query: str):
447-
# Perform a search on Courses table by code and name using ILIKE for exact partial matches
450+
# Perform a search on Courses table by code and
451+
# name using ILIKE for exact partial matches
452+
# TODO: merge into filtering
448453
stmt = (
449454
db.select(Courses)
450455
.distinct()
@@ -880,7 +885,7 @@ def allSavedUserOportunities():
880885
return saved_opportunities_list, 200
881886

882887

883-
# Create route to allow for multiple pages to be unsaved given a list of opp_ids delete them
888+
# Create route to allow for multiple pages to be unsaved given a list of opp_ids
884889
@main_blueprint.delete("/UnsaveMultiplePages/")
885890
@jwt_required()
886891
# Delete id that appear on delete_ids list

labconnect/main/routes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
from typing import NoReturn
2+
23
from flask import abort, request
34
from flask_jwt_extended import get_jwt_identity, jwt_required
45

56
from labconnect import db
67
from labconnect.models import (
8+
ClassYears,
9+
Courses,
710
LabManager,
11+
Majors,
812
Opportunities,
913
RPIDepartments,
1014
User,
11-
ClassYears,
1215
UserDepartments,
13-
Majors,
14-
Courses,
1516
)
1617
from labconnect.serializers import serialize_course
1718

@@ -186,7 +187,6 @@ def changeActiveStatus() -> dict[str, bool]:
186187
if opportunity.active != setStatus:
187188
abort(500)
188189

189-
# if match is found, change the opportunities active status to true or false based on setStatus
190190
return {"activeStatus": opportunity}
191191

192192

labconnect/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
from labconnect import db
55
from labconnect.helpers import (
6+
LabManagerTypeEnum,
67
LocationEnum,
78
SemesterEnum,
8-
LabManagerTypeEnum,
99
)
1010

1111
# DD - Entities

labconnect/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from labconnect.models import Courses, Opportunities
21
from labconnect.helpers import format_credits
2+
from labconnect.models import Courses, Opportunities
33

44

55
def serialize_course(course: Courses) -> str:

migrations/env.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import logging
22
from logging.config import fileConfig
33

4-
from flask import current_app
5-
64
from alembic import context
5+
from flask import current_app
76

87
# this is the Alembic Config object, which provides
98
# access to the values within the .ini file in use.

migrations/versions/0e1d1657b500_.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
77
"""
88

9-
from alembic import op
109
import sqlalchemy as sa
11-
10+
from alembic import op
1211

1312
# revision identifiers, used by Alembic.
1413
revision = "0e1d1657b500"
@@ -23,8 +22,18 @@ def upgrade():
2322
op.execute("""
2423
DO $$
2524
BEGIN
26-
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'labmanagertypeenum') THEN
27-
CREATE TYPE labmanagertypeenum AS ENUM ('PI', 'CO_PI', 'LAB_MANAGER', 'POST_DOC', 'GRAD_STUDENT');
25+
IF NOT EXISTS (
26+
SELECT 1
27+
FROM pg_type
28+
WHERE typname = 'labmanagertypeenum'
29+
) THEN
30+
CREATE TYPE labmanagertypeenum AS ENUM (
31+
'PI',
32+
'CO_PI',
33+
'LAB_MANAGER',
34+
'POST_DOC',
35+
'GRAD_STUDENT'
36+
);
2837
END IF;
2938
END$$;
3039
""")

0 commit comments

Comments
 (0)