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

+5 -8
View File
@@ -24,7 +24,7 @@ from typing import Any
from desk.sources import strip_html
from ._contract import Ask, Fields, Reads, Row
from ._shared import num, only, parse_dt, pay_line
from ._shared import num, only, parse_dt, pay_line, table_word
log = logging.getLogger(__name__)
@@ -65,8 +65,8 @@ _REMOTE = {"ON_SITE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"}
#: The name of a `jobEmploymentTypes` entry -> the app's employment words.
_EMPLOYMENT = {"full-time": "full_time", "full time": "full_time", "part-time": "part_time",
"part time": "part_time", "contract": "contract", "contractor": "contract",
"consultant": "contract", "temporary": "temporary", "intern": "intern",
"internship": "intern", "freelance": "freelance"}
"consultant": "contract", "temporary": "temporary", "intern": "internship",
"internship": "internship", "freelance": "freelance"}
def slug_ok(slug: str) -> bool:
@@ -123,12 +123,9 @@ def _postings(body: bytes) -> tuple[list[dict[str, Any]], dict[str, str]]:
def _employment(job: dict[str, Any]) -> str | None:
"""The first `jobEmploymentTypes` entry that names a known type."""
for entry in job.get("jobEmploymentTypes") or []:
name = str(((entry or {}).get("employmentType") or {}).get("name") or "").strip()
if not name:
continue
if found := _EMPLOYMENT.get(name.lower()):
name = ((entry or {}).get("employmentType") or {}).get("name")
if found := table_word(_EMPLOYMENT, name, log, "employment type"):
return found
log.debug("deel: unknown employment type %r", name)
return None