Skip to content

Commit 746a055

Browse files
committed
tweaks
2 parents 96afce1 + f994c3c commit 746a055

File tree

16 files changed

+437
-556
lines changed

16 files changed

+437
-556
lines changed

pyproject.toml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,40 +59,40 @@ scripts.celery-monitor = "country_workspace.__monitor__:run"
5959

6060
[dependency-groups]
6161
dev = [
62-
"bump2version>=1.0.1",
63-
"djade>=1.3.2",
64-
"django-browser-reload>=1.17",
65-
"django-webtest>=1.9.11",
66-
"factory-boy>=3.3",
67-
"freezegun>=1.5.1",
68-
"ipython>=8.29",
69-
"mypy>=1.11.2",
70-
"pdbpp>=0.10.3",
71-
"pip>=24.3.1",
72-
"pre-commit>=3.7.1",
73-
"pyquery>=2.0.1",
74-
"pytest>=8.2.2",
75-
"pytest-celery>=1",
76-
"pytest-coverage>=0",
77-
"pytest-django>=4.8",
78-
"pytest-echo>=1.7.3",
79-
"pytest-factoryboy>=2.7",
80-
"pytest-mock>=3.14",
81-
"pytest-recording>=0.13.2",
82-
"pytest-xdist>=3.6.1",
83-
"responses>=0.25.3",
84-
"ruff>=0.9.3",
85-
"seleniumbase>=4.35.7",
86-
"types-python-dateutil>=2.9.0.20241003",
87-
"types-requests>=2.31.0.6",
88-
"vcrpy>=6.0.2",
62+
"bump2version",
63+
"djade",
64+
"django-browser-reload",
65+
"django-webtest",
66+
"factory-boy",
67+
"freezegun",
68+
"ipython",
69+
"mypy",
70+
"pdbpp",
71+
"pip",
72+
"pre-commit",
73+
"pyquery",
74+
"pytest<8.4", # temp fix for pytest_factoryboy AttributeError: 'FixtureFunctionDefinition' object has no attribute '__pytest_wrapped__'
75+
"pytest-celery",
76+
"pytest-coverage",
77+
"pytest-django",
78+
"pytest-echo",
79+
"pytest-factoryboy",
80+
"pytest-mock",
81+
"pytest-recording",
82+
"pytest-xdist",
83+
"responses",
84+
"ruff",
85+
"seleniumbase",
86+
"types-python-dateutil",
87+
"types-requests",
88+
"vcrpy",
8989
]
9090

9191
docs = [
92-
"mkdocs>=1.6.1",
93-
"mkdocs-awesome-pages-plugin>=2.9.3",
94-
"mkdocs-gen-files>=0.5",
95-
"mkdocs-material>=9.5.36",
92+
"mkdocs",
93+
"mkdocs-awesome-pages-plugin",
94+
"mkdocs-gen-files",
95+
"mkdocs-material",
9696
"mkdocstrings-python",
9797
]
9898

src/country_workspace/contrib/hope/ddt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ApiCall:
1313
def __init__(self, panel: "WSHopePanel", data: dict[str, Any]) -> None:
1414
self.panel = panel
1515
self.url = data["url"]
16-
self.params = data["params"]
16+
self.params = data.get("params", {})
1717
self.signature = data["signature"]
1818

1919
def timing(self) -> Any:

src/country_workspace/contrib/kobo/api/client/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ def handle_paginated_response[T, U](
4646

4747

4848
def get_raw_asset_list(data: raw_common.ListResponse) -> list[raw_asset_list.Asset]:
49-
return [datum for datum in cast(raw_asset_list.AssetList, data)["results"] if datum["has_deployment"]]
49+
return [datum for datum in cast("raw_asset_list.AssetList", data)["results"] if datum["has_deployment"]]
5050

5151

5252
def get_raw_submission_list(data: raw_common.ListResponse) -> list[raw_submission_list.Submission]:
53-
return cast(raw_submission_list.SubmissionList, data)["results"]
53+
return cast("raw_submission_list.SubmissionList", data)["results"]
5454

5555

5656
def get_asset_list(data_getter: DataGetter, url: str) -> Generator[Asset, None, None]:

src/country_workspace/contrib/kobo/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def create_household(batch: Batch, submission: Submission, config: Config) -> Ho
7979
raw_household_fields = extract_household_data(submission, config["individual_records_field"])
8080
household_fields = normalize_json(raw_household_fields)
8181
return cast(
82-
Household,
82+
"Household",
8383
batch.program.households.create(
8484
batch=batch,
8585
flex_fields=clean_field_names(household_fields),

src/country_workspace/datasources/rdi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def process_households(sheet: Sheet, job: AsyncJob, batch: Batch, config: Config
8383

8484
try:
8585
mapping[household_key] = cast(
86-
Household,
86+
"Household",
8787
job.program.households.create(
8888
batch=batch,
8989
name=label,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated by Django 5.2.1 on 2025-06-17 09:11
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
(
9+
"country_workspace",
10+
"0014_office_enabled_program_enabled_alter_office_active",
11+
),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name="asyncjob",
17+
name="file",
18+
field=models.FileField(blank=True, null=True, upload_to="updates"),
19+
),
20+
]

src/country_workspace/models/jobs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
from django.utils.module_loading import import_string
77
from django_celery_boost.models import CeleryTaskModel
88

9-
from country_workspace.storages import MEDIA_STORAGE
10-
119

1210
class AsyncJob(CeleryTaskModel, models.Model):
1311
class JobType(models.TextChoices):
@@ -18,7 +16,7 @@ class JobType(models.TextChoices):
1816
type = models.CharField(max_length=50, choices=JobType.choices)
1917
program = models.ForeignKey("Program", related_name="jobs", on_delete=models.CASCADE, null=True, blank=True)
2018
batch = models.ForeignKey("Batch", related_name="jobs", on_delete=models.CASCADE, null=True, blank=True)
21-
file = models.FileField(storage=MEDIA_STORAGE, upload_to="updates", null=True, blank=True)
19+
file = models.FileField(upload_to="updates", null=True, blank=True)
2220
config = models.JSONField(default=dict, blank=True)
2321
action = models.CharField(max_length=500, blank=True, null=True)
2422
description = models.CharField(max_length=255, blank=True, null=True)
@@ -39,7 +37,7 @@ def queue_position(self) -> int:
3937

4038
@property
4139
def started(self) -> str:
42-
return self.task_info["started_at"]
40+
return self.task_info.get("started_at", None)
4341

4442
def execute(self) -> Any:
4543
sid = None

src/country_workspace/utils/flags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def hostname(value: str, request: "HttpRequest|None", **kwargs: "Any") -> bool:
5353
def env_var(value: str, **kwargs: Any) -> bool:
5454
if "=" in value:
5555
key, value = value.split("=")
56-
return os.environ.get(key, -1) == value
56+
return os.environ.get(key, "-1") == value
5757
return value.strip() in os.environ
5858

5959

src/country_workspace/web/templates/smart_admin/console.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{% block buttons %}
2727
<ul class="submit-row">
2828
{% for panel in panels %}
29-
{% with href="admin:"|add:panel.name %}
29+
{% with href="admin:console-"|add:panel.name %}
3030
<li><a class="button" href="{% url href %}{{ panel.url }}">{{ panel.label }}</a></li>
3131
{% endwith %}
3232
{% endfor %}

src/country_workspace/workspaces/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Meta:
2424

2525
@cached_property
2626
def program(self) -> "CountryProgram":
27-
return cast(CountryProgram, self.batch.program)
27+
return cast("CountryProgram", self.batch.program)
2828

2929
@cached_property
3030
def country_office(self) -> "DataChecker":

0 commit comments

Comments
 (0)