Readers ashby to lever hand on the host's words; their word tables move to app/prep/hosts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 10:54:19 +02:00
1 parent a66aac95cf
commit 6c7ce1090d
37 files changed
+504 -171

No files matched your search

+4 -22
View File
@@ -26,7 +26,7 @@ from typing import Any
from desk.sources import strip_html
from ._contract import Ask, Fields, Reads, Row
from ._shared import Get, parse_dt, place, table_word
from ._shared import Get, parse_dt, place
log = logging.getLogger(__name__)
@@ -58,28 +58,10 @@ _SLUG = re.compile(r"[0-9]{1,12}")
#: from.
_ROLE_PATH = re.compile(r"/jobs/[0-9]+(?:-[A-Za-z0-9_-]*)?/?")
#: The embed's `experience` -> `app.models.SENIORITIES`. Only the coarse levels
#: are mapped; "Experienced" sits between "Mid level" and the managerial
#: levels and says too little to place, so it stays unmapped and is logged.
_SENIORITY = {"student": "intern", "internship": "intern", "trainee": "intern",
"entry level": "junior", "entry-level": "junior", "junior": "junior",
"graduate": "junior", "mid level": "mid", "mid-level": "mid", "mid": "mid",
"senior": "senior", "lead": "lead", "manager": "manager", "director": "director",
"executive": "exec", "not applicable": ""}
#: The embed's `employment_type` -> the app's employment words.
_EMPLOYMENT = {"full-time": "full_time", "full time": "full_time", "part-time": "part_time",
"part time": "part_time", "contract": "contract", "consultant": "contract",
"temporary": "temporary", "internship": "internship", "intern": "internship",
"freelance": "freelance", "summer job": "temporary", "seasonal": "temporary"}
_ASSIGNMENT = "JBL.embed_v2['jobs'] = "
_KEY = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
_TRAILING_COMMA = re.compile(r",(\s*[\]}])")
#: Jobylon's `workspace` -> `store._remote`'s words.
_REMOTE = {"remote": "remote", "hybrid": "hybrid", "on-site": "onsite", "onsite": "onsite"}
#: The English month names, by their first three letters, in the spellings
#: `published_date` uses ("Sept. 25, 2026").
_MONTHS = {m: i for i, m in enumerate(
@@ -205,7 +187,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
"posted": _published(j.get("published_date")),
"department": "" if function == "All functions" else function,
"description": "",
"remote": _REMOTE.get(str(j.get("workspace") or "").strip().lower()),
"remote": str(j.get("workspace") or "").strip() or None,
"salary_text": "", # the embed states no pay
}
# `summary` is the text the company gave the listing, the string
@@ -213,9 +195,9 @@ def parse(body: bytes, slug: str) -> list[Row]:
summary = " ".join(html.unescape(strip_html(str(j.get("summary") or ""))).split())
if summary and summary != "None":
row["teaser"] = summary
if seniority := table_word(_SENIORITY, j.get("experience"), log, "experience"):
if seniority := str(j.get("experience") or "").strip():
row["seniority"] = seniority
if employment := table_word(_EMPLOYMENT, j.get("employment_type"), log, "employment_type"):
if employment := str(j.get("employment_type") or "").strip():
row["employment"] = employment
out.append(row)
return out