Skip to content

Commit 65e2bca

Browse files
committed
Add pre-commit configuration and update dependencies in pyproject.toml
1 parent f93442c commit 65e2bca

File tree

7 files changed

+159
-16
lines changed

7 files changed

+159
-16
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 24.4.2
4+
hooks:
5+
- id: black
6+
types: [python]
7+
files: ^(bases|components)/
8+
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.4.4
11+
hooks:
12+
- id: ruff
13+
types: [python]
14+
files: ^(bases|components)/

bases/rsptx/assignment_server_api/routers/instructor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ async def get_assignment_gb(
357357

358358
names = {}
359359
for ix, row in pt.iterrows():
360-
if type(row.first_name) is str and type(row.last_name) is str:
360+
if isinstance(row.first_name, str) and isinstance(row.last_name, str):
361361
names[row.username] = row.first_name + " " + row.last_name
362362

363363
# pt = pt.drop(columns=["username"], axis=1)
@@ -1222,9 +1222,9 @@ async def do_download_assignment(
12221222
csv_buffer,
12231223
media_type="text/csv",
12241224
)
1225-
response.headers[
1226-
"Content-Disposition"
1227-
] = f"attachment; filename=assignment_{assignment_id}.csv"
1225+
response.headers["Content-Disposition"] = (
1226+
f"attachment; filename=assignment_{assignment_id}.csv"
1227+
)
12281228

12291229
return response
12301230

components/rsptx/build_tools/build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ def wheel(config):
431431

432432
res = subprocess.run(lock_opts, capture_output=True)
433433
if res.returncode != 0:
434-
status[
435-
proj
436-
] = f"[red]Fail[/red] probable dependency conflict see {projdir}/build.log"
434+
status[proj] = (
435+
f"[red]Fail[/red] probable dependency conflict see {projdir}/build.log"
436+
)
437437
lt.update(generate_wheel_table(status))
438438
if config.verbose:
439439
console.print(

components/rsptx/db/crud/assignment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from typing import Optional, List
2-
from datetime import datetime
32
from fastapi import HTTPException, status
43
from asyncpg.exceptions import UniqueViolationError
54
from rsptx.validation import schemas

components/rsptx/lti1p3/pylti1p3/tool_config/abstract.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def check_iss_has_many_clients(self, iss: str) -> bool:
3939
return iss_type == IssuerToClientRelation.MANY_CLIENTS_IDS_PER_ISSUER
4040

4141
def set_iss_has_one_client(self, iss: str):
42-
self.issuers_relation_types[
43-
iss
44-
] = IssuerToClientRelation.ONE_CLIENT_ID_PER_ISSUER
42+
self.issuers_relation_types[iss] = (
43+
IssuerToClientRelation.ONE_CLIENT_ID_PER_ISSUER
44+
)
4545

4646
def set_iss_has_many_clients(self, iss: str):
47-
self.issuers_relation_types[
48-
iss
49-
] = IssuerToClientRelation.MANY_CLIENTS_IDS_PER_ISSUER
47+
self.issuers_relation_types[iss] = (
48+
IssuerToClientRelation.MANY_CLIENTS_IDS_PER_ISSUER
49+
)
5050

5151
async def find_registration(self, iss: str, *args, **kwargs) -> Registration:
5252
"""

poetry.lock

Lines changed: 130 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ json2xml = "^3.21.0"
127127
pytest-asyncio = "^0.24.0"
128128
openai = "^1.59.3"
129129
javalang = "^0.13.0"
130+
pre-commit = "^4.5.1"
131+
ruff = "^0.15.2"
130132

131133

132134

0 commit comments

Comments
 (0)