Share the readers' place, table-lookup and country helpers, unify the employment vocabulary, and list the enrich switch with the stages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 10:13:24 +02:00
1 parent ca80219bbb
commit 903b69b6d3
34 files changed
+290 -207

No files matched your search

+3 -9
View File
@@ -14,7 +14,7 @@ from collections.abc import Callable
from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads
from ._shared import Row, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
from ._shared import Row, add_place, label_slug_ok, num, only, parse_dt, pay_line, place, table_word, yearly_amount
log = logging.getLogger(__name__)
@@ -86,12 +86,7 @@ def _salary_text(salary_info: ET.Element) -> str:
def _seniority(word: str) -> str | None:
key = word.strip().lower()
if key not in _SENIORITY:
if key:
log.debug("personio: unknown seniority %r", word)
return None
return _SENIORITY[key] or None
return table_word(_SENIORITY, word, log, "seniority")
def _employment(position: ET.Element) -> str | None:
@@ -113,8 +108,7 @@ def _places(position: ET.Element) -> list[Place]:
*(o.text for o in position.findall("additionalOffices/office"))]
for name in names:
text = (name or "").strip()
if text and text not in (p["text"] for p in found):
found.append({"text": text, "remote": True if "remote" in text.lower() else None})
add_place(found, place(text))
return found