Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ description = "Simple API for some (student) food places in Munich."
authors = [{ name = "TUM-Dev" }]
license = "MIT"
readme = "README.md"
requires-python = ">= 3.9"
requires-python = ">= 3.10"
dependencies = [
"lxml~=6.0",
"pyopenmensa~=0.95",
"requests~=2.32",
"deepl>=1.2.1",
"deepl~=1.28",
Comment on lines +8 to +13
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires-python was bumped to >=3.10 here, but the repo’s .python-version file (used by CI via actions/setup-python) still targets ">=3.9" and the README still mentions Python 3.9+. Please update .python-version (and any user-facing docs) to avoid CI/runtime inconsistencies now that code uses Python 3.10-only features (e.g., zip(..., strict=True)).

Copilot uses AI. Check for mistakes.
]

[dependency-groups]
dev = [
"mypy~=1.14",
"pre-commit~=4.1",
"pytest~=8.3",
"ruff>=0.11.4",
"syrupy~=4.0",
"mypy~=1.19",
"pre-commit~=4.3",
"pytest~=9.0",
"ruff>=0.15.5",
"syrupy~=5.0",
"types-requests~=2.32",
]

Expand Down
1 change: 1 addition & 0 deletions src/menu_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def __parse_dishes(menu_html: html.Element, canteen: Canteen) -> List[Dish]:
dish_markers_allergen,
dish_markers_type,
dish_markers_meatless,
strict=True,
):
Comment on lines 316 to 320
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description only says "update dependencies", but this change also enforces strict-length checking in zips (and requires Python >=3.10). Please update the PR description to reflect the behavioral change (parsing/translation may now fail fast on upstream data shape mismatches) and the Python version bump.

Copilot uses AI. Check for mistakes.
# parse labels
labels = set()
Expand Down
2 changes: 1 addition & 1 deletion src/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def prefetch(self, texts):
return

result = self.translator.translate_text(to_translate, source_lang=self.source, target_lang=self.target)
for original, translation in zip(to_translate, result):
for original, translation in zip(to_translate, result, strict=True):
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using zip(..., strict=True) will raise ValueError if the DeepL client returns a different number of translations than inputs. main() currently only catches deepl.exceptions.DeepLException, so a strict-zip mismatch would crash the translation run and skip cache persistence (despite the comment about always updating the cache). Consider handling ValueError (or using a finally to always save the cache) so operational runs don’t lose progress when a mismatch is detected.

Suggested change
for original, translation in zip(to_translate, result, strict=True):
for original, translation in zip(to_translate, result):

Copilot uses AI. Check for mistakes.
self.cache[original] = translation.text

def translate(self, text):
Expand Down
Loading