Skip to content

Commit 0edccad

Browse files
committed
Fixed formatter (was expecting a subdirectory), added install prereqs to docs workflow.
1 parent 45a5d96 commit 0edccad

56 files changed

Lines changed: 910 additions & 953 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: actions-ext/python/setup@main
15+
- run: |
16+
sudo apt-get update
17+
sudo apt-get install -y libldap2-dev libssl-dev libsasl2-dev
1518
- run: uv pip install .
1619
- run: uv pip install yardang
1720
- run: yardang build

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ lint: ## run python linter with ruff
2525
lints: lint
2626

2727
fix: ## fix python formatting with ruff
28-
python -m ruff check --fix teaching_time_tool
29-
python -m ruff format teaching_time_tool
28+
python -m ruff check --fix teaching_time_tool app
29+
python -m ruff format teaching_time_tool app
3030

3131
# alias
3232
format: fix

app/admin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class AcademicGroupAdmin(ModelAdmin):
1717
Admin class for the AcademicGroup model.
1818
Uses the default settings, but here in case it needs expanding.
1919
"""
20+
2021
pass
2122

2223

@@ -26,6 +27,7 @@ class UnitAdmin(ModelAdmin):
2627
Admin class for the Module model.
2728
Uses the default settings, but here in case it needs expanding.
2829
"""
30+
2931
pass
3032

3133

@@ -35,6 +37,7 @@ class AssignmentAdmin(ModelAdmin):
3537
Admin class for the Assignment model.
3638
Uses the default settings, but here in case it needs expanding.
3739
"""
40+
3841
pass
3942

4043

@@ -44,6 +47,7 @@ class TaskAdmin(ModelAdmin):
4447
Admin class for the Task model.
4548
Uses the default settings, but here in case it needs expanding.
4649
"""
50+
4751
pass
4852

4953

@@ -53,6 +57,7 @@ class StandardLoadAdmin(ModelAdmin):
5357
Admin class for the StandardLoad model.
5458
Uses the default settings, but here in case it needs expanding.
5559
"""
60+
5661
pass
5762

5863

@@ -62,4 +67,5 @@ class StaffAdmin(ModelAdmin):
6267
Admin class for the Staff model.
6368
Uses the default settings, but here in case it needs expanding.
6469
"""
70+
6571
pass

app/assets.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
from iommi import Asset
44

55
mathjax_js: Dict[str, Any] = dict(
6-
mathjax_inline = Asset.js(
7-
attrs__src='/static/js/mathjax-inline.js'
8-
),
9-
mathjax_js = Asset.js(
6+
mathjax_inline=Asset.js(attrs__src="/static/js/mathjax-inline.js"),
7+
mathjax_js=Asset.js(
108
attrs__id="MathJax-script",
119
attrs__src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js",
1210
attrs__async=True,
13-
)
11+
),
1412
)
1513

1614
autosize_js: Dict[str, Any] = dict(
17-
autoexpand_js = Asset.js(
18-
attrs__src='/static/js/autosize.js',
15+
autoexpand_js=Asset.js(
16+
attrs__src="/static/js/autosize.js",
1917
attrs__defer=True,
2018
)
2119
)

app/auth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Adds access-checking functions that test the permissions on the model.
33
"""
4+
45
from typing import Any, Callable, Type, Unpack
56

67
from django.contrib.auth.models import AbstractUser, AnonymousUser
@@ -17,6 +18,7 @@ def has_access_decoder(model: Type[ModelCommon], message: str) -> Callable[[str,
1718
:param message: The message to show on failed access.
1819
:return: A function that decodes access for that model
1920
"""
21+
2022
def has_access_decoder_inner(string: str, request: HttpRequest, **_: Unpack[Any]) -> ModelCommon:
2123
"""
2224
Given a URL string key and a user, returns the model associated with that string if the user has permission.
@@ -34,7 +36,7 @@ def has_access_decoder_inner(string: str, request: HttpRequest, **_: Unpack[Any]
3436
return has_access_decoder_inner
3537

3638

37-
def has_staff_access(user: AbstractUser|AnonymousUser) -> bool:
39+
def has_staff_access(user: AbstractUser | AnonymousUser) -> bool:
3840
"""
3941
Checks if the user is signed in and staff, or if security is off for debugging.
4042

app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class MyConfig(AppConfig):
5-
name = 'cfg'
5+
name = "cfg"

app/forms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from django import forms
1+
from django import forms

app/forms/academic_group.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66

77
class AcademicGroupDetailForm(Form):
88
class Meta:
9-
auto=dict(
9+
auto = dict(
1010
model=AcademicGroup,
1111
exclude=[
12-
'code', 'short_name', 'name', 'load_balance_final',
13-
]
12+
"code",
13+
"short_name",
14+
"name",
15+
"load_balance_final",
16+
],
1417
)
15-
fields=dict(
18+
fields = dict(
1619
load_balance=Field.integer(
1720
display_name="Load Balance",
1821
group="Row",
@@ -24,8 +27,8 @@ class Meta:
2427
non_editable_input__attrs__class=lambda field, **_: get_balance_classes_form(field.value),
2528
),
2629
)
27-
editable=False
28-
include=lambda request, **_: request.user.is_staff
29-
instance=lambda academic_group, **_: academic_group
30+
editable = False
31+
include = lambda request, **_: request.user.is_staff
32+
instance = lambda academic_group, **_: academic_group
3033

3134
iommi_style = floating_fields_style

app/forms/assignment.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@
99

1010

1111
class AssignmentTaskUniqueForm(Form):
12-
"""
12+
""" """
1313

14-
"""
1514
class Meta:
1615
auto = dict(
1716
model=Assignment,
1817
include=[
19-
'task', 'staff', 'students', 'is_first_time', 'is_provisional',
20-
]
18+
"task",
19+
"staff",
20+
"students",
21+
"is_first_time",
22+
"is_provisional",
23+
],
2124
)
2225
title = "Assignment"
2326
fields = dict(
@@ -34,13 +37,13 @@ class Meta:
3437
is_first_time__group="Row",
3538
is_provisional__group="Row",
3639
)
37-
extra__redirect_to='.'
38-
actions__submit=dict(
40+
extra__redirect_to = "."
41+
actions__submit = dict(
3942
display_name="Save",
4043
attrs__class={
4144
"btn-primary": False,
4245
"btn-success": True,
43-
}
46+
},
4447
)
4548

4649
@staticmethod

app/forms/info.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,24 @@ class InfoForm(Form):
1111
1212
Redirects to the 'page' the info is for on submission.
1313
"""
14+
1415
class Meta:
1516
auto = dict(
1617
model=Info,
17-
include=['text'],
18+
include=["text"],
1819
)
1920
fields__text__template = Template("{% load markdownify %}{{ field.value | markdownify }}")
20-
attrs__class = {'position-relative': True}
21+
attrs__class = {"position-relative": True}
2122
actions__edit = Action.icon(
2223
display_name=" ", # If it's empty/none, it's 'Edit'
2324
icon=settings.ICON_EDIT,
2425
attrs__class={
25-
'btn': True, 'btn-warning': True, 'btn-sm': True,
26-
'position-absolute': True, 'bottom-0': True, 'end-0': True,
26+
"btn": True,
27+
"btn-warning": True,
28+
"btn-sm": True,
29+
"position-absolute": True,
30+
"bottom-0": True,
31+
"end-0": True,
2732
},
2833
include=lambda user, **_: user.is_staff,
2934
attrs__href=lambda instance, **_: instance.get_edit_url(),

0 commit comments

Comments
 (0)