Skip to content

Commit fefdaeb

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 77df1d7 commit fefdaeb

14 files changed

Lines changed: 33 additions & 85 deletions

File tree

backend/api/users/tasks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from typing import Optional
1212

13-
1413
router = APIRouter(
1514
prefix="/users",
1615
tags=["users"],

backend/services/messaging/message_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,10 @@ async def send_team_join_notification(
542542
team_link = MessageService.get_team_link(team_name, team_id, False)
543543
user_link = MessageService.get_user_link(from_username)
544544
message.subject = f"You have been added to team {team_link}"
545-
message.message = f"You have been added to the team {team_link} as {role} by {user_link}.\
545+
message.message = (
546+
f"You have been added to the team {team_link} as {role} by {user_link}.\
546547
Access the {team_link}'s page to view more info about this team."
548+
)
547549
message.date = timestamp()
548550
message.read = False
549551
user = await UserService.get_user_by_id(to_user, db)

backend/services/project_search_service.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -458,26 +458,20 @@ async def _filter_projects(
458458
tsquery_search = " & ".join([x for x in search_text.split(" ") if x])
459459
ilike_search = f"%{search_text}%"
460460

461-
subquery_filters.append(
462-
"""
461+
subquery_filters.append("""
463462
text_searchable @@ to_tsquery('english', :tsquery_search)
464463
OR name ILIKE :text_search
465-
"""
466-
)
464+
""")
467465
params["tsquery_search"] = tsquery_search
468466
params["text_search"] = ilike_search
469467

470-
filters.append(
471-
"""
468+
filters.append("""
472469
p.id = ANY(
473470
SELECT project_id
474471
FROM project_info
475472
WHERE {}
476473
)
477-
""".format(
478-
" AND ".join(subquery_filters)
479-
)
480-
)
474+
""".format(" AND ".join(subquery_filters)))
481475

482476
if search_dto.project_statuses:
483477
statuses = [
@@ -697,17 +691,13 @@ async def _filter_projects(
697691
)
698692
params["partnership_to"] = partnership_to
699693

700-
filters.append(
701-
"""
694+
filters.append("""
702695
p.id = ANY(
703696
SELECT pp.project_id
704697
FROM project_partnerships pp
705698
WHERE {}
706699
)
707-
""".format(
708-
" AND ".join(partner_conditions)
709-
)
710-
)
700+
""".format(" AND ".join(partner_conditions)))
711701

712702
if search_dto.managed_by and user.role != UserRole.ADMIN.value:
713703
project_ids = await ProjectSearchService.get_managed_projects(user.id, db)

backend/services/stats_service.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -755,42 +755,36 @@ async def get_task_stats(
755755
values["org_id"] = int(org_id)
756756

757757
if org_name:
758-
filters.append(
759-
"""
758+
filters.append("""
760759
AND organisation_id = (
761760
SELECT id FROM organisations WHERE name = :org_name
762761
)
763-
"""
764-
)
762+
""")
765763
values["org_name"] = org_name
766764

767765
if campaign:
768-
filters.append(
769-
"""
766+
filters.append("""
770767
AND id IN (
771768
SELECT project_id FROM campaign_projects
772769
WHERE campaign_id = (
773770
SELECT id FROM campaigns WHERE name = :campaign
774771
)
775772
)
776-
"""
777-
)
773+
""")
778774
values["campaign"] = campaign
779775

780776
if project_id:
781777
filters.append("AND id = ANY(:project_id)")
782778
values["project_id"] = project_id
783779

784780
if country:
785-
filters.append(
786-
"""
781+
filters.append("""
787782
AND EXISTS (
788783
SELECT 1
789784
FROM unnest(country) AS c
790785
WHERE c ILIKE :country
791786
)
792-
"""
793-
)
787+
""")
794788
values["country"] = f"%{country}%"
795789

796790
final_query = base_query.format(filters=" ".join(filters))

backend/services/users/user_service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
from backend.services.mapping_levels import MappingLevelService
5252
from fastapi import HTTPException
5353

54-
5554
settings = Settings()
5655

5756

migrations/versions/451f6bd05a19_.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717

1818
def upgrade():
1919
op.execute("DROP TRIGGER IF EXISTS tsvectorupdate ON project_info;")
20-
op.execute(
21-
"""
20+
op.execute("""
2221
CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON project_info FOR EACH ROW EXECUTE PROCEDURE
2322
tsvector_update_trigger(text_searchable, "pg_catalog.english", project_id_str, short_description, description)
24-
"""
25-
)
23+
""")
2624

2725

2826
def downgrade():

migrations/versions/763165f937cf_.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from alembic import op
1010
import sqlalchemy as sa
1111

12-
1312
# revision identifiers, used by Alembic.
1413
revision = "763165f937cf"
1514
down_revision = "4489b9e235f8"

migrations/versions/7bbc01082457_.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,9 @@ def upgrade():
255255

256256
if mapped_org not in orgs_inserted:
257257
org_managers[mapped_org] = org_manager
258-
conn.execute(
259-
sa.text(
260-
"insert into organisation_managers \
258+
conn.execute(sa.text("insert into organisation_managers \
261259
(organisation_id,user_id) \
262-
values("
263-
+ org_id
264-
+ ","
265-
+ org_manager
266-
+ ")"
267-
)
268-
)
260+
values(" + org_id + "," + org_manager + ")"))
269261
print(
270262
str(count)
271263
+ "/"

migrations/versions/909c5b13b1fc_.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,28 @@
1717

1818
def upgrade():
1919
conn = op.get_bind()
20-
cur = conn.execute(
21-
sa.text(
22-
"""
20+
cur = conn.execute(sa.text("""
2321
INSERT INTO mapping_badges (name, description, requirements, is_enabled, is_internal)
2422
VALUES
2523
('INTERMEDIATE_internal', '', '{\"changeset\": 250}', true, true),
2624
('ADVANCED_internal', '', '{\"changeset\": 500}', true, true)
2725
RETURNING id
28-
"""
29-
)
30-
)
26+
"""))
3127
ids = [r[0] for r in cur.fetchall()]
3228

3329
conn.execute(
34-
sa.text(
35-
"""
30+
sa.text("""
3631
INSERT INTO mapping_level_badges (level_id, badge_id)
3732
VALUES (:level_id, :badge_id)
38-
"""
39-
),
33+
"""),
4034
{"level_id": 2, "badge_id": ids[0]},
4135
)
4236

4337
conn.execute(
44-
sa.text(
45-
"""
38+
sa.text("""
4639
INSERT INTO mapping_level_badges (level_id, badge_id)
4740
VALUES (:level_id, :badge_id)
48-
"""
49-
),
41+
"""),
5042
{"level_id": 3, "badge_id": ids[1]},
5143
)
5244

migrations/versions/b720f42ce3e8_.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from alembic import op
1010
import sqlalchemy as sa
1111

12-
1312
# revision identifiers, used by Alembic.
1413
revision = "b720f42ce3e8"
1514
down_revision = "763165f937cf"

0 commit comments

Comments
 (0)