Skip to content

Commit 2544ea7

Browse files
authored
Merge pull request #765 from UTDNebula/python-packages
Update validator packages
2 parents 0ba40cd + 3785714 commit 2544ea7

File tree

12 files changed

+125
-66
lines changed

12 files changed

+125
-66
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Format Validator
2+
3+
on:
4+
push:
5+
paths:
6+
- 'validator/**'
7+
8+
jobs:
9+
main:
10+
name: Run Black
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
working-directory: validator
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.11'
25+
26+
- name: Install dependencies
27+
run: |
28+
pip3 install -r requirements.txt
29+
30+
- name: Run Black
31+
run: |
32+
black --check .

.github/workflows/validator_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919

20-
- uses: actions/setup-python@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
2122
with:
2223
python-version: '3.11'
2324

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ npm install
146146
cd validator
147147
python3.11 -m venv venv # Create virtual environment
148148
source venv/bin/activate # Use virtual enviornment
149+
#venv/Scripts/activate on Windows
149150
pip install -r requirements.txt # Install dependencies
150151
flask --app api run
151152
```

validator/core/matchers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,5 +277,5 @@ def list_matcher_requirements(matcher: Matcher) -> list[str]:
277277
Only supports NameList atm
278278
"""
279279
if not isinstance(matcher, NameListMatcher):
280-
raise NotImplemented
280+
raise NotImplementedError
281281
return [course for course in matcher.name_list]

validator/core/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Parser for *.req files."""
1+
"""Parser for *.req files."""
22

33
from core.requirement import Requirement
44
from core.matchers import Matcher

validator/core/requirement.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Requirement represents a degree requirements."""
2+
23
from utils import hashable
34
from core import matchers
45

validator/degree_solver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def __str__(self) -> str:
334334

335335

336336
def format_core_reqs(
337-
reqs: dict[str, core.store.AssignmentStoreJSON]
337+
reqs: dict[str, core.store.AssignmentStoreJSON],
338338
) -> list[AbstractRequirement]:
339339
core_reqs = []
340340
for req_name, req_info in reqs.items():

validator/gen_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def requirement_schema_to_empty_json_body(s: dict[str, Any]) -> dict[str, Any]:
166166

167167
snips = dict(
168168
zip(
169-
list(map(lambda curr: curr["matcher"]["const"], requirement_schemas)), # type: ignore
169+
list(map(lambda curr: curr["matcher"]["const"], requirement_schemas)),
170170
list(
171171
map(
172172
lambda curr: {
@@ -186,7 +186,7 @@ def requirement_schema_to_empty_json_body(s: dict[str, Any]) -> dict[str, Any]:
186186
)
187187
)
188188

189-
snips["$comment"] = f"Generated by {path.basename(__file__)} on {datetime.now()}" # type: ignore
189+
snips["$comment"] = f"Generated by {path.basename(__file__)} on {datetime.now()}"
190190

191191
with open(".vscode/major.schema.json", "w") as f:
192192
f.write(dumps(schema, indent=2))

validator/major/requirements/shared.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Definitions for shared requirements """
1+
"""Definitions for shared requirements"""
22

33
from __future__ import annotations
44
import json
@@ -330,9 +330,9 @@ def __init__(
330330
) -> None:
331331
self.required_hours = required_hours
332332
self.requirements = requirements
333-
self.valid_courses: dict[
334-
str, int
335-
] = valid_courses # Stores map of course & # hours fulfilled (i.e. {"CS 1200": 2}). This is done due to course splitting (1 course can be used to satisfy multiple requirements)
333+
self.valid_courses: dict[str, int] = (
334+
valid_courses # Stores map of course & # hours fulfilled (i.e. {"CS 1200": 2}). This is done due to course splitting (1 course can be used to satisfy multiple requirements)
335+
)
336336
self.metadata: dict[str, Any] = metadata
337337
self.override_filled = False
338338

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# TODO: implement
1+
# TODO: implement

0 commit comments

Comments
 (0)