Readers oracle to workday and the providers 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 11:07:07 +02:00
1 parent a66aac95cf
commit 06eb929eaf
48 files changed
+460 -388

No files matched your search

+18 -30
View File
@@ -29,7 +29,6 @@ from __future__ import annotations
import html
import json
import logging
import re
from collections.abc import Callable
from datetime import UTC, datetime, timedelta
@@ -39,9 +38,7 @@ from desk.sources import strip_html
from ._contract import Ask, Fields, Filters, Place, Reads
from ._countries import code_of
from ._shared import Get, Page, Row, add_place, only, parse_dt, table_word
log = logging.getLogger(__name__)
from ._shared import Get, Page, Row, add_place, only, parse_dt
NAME = "workday"
LABEL = "Workday"
@@ -50,7 +47,7 @@ KEEP_CASE = True
READS = Reads(
scope="board", listing="paged", page_size=20, ceiling=2000, text="detail",
complete="stated", places="many", filters=Filters(country="ids", remote="ids"),
fields=Fields(posted="trusted", remote="stated", country="stated", employment="stated"),
fields=Fields(posted="trusted", remote="stated", employment="stated"),
robots="read: robots.txt allows /<Site>/ (checked 2026-09-29)",
)
@@ -167,7 +164,7 @@ def facets(get: Get, slug: str) -> dict[str, dict[str, str]]:
"""The tenant's host ids, read off one page of one role: `country` maps
an ISO code to `<facetParameter>=<id>` in the facet whose values are
countries (most of them, `_COUNTRY_SHARE`; the one with most countries
when two are), and `remote` maps each facet value that `_REMOTE` reads as
when two are), and `remote` maps each facet value that `_REMOTE_FACET` names as
remote ("Remote", "Fully Flexible"), in whatever facet, to its id. A
tenant with neither states no such dimension, and the runner then does
not filter on it."""
@@ -184,7 +181,7 @@ def facets(get: Get, slug: str) -> dict[str, dict[str, str]]:
country = found
for v in values:
word = " ".join(str(v.get("descriptor") or "").split())
if v.get("id") and _remote(word) == "remote":
if v.get("id") and word.lower() in _REMOTE_FACET:
remote[word.lower()] = f"{name}={v['id']}"
out: dict[str, dict[str, str]] = {}
if country:
@@ -216,11 +213,14 @@ def _today() -> datetime:
return datetime.now(UTC).replace(hour=0, minute=0, second=0, microsecond=0)
#: `remoteType` -> `store._remote`'s words. Only some tenants send it, and
#: each words it its own way (Zendesk's "Fully Flexible", Axis' "On-Site"); a
#: word not listed, a bare "No" among them, says nothing and stays unknown.
_REMOTE = {"remote": "remote", "fully flexible": "remote", "hybrid": "hybrid",
"in office": "onsite", "on-site": "onsite", "onsite": "onsite"}
#: The `remoteType` words a facet names that mean remote, which the `remote`
#: filter looks for; the row keeps the host's word whatever it is (only some
#: tenants send it, each in its own way: Zendesk's "Fully Flexible", Axis'
#: "On-Site").
_REMOTE_FACET = ("remote", "fully flexible")
#: The words that put a role's places in an office, for their `remote` flag.
_OFFICE = ("hybrid", "in office", "on-site", "onsite")
def _requisition(posting: dict[str, Any], path: str) -> str:
@@ -234,12 +234,10 @@ def _requisition(posting: dict[str, Any], path: str) -> str:
def _remote(value: Any) -> str | None:
return _REMOTE.get(str(value or "").strip().lower())
"""The host's `remoteType`, as given."""
return str(value or "").strip() or None
#: `timeType` -> the app's employment words.
_EMPLOYMENT = {"full time": "full_time", "part time": "part_time"}
#: What `locationsText` says of a role at several places: "2 Locations". The
#: places arrive with the role's own read.
_COUNT = re.compile(r"\d+ locations?", re.I)
@@ -259,8 +257,9 @@ def _place(text: Any, remote: str | None) -> Place | None:
if len(parts) > 1 and "," not in text and all(parts) \
and not parts[0].lower().startswith(("remote", "hybrid", "on-site", "onsite")):
text = ", ".join(reversed(parts))
return {"text": text, "remote": {"remote": True, "hybrid": False, "onsite": False}.get(
remote or "")}
word = (remote or "").lower()
return {"text": text, "remote": True if word in _REMOTE_FACET
else False if word in _OFFICE else None}
def rows(decoded: dict[str, Any], slug: str) -> list[Row]:
@@ -318,9 +317,7 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
if places := _places(posting, remote):
out["places"] = places
out["location"] = "; ".join(p["text"] for p in places)
if len(places) == 1 and (code := _country_code(posting)):
out["country"] = code
if employment := table_word(_EMPLOYMENT, posting.get("timeType"), log, "timeType"):
if employment := str(posting.get("timeType") or "").strip():
out["employment"] = employment
if posted := parse_dt(posting.get("startDate")):
out["posted"] = posted
@@ -329,15 +326,6 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
return out
def _country_code(posting: dict[str, Any]) -> str | None:
"""The role's country as an ISO code, from the requisition's location. The
code belongs to the main location only, so it is used for a role with one
place."""
country = (posting.get("jobRequisitionLocation") or {}).get("country") or {}
code = str(country.get("alpha2Code") or "").strip().upper()
return code if len(code) == 2 else None
def _places(posting: dict[str, Any], remote: str | None) -> list[Place]:
"""The main location and the additional ones, each once, which replace the
listing's "2 Locations". A single location that does not name its country