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

+8
View File
@@ -0,0 +1,8 @@
"""Ashby's words, mapped to the app's."""
#: `workplaceType`.
REMOTE: dict[str, str] = {"remote": "remote", "hybrid": "hybrid", "onsite": "onsite"}
#: `employmentType`.
EMPLOYMENT: dict[str, str] = {"fulltime": "full_time", "parttime": "part_time", "intern": "internship",
"contract": "contract", "temporary": "temporary"}
+12
View File
@@ -0,0 +1,12 @@
"""BambooHR's words, mapped to the app's."""
#: `employmentStatusLabel`. BambooHR's labels are the company's own ("Full-Time",
#: "Part-Time", "Contract", "Intern").
EMPLOYMENT: dict[str, str] = {
"full-time": "full_time", "full time": "full_time", "part-time": "part_time",
"part time": "part_time", "contract": "contract", "contractor": "contract",
"temporary": "temporary", "intern": "internship", "internship": "internship",
"freelance": "freelance"}
#: `locationType`. Anything else says nothing.
REMOTE: dict[str, str] = {"0": "onsite", "1": "remote", "2": "hybrid"}
+11
View File
@@ -0,0 +1,11 @@
"""Deel's words, mapped to the app's."""
#: `workArrangementEnum`.
REMOTE: dict[str, str] = {"on_site": "onsite", "hybrid": "hybrid", "remote": "remote"}
#: The name of a `jobEmploymentTypes` entry.
EMPLOYMENT: dict[str, str] = {
"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": "internship",
"internship": "internship", "freelance": "freelance"}
+5
View File
@@ -0,0 +1,5 @@
"""Eightfold's words, mapped to the app's."""
#: `workLocationOption`. Only "onsite" and "hybrid" were seen; the other
#: spellings are the obvious ones.
REMOTE: dict[str, str] = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"}
+10
View File
@@ -0,0 +1,10 @@
"""Gem's words, mapped to the app's."""
#: `job.locationType`.
REMOTE: dict[str, str] = {"in_office": "onsite", "hybrid": "hybrid", "remote": "remote"}
#: `job.employmentType`.
EMPLOYMENT: dict[str, str] = {
"full_time": "full_time", "part_time": "part_time", "contract": "contract",
"contractor": "contract", "intern": "internship", "internship": "internship",
"temporary": "temporary", "freelance": "freelance"}
+13
View File
@@ -0,0 +1,13 @@
"""HiBob's words, mapped to the app's."""
#: `employmentType`, the company's own name for it. "Permanent" says nothing
#: about hours and stays unmapped.
EMPLOYMENT: dict[str, str] = {
"regular full time": "full_time", "full time": "full_time",
"full-time": "full_time", "regular part time": "part_time",
"part time": "part_time", "part-time": "part_time", "contract": "contract",
"contractor": "contract", "temporary": "temporary", "fixed term": "temporary",
"intern": "internship", "internship": "internship", "freelance": "freelance"}
#: `workspaceTypeId`.
REMOTE: dict[str, str] = {"remote": "remote", "hybrid": "hybrid", "on_site": "onsite", "onsite": "onsite"}
+7
View File
@@ -0,0 +1,7 @@
"""Jibe's words, mapped to the app's."""
#: `employment_type`.
EMPLOYMENT: dict[str, str] = {
"full_time": "full_time", "part_time": "part_time", "contractor": "contract",
"contract": "contract", "temporary": "temporary", "intern": "internship",
"internship": "internship", "freelance": "freelance"}
+21
View File
@@ -0,0 +1,21 @@
"""Jobylon's words, mapped to the app's."""
#: The embed's `experience`. 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.
SENIORITY: dict[str, str] = {
"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`.
EMPLOYMENT: dict[str, str] = {
"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"}
#: `workspace`.
REMOTE: dict[str, str] = {"remote": "remote", "hybrid": "hybrid", "on-site": "onsite", "onsite": "onsite"}
+9
View File
@@ -0,0 +1,9 @@
"""Lever's words, mapped to the app's."""
#: `categories.commitment`. A commitment is free text on Lever ("Permanent" is
#: seen too and says nothing about hours).
EMPLOYMENT: dict[str, str] = {
"full-time": "full_time", "full time": "full_time", "fulltime": "full_time",
"part-time": "part_time", "part time": "part_time", "parttime": "part_time",
"intern": "internship", "internship": "internship", "contract": "contract",
"contractor": "contract", "temporary": "temporary", "freelance": "freelance"}
+6 -17
View File
@@ -15,7 +15,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads, Row from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import add_place, is_web_url, num, only, parse_dt, path_slug_ok, pay_line, place, table_word, yearly_amount from ._shared import add_place, is_web_url, num, only, parse_dt, path_slug_ok, pay_line, place, yearly_amount
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -36,13 +36,6 @@ READS = Reads(
_API = "api.ashbyhq.com" _API = "api.ashbyhq.com"
#: `workplaceType` -> `store._remote`'s words. `isRemote` is true for hybrid
#: roles too, so it is only the fallback when the role has no `workplaceType`.
_WORKPLACE = {"remote": "remote", "hybrid": "hybrid", "onsite": "onsite"}
#: `employmentType` -> the app's employment words.
_EMPLOYMENT = {"fulltime": "full_time", "parttime": "part_time", "intern": "internship",
"contract": "contract", "temporary": "temporary"}
def slug_ok(slug: str) -> bool: def slug_ok(slug: str) -> bool:
@@ -113,12 +106,12 @@ def _salary_text(compensation: dict[str, Any]) -> str:
or compensation.get("scrapeableCompensationSalarySummary") or "") or compensation.get("scrapeableCompensationSalarySummary") or "")
def _places(j: dict[str, Any], workplace: str | None) -> list[Place]: def _places(j: dict[str, Any], workplace: str) -> list[Place]:
"""The primary `location`, then each of `secondaryLocations`, in the host's """The primary `location`, then each of `secondaryLocations`, in the host's
words. The primary is remote or an office as `workplaceType` says; a words. The primary is remote or an office as `workplaceType` says; a
place that names itself remote is remote.""" place that names itself remote is remote."""
primary = (j.get("location") or "").strip() primary = (j.get("location") or "").strip()
named = [(primary, {"remote": True, "hybrid": False, "onsite": False}.get(workplace or ""))] named = [(primary, {"remote": True, "hybrid": False, "onsite": False}.get(workplace.lower()))]
named += [(str((s or {}).get("location") or "").strip(), None) named += [(str((s or {}).get("location") or "").strip(), None)
for s in j.get("secondaryLocations") or []] for s in j.get("secondaryLocations") or []]
out: list[Place] = [] out: list[Place] = []
@@ -127,10 +120,6 @@ def _places(j: dict[str, Any], workplace: str | None) -> list[Place]:
return out return out
def _employment(value: Any) -> str | None:
return table_word(_EMPLOYMENT, value, log, "employmentType")
def parse(body: bytes, slug: str) -> list[Row]: def parse(body: bytes, slug: str) -> list[Row]:
data = json.loads(body) data = json.loads(body)
rows = [] rows = []
@@ -142,7 +131,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
description = j.get("descriptionHtml") or j.get("descriptionPlain") or "" description = j.get("descriptionHtml") or j.get("descriptionPlain") or ""
compensation = j.get("compensation") or {} compensation = j.get("compensation") or {}
salary_min, salary_max, currency = _salary(compensation.get("summaryComponents") or []) salary_min, salary_max, currency = _salary(compensation.get("summaryComponents") or [])
workplace = _WORKPLACE.get(str(j.get("workplaceType") or "").strip().lower()) workplace = str(j.get("workplaceType") or "").strip()
places = _places(j, workplace) places = _places(j, workplace)
row: Row = { row: Row = {
"source_id": str(j.get("id") or ""), "source_id": str(j.get("id") or ""),
@@ -153,13 +142,13 @@ def parse(body: bytes, slug: str) -> list[Row]:
"posted": parse_dt(j.get("publishedAt")), "posted": parse_dt(j.get("publishedAt")),
"department": (j.get("department") or j.get("team") or "").strip(), "department": (j.get("department") or j.get("team") or "").strip(),
"description": strip_html(description), "description": strip_html(description),
"remote": workplace or j.get("isRemote"), "remote": workplace or j.get("isRemote"), # `isRemote` is true for hybrid too
"salary_text": _salary_text(compensation), "salary_text": _salary_text(compensation),
"salary_min": salary_min, "salary_min": salary_min,
"salary_max": salary_max, "salary_max": salary_max,
"currency": currency, "currency": currency,
} }
if employment := _employment(j.get("employmentType")): if employment := str(j.get("employmentType") or "").strip():
row["employment"] = employment row["employment"] = employment
rows.append(row) rows.append(row)
return rows return rows
+7 -20
View File
@@ -23,7 +23,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads, Row from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import Get, label_slug_ok, only, parse_dt, place, table_word from ._shared import Get, label_slug_ok, only, parse_dt, place
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -34,13 +34,6 @@ READS = Reads(
robots="read: robots.txt allows /careers (checked 2026-09-29)", robots="read: robots.txt allows /careers (checked 2026-09-29)",
) )
#: `employmentStatusLabel` -> the app's employment words. BambooHR's labels are
#: the company's own ("Full-Time", "Part-Time", "Contract", "Intern").
_EMPLOYMENT = {"full-time": "full_time", "full time": "full_time", "part-time": "part_time",
"part time": "part_time", "contract": "contract", "contractor": "contract",
"temporary": "temporary", "intern": "internship", "internship": "internship",
"freelance": "freelance"}
NAME = "bamboohr" NAME = "bamboohr"
LABEL = "BambooHR" LABEL = "BambooHR"
PATTERNS = ( PATTERNS = (
@@ -49,9 +42,6 @@ PATTERNS = (
r"https?://(?!(?:app|resources|documentation|help)\.)([a-z0-9-]+)\.bamboohr\.com", r"https?://(?!(?:app|resources|documentation|help)\.)([a-z0-9-]+)\.bamboohr\.com",
) )
#: `locationType` -> `store._remote`'s words. Anything else says nothing.
_REMOTE = {"0": "onsite", "1": "remote", "2": "hybrid"}
#: Sent on the detail read: without it the same URL answers the page's HTML. #: Sent on the detail read: without it the same URL answers the page's HTML.
_JSON = {"Accept": "application/json"} _JSON = {"Accept": "application/json"}
@@ -76,10 +66,11 @@ def feed_url(slug: str, ask: Ask) -> str:
return f"https://{host(slug)}/careers/list" return f"https://{host(slug)}/careers/list"
def _remote(j: dict[str, Any]) -> str | None: def _remote(j: dict[str, Any]) -> bool | str | None:
"""`isRemote` when true, else `locationType` as the host writes it ("0", "1", "2")."""
if j.get("isRemote") is True: if j.get("isRemote") is True:
return "remote" return True
return _REMOTE.get(str(j.get("locationType") if j.get("locationType") is not None else "")) return None if j.get("locationType") is None else str(j["locationType"]).strip() or None
def _place(j: dict[str, Any]) -> str: def _place(j: dict[str, Any]) -> str:
@@ -99,10 +90,6 @@ def _places(j: dict[str, Any]) -> list[Place]:
return [place(text)] if text else [] return [place(text)] if text else []
def _employment(j: dict[str, Any]) -> str | None:
return table_word(_EMPLOYMENT, j.get("employmentStatusLabel"), log, "employmentStatusLabel")
def parse(body: bytes, slug: str) -> list[Row]: def parse(body: bytes, slug: str) -> list[Row]:
"""`/careers/list` -> `{"meta": {"totalCount": n}, "result": [...]}`. A """`/careers/list` -> `{"meta": {"totalCount": n}, "result": [...]}`. A
role has `id`, `jobOpeningName`, `departmentLabel`, `location` (`city`, role has `id`, `jobOpeningName`, `departmentLabel`, `location` (`city`,
@@ -136,7 +123,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
"remote": _remote(j), "remote": _remote(j),
"salary_text": "", # the list states no pay; the detail's `compensation` was null "salary_text": "", # the list states no pay; the detail's `compensation` was null
} }
if employment := _employment(j): if employment := str(j.get("employmentStatusLabel") or "").strip():
row["employment"] = employment row["employment"] = employment
out.append(row) out.append(row)
return out return out
@@ -160,6 +147,6 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
if place := _place(opening): if place := _place(opening):
out["location"] = place out["location"] = place
out["places"] = _places(opening) out["places"] = _places(opening)
if remote := _remote(opening): if (remote := _remote(opening)) is not None:
out["remote"] = remote out["remote"] = remote
return out return out
+5 -14
View File
@@ -24,7 +24,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Reads, Row from ._contract import Ask, Fields, Reads, Row
from ._shared import num, only, parse_dt, pay_line, table_word from ._shared import num, only, parse_dt, pay_line
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -59,15 +59,6 @@ _PUSH = re.compile(r'self\.__next_f\.push\(\[1,("(?:[^"\\]|\\.)*")\]\)')
_ROW = re.compile(rb"([0-9a-f]*):") _ROW = re.compile(rb"([0-9a-f]*):")
_TEXT = re.compile(rb"T([0-9a-f]+),") _TEXT = re.compile(rb"T([0-9a-f]+),")
#: Deel's `workArrangementEnum` -> `store._remote`'s words.
_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": "internship",
"internship": "internship", "freelance": "freelance"}
def slug_ok(slug: str) -> bool: def slug_ok(slug: str) -> bool:
return bool(_SLUG.fullmatch(slug)) return bool(_SLUG.fullmatch(slug))
@@ -121,10 +112,10 @@ def _postings(body: bytes) -> tuple[list[dict[str, Any]], dict[str, str]]:
def _employment(job: dict[str, Any]) -> str | None: def _employment(job: dict[str, Any]) -> str | None:
"""The first `jobEmploymentTypes` entry that names a known type.""" """The name of the first `jobEmploymentTypes` entry that has one."""
for entry in job.get("jobEmploymentTypes") or []: for entry in job.get("jobEmploymentTypes") or []:
name = ((entry or {}).get("employmentType") or {}).get("name") name = ((entry or {}).get("employmentType") or {}).get("name")
if found := table_word(_EMPLOYMENT, name, log, "employment type"): if found := str(name or "").strip():
return found return found
return None return None
@@ -155,7 +146,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
description = p.get("richtextDescription") or "" description = p.get("richtextDescription") or ""
if description.startswith("$"): if description.startswith("$"):
description = stream.get(description[1:], "") description = stream.get(description[1:], "")
arrangement = str(job.get("workArrangementEnum") or "") arrangement = str(job.get("workArrangementEnum") or "").strip()
remote = {"REMOTE": True, "HYBRID": False, "ON_SITE": False}.get(arrangement) remote = {"REMOTE": True, "HYBRID": False, "ON_SITE": False}.get(arrangement)
row: Row = { row: Row = {
"source_id": post_id, "source_id": post_id,
@@ -166,7 +157,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
"posted": parse_dt(published.get("createdAt") or p.get("createdAt")), "posted": parse_dt(published.get("createdAt") or p.get("createdAt")),
"department": ", ".join(dict.fromkeys(departments)), "department": ", ".join(dict.fromkeys(departments)),
"description": html.unescape(strip_html(description)), "description": html.unescape(strip_html(description)),
"remote": _REMOTE.get(str(job.get("workArrangementEnum") or "")), "remote": arrangement or None,
"salary_text": (pay_line(num(pay.get("minAmount")), num(pay.get("maxAmount")), "salary_text": (pay_line(num(pay.get("minAmount")), num(pay.get("maxAmount")),
pay.get("currencyIsoCode"), "") pay.get("currencyIsoCode"), "")
if p.get("isCompensationVisible") else ""), if p.get("isCompensationVisible") else ""),
+1 -5
View File
@@ -70,10 +70,6 @@ _NAME = re.compile(r"[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9]
#: Names a private network uses, never a company's career site. #: Names a private network uses, never a company's career site.
_LOCAL = (".localhost", ".local", ".internal", ".lan", ".home.arpa") _LOCAL = (".localhost", ".local", ".internal", ".lan", ".home.arpa")
#: `workLocationOption` -> `store._remote`'s words. Only "onsite" and "hybrid"
#: were seen; the other spellings are the obvious ones.
_REMOTE = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"}
def parts(slug: str) -> tuple[str, str]: def parts(slug: str) -> tuple[str, str]:
"""`(host, domain)` of a slug, lowercased.""" """`(host, domain)` of a slug, lowercased."""
@@ -162,7 +158,7 @@ def rows(positions: list[dict[str, Any]], slug: str) -> list[Row]:
"posted": parse_dt(p.get("creationTs") or p.get("postedTs")), "posted": parse_dt(p.get("creationTs") or p.get("postedTs")),
"department": str(p.get("department") or "").strip(), "department": str(p.get("department") or "").strip(),
"description": "", "description": "",
"remote": _REMOTE.get(str(p.get("workLocationOption") or "").strip().lower()), "remote": str(p.get("workLocationOption") or "").strip() or None,
"salary_text": "", "salary_text": "",
}) })
return out return out
+4 -12
View File
@@ -27,7 +27,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads, Row 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__) log = logging.getLogger(__name__)
@@ -65,14 +65,6 @@ DETAIL_QUERY = (
"job { id locationType employmentType requisitionId teamDisplayName " "job { id locationType employmentType requisitionId teamDisplayName "
"department { id extId name } } compensationHtml } }") "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: def slug_ok(slug: str) -> bool:
return bool(_BOARD.fullmatch(slug)) 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"] add_place(places, {"text": text, "remote": loc["isRemote"]
if isinstance(loc.get("isRemote"), bool) else None}) if isinstance(loc.get("isRemote"), bool) else None})
job = p.get("job") or {} 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): if remote is None and locations and all(loc.get("isRemote") for loc in locations):
remote = "remote" remote = True
row: Row = { row: Row = {
"source_id": ext_id, "source_id": ext_id,
"title": title, "title": title,
@@ -149,7 +141,7 @@ def rows(postings: list[dict[str, Any]], slug: str) -> list[Row]:
"remote": remote, "remote": remote,
"salary_text": "", "salary_text": "",
} }
if employment := table_word(_EMPLOYMENT, job.get("employmentType"), log, "employmentType"): if employment := str(job.get("employmentType") or "").strip():
row["employment"] = employment row["employment"] = employment
out.append(row) out.append(row)
return out return out
+3 -14
View File
@@ -23,7 +23,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Reads, Row from ._contract import Ask, Fields, Reads, Row
from ._shared import Get, Page, label_slug_ok, num, only, parse_dt, pay_line, table_word, yearly_amount from ._shared import Get, Page, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -38,21 +38,10 @@ READS = Reads(
"app's index page with no rules (checked 2026-09-29)", "app's index page with no rules (checked 2026-09-29)",
) )
#: `employmentType`, the company's own name for it -> the app's employment
#: words. "Permanent" says nothing about hours and stays unmapped.
_EMPLOYMENT = {"regular full time": "full_time", "full time": "full_time",
"full-time": "full_time", "regular part time": "part_time",
"part time": "part_time", "part-time": "part_time", "contract": "contract",
"contractor": "contract", "temporary": "temporary", "fixed term": "temporary",
"intern": "internship", "internship": "internship", "freelance": "freelance"}
NAME = "hibob" NAME = "hibob"
LABEL = "HiBob" LABEL = "HiBob"
PATTERNS = (r"https?://([a-z0-9-]+)\.careers\.hibob\.com",) PATTERNS = (r"https?://([a-z0-9-]+)\.careers\.hibob\.com",)
#: HiBob's `workspaceTypeId` -> `store._remote`'s words.
_REMOTE = {"remote": "remote", "hybrid": "hybrid", "on_site": "onsite", "onsite": "onsite"}
#: The texts of an ad, in the order the ad shows them. #: The texts of an ad, in the order the ad shows them.
_SECTIONS = ("description", "responsibilities", "requirements", "benefits") _SECTIONS = ("description", "responsibilities", "requirements", "benefits")
@@ -126,13 +115,13 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
"posted": parse_dt(ad.get("publishedAt")), "posted": parse_dt(ad.get("publishedAt")),
"department": str(ad.get("department") or "").strip(), "department": str(ad.get("department") or "").strip(),
"description": " ".join(html.unescape(text).split()), "description": " ".join(html.unescape(text).split()),
"remote": _REMOTE.get(str(ad.get("workspaceTypeId") or "").strip().lower()), "remote": str(ad.get("workspaceTypeId") or "").strip() or None,
"salary_text": pay_line(lo, hi, currency, period), "salary_text": pay_line(lo, hi, currency, period),
"salary_min": salary_min, "salary_min": salary_min,
"salary_max": salary_max, "salary_max": salary_max,
"currency": code, "currency": code,
} }
if employment := table_word(_EMPLOYMENT, ad.get("employmentType"), log, "employmentType"): if employment := str(ad.get("employmentType") or "").strip():
row["employment"] = employment row["employment"] = employment
out.append(row) out.append(row)
return out return out
+4 -9
View File
@@ -38,7 +38,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads, Row from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import Get, Page, add_place, only, parse_dt, place, table_word from ._shared import Get, Page, add_place, only, parse_dt, place
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -49,11 +49,6 @@ READS = Reads(
robots="read: robots.txt allows /jobs, with crawl-delay 5 not honoured (checked 2026-09-29)", robots="read: robots.txt allows /jobs, with crawl-delay 5 not honoured (checked 2026-09-29)",
) )
#: `employment_type` -> the app's employment words.
_EMPLOYMENT = {"full_time": "full_time", "part_time": "part_time", "contractor": "contract",
"contract": "contract", "temporary": "temporary", "intern": "internship",
"internship": "internship", "freelance": "freelance"}
NAME = "jibe" NAME = "jibe"
LABEL = "Jibe" LABEL = "Jibe"
PATTERNS = ( PATTERNS = (
@@ -157,10 +152,10 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
} }
# One code, for a role at one place: over several countries it would # One code, for a role at one place: over several countries it would
# gate the others by the site's own. # gate the others by the site's own.
code = str(j.get("country_code") or "").strip().upper() code = str(j.get("country_code") or "").strip()
if len(places) == 1 and re.fullmatch(r"[A-Z]{2}", code): if len(places) == 1 and code:
row["country"] = code row["country"] = code
if employment := table_word(_EMPLOYMENT, j.get("employment_type"), log, "employment_type"): if employment := str(j.get("employment_type") or "").strip():
row["employment"] = employment row["employment"] = employment
out.append(row) out.append(row)
return out return out
+4 -22
View File
@@ -26,7 +26,7 @@ from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Reads, Row 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__) log = logging.getLogger(__name__)
@@ -58,28 +58,10 @@ _SLUG = re.compile(r"[0-9]{1,12}")
#: from. #: from.
_ROLE_PATH = re.compile(r"/jobs/[0-9]+(?:-[A-Za-z0-9_-]*)?/?") _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'] = " _ASSIGNMENT = "JBL.embed_v2['jobs'] = "
_KEY = re.compile(r"[A-Za-z_][A-Za-z0-9_]*") _KEY = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
_TRAILING_COMMA = re.compile(r",(\s*[\]}])") _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 #: The English month names, by their first three letters, in the spellings
#: `published_date` uses ("Sept. 25, 2026"). #: `published_date` uses ("Sept. 25, 2026").
_MONTHS = {m: i for i, m in enumerate( _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")), "posted": _published(j.get("published_date")),
"department": "" if function == "All functions" else function, "department": "" if function == "All functions" else function,
"description": "", "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 "salary_text": "", # the embed states no pay
} }
# `summary` is the text the company gave the listing, the string # `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()) summary = " ".join(html.unescape(strip_html(str(j.get("summary") or ""))).split())
if summary and summary != "None": if summary and summary != "None":
row["teaser"] = summary row["teaser"] = summary
if seniority := table_word(_SENIORITY, j.get("experience"), log, "experience"): if seniority := str(j.get("experience") or "").strip():
row["seniority"] = seniority 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 row["employment"] = employment
out.append(row) out.append(row)
return out return out
+4 -12
View File
@@ -17,14 +17,13 @@ from __future__ import annotations
import json import json
import logging import logging
import re
from collections.abc import Callable from collections.abc import Callable
from typing import Any from typing import Any
from desk.sources import strip_html from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads, Row from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import add_place, is_web_url, num, only, parse_dt, path_slug_ok, pay_line, place, table_word, yearly_amount from ._shared import add_place, is_web_url, num, only, parse_dt, path_slug_ok, pay_line, place, yearly_amount
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -36,13 +35,6 @@ READS = Reads(
robots="api: no robots.txt check needed (public board API), 2026-09-30", robots="api: no robots.txt check needed (public board API), 2026-09-30",
) )
#: `categories.commitment` -> the app's employment words. A commitment is free
#: text on Lever ("Permanent" is seen too and says nothing about hours).
_EMPLOYMENT = {"full-time": "full_time", "full time": "full_time", "fulltime": "full_time",
"part-time": "part_time", "part time": "part_time", "parttime": "part_time",
"intern": "internship", "internship": "internship", "contract": "contract",
"contractor": "contract", "temporary": "temporary", "freelance": "freelance"}
NAME = "lever" NAME = "lever"
LABEL = "Lever" LABEL = "Lever"
RANK = 20 RANK = 20
@@ -153,10 +145,10 @@ def parse(body: bytes, slug: str) -> list[Row]:
} }
# `country` is one code, for a role at one place; over several it would # `country` is one code, for a role at one place; over several it would
# gate the others by the first's country. # gate the others by the first's country.
country = str(j.get("country") or "").strip().upper() country = str(j.get("country") or "").strip()
if len(places) == 1 and re.fullmatch(r"[A-Z]{2}", country): if len(places) == 1 and country:
row["country"] = country row["country"] = country
if employment := table_word(_EMPLOYMENT, categories.get("commitment"), log, "commitment"): if employment := str(categories.get("commitment") or "").strip():
row["employment"] = employment row["employment"] = employment
rows.append(row) rows.append(row)
return rows return rows
+4 -4
View File
@@ -25,14 +25,14 @@ def test_the_primary_and_every_secondary_location_are_places() -> None:
assert second["places"] == [{"text": "Dublin", "remote": True}] assert second["places"] == [{"text": "Dublin", "remote": True}]
def test_a_hybrid_role_is_not_remote_although_the_host_flags_it() -> None: def test_remote_is_the_workplace_type_as_the_host_writes_it() -> None:
first, second = ashby.parse(BOARD, "acme") first, second = ashby.parse(BOARD, "acme")
assert first["remote"] == "hybrid" and second["remote"] == "remote" assert first["remote"] == "Hybrid" and second["remote"] == "Remote"
def test_the_employment_type_is_mapped() -> None: def test_the_employment_type_is_the_hosts_word() -> None:
first, second = ashby.parse(BOARD, "acme") first, second = ashby.parse(BOARD, "acme")
assert (first["employment"], second["employment"]) == ("full_time", "contract") assert (first["employment"], second["employment"]) == ("FullTime", "Contract")
def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None: def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None:
+7 -7
View File
@@ -47,15 +47,15 @@ def test_a_listing_becomes_rows() -> None:
assert second["url"] == "https://configit.bamboohr.com/careers/37" assert second["url"] == "https://configit.bamboohr.com/careers/37"
assert second["department"] == "Marketing" and rows[0]["department"] == "" assert second["department"] == "Marketing" and rows[0]["department"] == ""
assert second["location"] == "København Ø" assert second["location"] == "København Ø"
assert second["remote"] == "hybrid" assert second["remote"] == "2"
assert (second["posted"], second["description"], second["salary_text"]) == (None, "", "") assert (second["posted"], second["description"], second["salary_text"]) == (None, "", "")
@pytest.mark.parametrize(("flag", "kind", "remote"), [ @pytest.mark.parametrize(("flag", "kind", "remote"), [
(True, "0", "remote"), (None, "0", "onsite"), (None, "1", "remote"), (None, "2", "hybrid"), (True, "0", True), (None, "0", "0"), (None, "1", "1"), (None, "2", "2"),
(None, None, None), (False, "7", None)]) (None, None, None), (False, "7", "7")])
def test_remote_is_the_flag_then_the_location_type( def test_remote_is_the_flag_then_the_location_type(
flag: bool | None, kind: str | None, remote: str | None) -> None: flag: bool | None, kind: str | None, remote: bool | str | None) -> None:
body = json.loads(_read("bamboohr.json")) body = json.loads(_read("bamboohr.json"))
body["result"][0] |= {"isRemote": flag, "locationType": kind} body["result"][0] |= {"isRemote": flag, "locationType": kind}
assert bamboohr.parse(json.dumps(body).encode(), "configit")[0]["remote"] == remote assert bamboohr.parse(json.dumps(body).encode(), "configit")[0]["remote"] == remote
@@ -102,7 +102,7 @@ def test_detail_reads_the_text_the_date_and_the_country() -> None:
assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC) assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC)
assert found["location"] == "København Ø, Denmark" assert found["location"] == "København Ø, Denmark"
assert found["places"] == [{"text": "København Ø, Denmark", "remote": None}] assert found["places"] == [{"text": "København Ø, Denmark", "remote": None}]
assert found["remote"] == "hybrid" assert found["remote"] == "2"
text = found["description"] text = found["description"]
assert text.startswith("Our Global Marketing Team is looking for") assert text.startswith("Our Global Marketing Team is looking for")
assert "Skills & Experience" in text and "&amp;" not in text and "<" not in text assert "Skills & Experience" in text and "&amp;" not in text and "<" not in text
@@ -144,11 +144,11 @@ def test_the_board_and_its_details_are_read_with_the_json_accept_on_the_detail()
def test_the_role_states_one_place_and_the_employment() -> None: def test_the_role_states_one_place_and_the_employment() -> None:
rows = bamboohr.parse(_read("bamboohr.json"), "configit") rows = bamboohr.parse(_read("bamboohr.json"), "configit")
assert rows[1]["places"] == [{"text": "København Ø", "remote": None}] assert rows[1]["places"] == [{"text": "København Ø", "remote": None}]
assert rows[1]["employment"] == "full_time" assert rows[1]["employment"] == "Full-Time"
body = json.loads(_read("bamboohr.json")) body = json.loads(_read("bamboohr.json"))
body["result"][0] |= {"employmentStatusLabel": "Seasonal", "location": {"city": None}} body["result"][0] |= {"employmentStatusLabel": "Seasonal", "location": {"city": None}}
first = bamboohr.parse(json.dumps(body).encode(), "configit")[0] first = bamboohr.parse(json.dumps(body).encode(), "configit")[0]
assert first["places"] == [] and "employment" not in first assert first["places"] == [] and first["employment"] == "Seasonal"
def test_it_declares_what_it_reads() -> None: def test_it_declares_what_it_reads() -> None:
+5 -5
View File
@@ -32,7 +32,7 @@ def test_rows_come_from_the_payload_with_descriptions_resolved() -> None:
assert first["url"] == ("https://jobs.deel.com/klarna/job-details/" assert first["url"] == ("https://jobs.deel.com/klarna/job-details/"
"21584046-56d5-44c4-8b18-7e15dc659827/overview") "21584046-56d5-44c4-8b18-7e15dc659827/overview")
assert first["location"] == "Stockholm" and first["department"] == "Engineering" assert first["location"] == "Stockholm" and first["department"] == "Engineering"
assert first["remote"] == "onsite" assert first["remote"] == "ON_SITE"
assert first["description"].startswith("Klarna, briefly At Klarna") assert first["description"].startswith("Klarna, briefly At Klarna")
assert "<" not in first["description"] and "$" not in first["description"][:3] assert "<" not in first["description"] and "$" not in first["description"][:3]
assert all(r["description"] for r in rows) assert all(r["description"] for r in rows)
@@ -41,18 +41,18 @@ def test_rows_come_from_the_payload_with_descriptions_resolved() -> None:
"2026-09-07T12:33:38.484000+00:00" "2026-09-07T12:33:38.484000+00:00"
def test_several_locations_are_joined_and_remote_uses_the_stores_words() -> None: def test_several_locations_are_joined_and_remote_is_the_hosts_word() -> None:
rows = {r["source_id"][:8]: r for r in deel.parse(PAGE, "klarna")} rows = {r["source_id"][:8]: r for r in deel.parse(PAGE, "klarna")}
assert rows["a8be45ac"]["location"] == "Stockholm; London; Milan; Warsaw" assert rows["a8be45ac"]["location"] == "Stockholm; London; Milan; Warsaw"
assert rows["f96bb9d4"]["remote"] == "remote" assert rows["f96bb9d4"]["remote"] == "REMOTE"
assert rows["f96bb9d4"]["location"] == "Ohio" assert rows["f96bb9d4"]["location"] == "Ohio"
# Every place is kept, in the host's order; the work arrangement is the # Every place is kept, in the host's order; the work arrangement is the
# places' remote flag. # places' remote flag.
assert rows["a8be45ac"]["places"] == [ assert rows["a8be45ac"]["places"] == [
{"text": name, "remote": False} for name in ("Stockholm", "London", "Milan", "Warsaw")] {"text": name, "remote": False} for name in ("Stockholm", "London", "Milan", "Warsaw")]
assert rows["f96bb9d4"]["places"] == [{"text": "Ohio", "remote": True}] assert rows["f96bb9d4"]["places"] == [{"text": "Ohio", "remote": True}]
assert rows["f96bb9d4"]["employment"] == "contract" # "Consultant" assert rows["f96bb9d4"]["employment"] == "Consultant"
assert rows["21584046"]["employment"] == "full_time" assert rows["21584046"]["employment"] == "Full-time"
def test_pay_is_only_text_since_the_period_is_not_stated() -> None: def test_pay_is_only_text_since_the_period_is_not_stated() -> None:
+2 -2
View File
@@ -87,8 +87,8 @@ def test_a_page_becomes_rows() -> None:
@pytest.mark.parametrize(("option", "remote"), [ @pytest.mark.parametrize(("option", "remote"), [
("onsite", "onsite"), ("hybrid", "hybrid"), ("remote", "remote"), (None, None), ("odd", None)]) ("onsite", "onsite"), ("Hybrid", "Hybrid"), (None, None), ("odd", "odd"), (" ", None)])
def test_the_work_location_option_maps_to_the_remote_words( def test_the_work_location_option_is_the_hosts_word(
option: str | None, remote: str | None) -> None: option: str | None, remote: str | None) -> None:
assert eightfold.rows([_position(1) | {"workLocationOption": option}], SLUG)[0]["remote"] == remote assert eightfold.rows([_position(1) | {"workLocationOption": option}], SLUG)[0]["remote"] == remote
+6 -6
View File
@@ -55,7 +55,7 @@ def test_a_listing_becomes_rows() -> None:
assert first["source_id"] == "8080046002" # numeric, from a synced Greenhouse assert first["source_id"] == "8080046002" # numeric, from a synced Greenhouse
assert first["title"] == "Staff AI Product Engineer (Prague/Brno/Remote EU)" assert first["title"] == "Staff AI Product Engineer (Prague/Brno/Remote EU)"
assert first["url"] == "https://jobs.gem.com/productboard/8080046002" assert first["url"] == "https://jobs.gem.com/productboard/8080046002"
assert first["department"] == "Product Engineering" and first["remote"] == "hybrid" assert first["department"] == "Product Engineering" and first["remote"] == "HYBRID"
assert first["location"] == "Prague" assert first["location"] == "Prague"
assert (first["posted"], first["description"], first["salary_text"]) == (None, "", "") assert (first["posted"], first["description"], first["salary_text"]) == (None, "", "")
assert backend["source_id"] == "am9icG9zdDqWC1V_RM7U6ORvTd1Iu64r" # opaque assert backend["source_id"] == "am9icG9zdDqWC1V_RM7U6ORvTd1Iu64r" # opaque
@@ -64,16 +64,16 @@ def test_a_listing_becomes_rows() -> None:
assert backend["places"] == [{"text": "Prague", "remote": False}, assert backend["places"] == [{"text": "Prague", "remote": False},
{"text": "Remote Europe", "remote": True}, {"text": "Remote Europe", "remote": True},
{"text": "Brno", "remote": False}] {"text": "Brno", "remote": False}]
assert first["employment"] == "full_time" assert first["employment"] == "FULL_TIME"
assert len({r["source_id"] for r in rows}) == 11 assert len({r["source_id"] for r in rows}) == 11
@pytest.mark.parametrize(("kind", "flags", "remote"), [ @pytest.mark.parametrize(("kind", "flags", "remote"), [
("IN_OFFICE", [False], "onsite"), ("HYBRID", [True], "hybrid"), ("REMOTE", [False], "remote"), ("IN_OFFICE", [False], "IN_OFFICE"), ("HYBRID", [True], "HYBRID"), ("REMOTE", [False], "REMOTE"),
(None, [True, True], "remote"), (None, [True, False], None), (None, [], None), (None, [True, True], True), (None, [True, False], None), (None, [], None),
("SOMETHING_NEW", [False], None)]) ("SOMETHING_NEW", [False], "SOMETHING_NEW")])
def test_remote_is_the_location_type_then_the_locations( def test_remote_is_the_location_type_then_the_locations(
kind: str | None, flags: list[bool], remote: str | None) -> None: kind: str | None, flags: list[bool], remote: bool | str | None) -> None:
posting = {"extId": "1", "title": "Role", "job": {"locationType": kind}, posting = {"extId": "1", "title": "Role", "job": {"locationType": kind},
"locations": [{"city": "X", "isRemote": f} for f in flags]} "locations": [{"city": "X", "isRemote": f} for f in flags]}
assert gem.rows([posting], "acme")[0]["remote"] == remote assert gem.rows([posting], "acme")[0]["remote"] == remote
+4 -4
View File
@@ -51,7 +51,7 @@ def test_a_board_of_general_applications_reads_as_it_is() -> None:
rows = hibob.parse(DIXA, "dixa") rows = hibob.parse(DIXA, "dixa")
assert [(r["title"], r["location"], r["remote"]) for r in rows] == [ assert [(r["title"], r["location"], r["remote"]) for r in rows] == [
("Expression of interest", "Copenhagen, Denmark", "hybrid"), ("Expression of interest", "Copenhagen, Denmark", "hybrid"),
("Expression of interest", "London, United Kingdom", "onsite")] ("Expression of interest", "London, United Kingdom", "on_site")]
assert rows[1]["description"].startswith("We're always excited") assert rows[1]["description"].startswith("We're always excited")
@@ -153,10 +153,10 @@ def test_each_ad_names_one_site_and_the_host_lists_a_copy_per_site() -> None:
assert len({r["source_id"] for r in dixa}) == 2 assert len({r["source_id"] for r in dixa}) == 2
def test_the_employment_type_is_mapped_and_a_permanent_one_is_left_unmapped() -> None: def test_the_employment_type_is_the_hosts_word() -> None:
rows = hibob.parse(BOARD, "liquidia") rows = hibob.parse(BOARD, "liquidia")
assert rows[0]["employment"] == "full_time" # "Regular Full Time" assert rows[0]["employment"] == "Regular Full Time"
assert "employment" not in hibob.parse(DIXA, "dixa")[0] # "Permanent" assert hibob.parse(DIXA, "dixa")[0]["employment"] == "Permanent"
def test_it_declares_copies_with_a_page_and_a_robots_decision() -> None: def test_it_declares_copies_with_a_page_and_a_robots_decision() -> None:
+1 -1
View File
@@ -57,7 +57,7 @@ def test_a_page_becomes_rows() -> None:
"Manchester, United Kingdom"] "Manchester, United Kingdom"]
assert "country" not in several assert "country" not in several
assert first["places"] == [{"text": "Bucharest, Romania", "remote": None}] assert first["places"] == [{"text": "Bucharest, Romania", "remote": None}]
assert (first["country"], first["employment"]) == ("RO", "full_time") assert (first["country"], first["employment"]) == ("RO", "FULL_TIME")
assert all(r["description"] and "<" not in r["description"] and "&nbsp;" not in r["description"] assert all(r["description"] and "<" not in r["description"] and "&nbsp;" not in r["description"]
for r in rows) for r in rows)
+9 -14
View File
@@ -14,7 +14,6 @@ ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path: if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(ROOT))
from app import models as app_models # noqa: E402
from app.jobs.discover import boards_in # noqa: E402 from app.jobs.discover import boards_in # noqa: E402
from plugins import ats, readers # noqa: E402 from plugins import ats, readers # noqa: E402
from plugins.readers import Ask, jobylon # noqa: E402 from plugins.readers import Ask, jobylon # noqa: E402
@@ -36,20 +35,20 @@ def test_rows_come_from_the_embeds_literal() -> None:
assert first["location"] == "Stockholm" assert first["location"] == "Stockholm"
assert first["places"] == [{"text": "Stockholm", "remote": None}] assert first["places"] == [{"text": "Stockholm", "remote": None}]
assert first["department"] == "Accounting & Finance" # `&` read as `&` assert first["department"] == "Accounting & Finance" # `&` read as `&`
assert first["remote"] == "hybrid" assert first["remote"] == "Hybrid"
assert first["description"] == "" and first["salary_text"] == "" assert first["description"] == "" and first["salary_text"] == ""
# A day, with no time of day: the embed says "Sept. 25, 2026". # A day, with no time of day: the embed says "Sept. 25, 2026".
assert first["posted"] is not None and first["posted"].isoformat() == \ assert first["posted"] is not None and first["posted"].isoformat() == \
"2026-09-25T00:00:00+00:00" "2026-09-25T00:00:00+00:00"
def test_places_department_and_remote_follow_the_embeds_words() -> None: def test_places_department_and_remote_are_the_embeds_words() -> None:
rows = {r["source_id"]: r for r in jobylon.parse(BOARD, "3143")} rows = {r["source_id"]: r for r in jobylon.parse(BOARD, "3143")}
assert rows["384238"]["location"] == "Houston; Dallas; Atlanta" assert rows["384238"]["location"] == "Houston; Dallas; Atlanta"
assert [p["text"] for p in rows["384238"]["places"]] == ["Houston", "Dallas", "Atlanta"] assert [p["text"] for p in rows["384238"]["places"]] == ["Houston", "Dallas", "Atlanta"]
assert rows["384238"]["department"] == "" # "All functions" names none assert rows["384238"]["department"] == "" # "All functions" names none
assert rows["382124"]["remote"] == "remote" assert rows["382124"]["remote"] == "Remote"
assert rows["382860"]["remote"] == "onsite" assert rows["382860"]["remote"] == "On-site"
assert rows["380347"]["remote"] is None # a role with no workspace assert rows["380347"]["remote"] is None # a role with no workspace
@@ -130,18 +129,14 @@ def test_an_empty_board_is_no_roles() -> None:
assert jobylon.parse(EMPTY, "1056") == [] assert jobylon.parse(EMPTY, "1056") == []
def test_the_experience_is_mapped_and_a_word_the_table_lacks_is_logged( def test_the_experience_and_the_employment_type_are_the_hosts_words() -> None:
caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level("DEBUG", logger="plugins.readers.jobylon")
rows = {r["source_id"]: r for r in jobylon.parse(BOARD, "3143")} rows = {r["source_id"]: r for r in jobylon.parse(BOARD, "3143")}
assert rows["384238"]["seniority"] == "mid" # "Mid level" assert rows["384238"]["seniority"] == "Mid level"
assert "seniority" not in rows["385191"] # "Experienced" says too little assert rows["385191"]["seniority"] == "Experienced"
assert "unknown experience 'Experienced'" in caplog.text assert rows["385191"]["employment"] == "Full-time"
assert rows["385191"]["employment"] == "full_time"
assert all(r.get("seniority", "mid") in app_models.SENIORITIES for r in rows.values())
rows = {r["source_id"]: r for r in jobylon.parse( rows = {r["source_id"]: r for r in jobylon.parse(
(FIXTURES / "jobylon-places.html").read_bytes(), "3143")} (FIXTURES / "jobylon-places.html").read_bytes(), "3143")}
assert rows["502"]["seniority"] == "intern" and rows["502"]["employment"] == "internship" assert rows["502"]["seniority"] == "Student" and rows["502"]["employment"] == "Internship"
def test_a_summary_is_the_teaser_unless_the_embed_says_none() -> None: def test_a_summary_is_the_teaser_unless_the_embed_says_none() -> None:
+2 -2
View File
@@ -28,9 +28,9 @@ def test_the_country_is_only_taken_for_a_role_at_one_place() -> None:
assert "country" not in several and one["country"] == "DE" assert "country" not in several and one["country"] == "DE"
def test_the_commitment_is_mapped_and_a_permanent_one_is_left_unmapped() -> None: def test_the_commitment_is_the_hosts_word() -> None:
several, one = lever.parse(BOARD, "acme") several, one = lever.parse(BOARD, "acme")
assert several["employment"] == "full_time" and "employment" not in one assert several["employment"] == "Full-time" and one["employment"] == "Permanent"
def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None: def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None:
+37
View File
@@ -0,0 +1,37 @@
"""The ashby words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.ashby")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['REMOTE', 'EMPLOYMENT'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('remote', 'remote'), ('hybrid', 'hybrid'), ('onsite', 'onsite')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('fulltime', 'full_time'), ('parttime', 'part_time'), ('intern', 'internship'), ('contract', 'contract'), ('temporary', 'temporary')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The bamboohr words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.bamboohr")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('0', 'onsite'), ('1', 'remote'), ('2', 'hybrid')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('part time', 'part_time'), ('intern', 'internship'), ('contractor', 'contract')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The deel words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.deel")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('on_site', 'onsite'), ('hybrid', 'hybrid'), ('remote', 'remote')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('consultant', 'contract'), ('internship', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+32
View File
@@ -0,0 +1,32 @@
"""The eightfold words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.eightfold")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('onsite', 'onsite'), ('on_site', 'onsite'), ('hybrid', 'hybrid'), ('remote', 'remote')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The gem words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.gem")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('in_office', 'onsite'), ('hybrid', 'hybrid'), ('remote', 'remote')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('full_time', 'full_time'), ('contractor', 'contract'), ('intern', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The hibob words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.hibob")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('remote', 'remote'), ('hybrid', 'hybrid'), ('on_site', 'onsite'), ('onsite', 'onsite')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('regular full time', 'full_time'), ('fixed term', 'temporary'), ('intern', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+32
View File
@@ -0,0 +1,32 @@
"""The jibe words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.jibe")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('full_time', 'full_time'), ('contractor', 'contract'), ('intern', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+42
View File
@@ -0,0 +1,42 @@
"""The jobylon words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.jobylon")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['SENIORITY', 'EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('mid level', 'mid'), ('student', 'intern'), ('entry level', 'junior'), ('executive', 'exec'), ('not applicable', '')])
def test_seniority_words(word: str, value: str) -> None:
assert hosts.SENIORITY[word] == value
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('consultant', 'contract'), ('summer job', 'temporary')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
@pytest.mark.parametrize(("word", "value"), [('remote', 'remote'), ('hybrid', 'hybrid'), ('on-site', 'onsite')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
+32
View File
@@ -0,0 +1,32 @@
"""The lever words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.lever")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('fulltime', 'full_time'), ('intern', 'internship'), ('freelance', 'freelance')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+7 -1
View File
@@ -24,10 +24,16 @@ from plugins.readers._shared import ( # noqa: E402
#: The module-level names a reader keeps its employment words in. #: The module-level names a reader keeps its employment words in.
_TABLES = ("_EMPLOYMENT", "_CONTRACT", "_SCHEDULE") _TABLES = ("_EMPLOYMENT", "_CONTRACT", "_SCHEDULE")
#: The readers of `ashby` to `lever` hand on the host's words; their tables
#: moved to `app/prep/hosts`.
_RAW = {"ashby", "bamboohr", "deel", "eightfold", "gem", "greenhouse", "hibob", "hrmanager",
"jibe", "jobylon", "lever"}
def test_every_employment_table_maps_into_the_shared_vocabulary() -> None: def test_every_employment_table_maps_into_the_shared_vocabulary() -> None:
found = 0 found = 0
for name, module in readers.READERS.items(): for name, module in readers.READERS.items():
assert not _RAW & {name} or not any(hasattr(module, t) for t in _TABLES), name
for table_name in _TABLES: for table_name in _TABLES:
table = getattr(module, table_name, None) table = getattr(module, table_name, None)
if table is None: if table is None:
@@ -36,7 +42,7 @@ def test_every_employment_table_maps_into_the_shared_vocabulary() -> None:
values = table.values() if isinstance(table, dict) else [v for _k, v in table] values = table.values() if isinstance(table, dict) else [v for _k, v in table]
# "" is a known word that names no employment ("permanent"). # "" is a known word that names no employment ("permanent").
assert set(values) <= {*EMPLOYMENTS, ""}, (name, table_name) assert set(values) <= {*EMPLOYMENTS, ""}, (name, table_name)
assert found >= 15 assert found >= 5
def test_the_vocabulary_is_the_documented_one() -> None: def test_the_vocabulary_is_the_documented_one() -> None: