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:
1 parent
a66aac95cf
commit
6c7ce1090d
37 files changed
+504
-171
No files matched your search
+4
-12
@@ -27,7 +27,7 @@ from typing import Any
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads, Row
|
||||
from ._shared import Get, Page, add_place, only, parse_dt, table_word
|
||||
from ._shared import Get, Page, add_place, only, parse_dt
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -65,14 +65,6 @@ DETAIL_QUERY = (
|
||||
"job { id locationType employmentType requisitionId teamDisplayName "
|
||||
"department { id extId name } } compensationHtml } }")
|
||||
|
||||
#: `job.locationType` -> `store._remote`'s words.
|
||||
_REMOTE = {"IN_OFFICE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"}
|
||||
|
||||
#: `job.employmentType` -> the app's employment words.
|
||||
_EMPLOYMENT = {"full_time": "full_time", "part_time": "part_time", "contract": "contract",
|
||||
"contractor": "contract", "intern": "internship", "internship": "internship",
|
||||
"temporary": "temporary", "freelance": "freelance"}
|
||||
|
||||
|
||||
def slug_ok(slug: str) -> bool:
|
||||
return bool(_BOARD.fullmatch(slug))
|
||||
@@ -134,9 +126,9 @@ def rows(postings: list[dict[str, Any]], slug: str) -> list[Row]:
|
||||
add_place(places, {"text": text, "remote": loc["isRemote"]
|
||||
if isinstance(loc.get("isRemote"), bool) else None})
|
||||
job = p.get("job") or {}
|
||||
remote = _REMOTE.get(str(job.get("locationType") or "").upper())
|
||||
remote: bool | str | None = str(job.get("locationType") or "").strip() or None
|
||||
if remote is None and locations and all(loc.get("isRemote") for loc in locations):
|
||||
remote = "remote"
|
||||
remote = True
|
||||
row: Row = {
|
||||
"source_id": ext_id,
|
||||
"title": title,
|
||||
@@ -149,7 +141,7 @@ def rows(postings: list[dict[str, Any]], slug: str) -> list[Row]:
|
||||
"remote": remote,
|
||||
"salary_text": "",
|
||||
}
|
||||
if employment := table_word(_EMPLOYMENT, job.get("employmentType"), log, "employmentType"):
|
||||
if employment := str(job.get("employmentType") or "").strip():
|
||||
row["employment"] = employment
|
||||
out.append(row)
|
||||
return out
|
||||
|
||||
Reference in new issue
Block a user