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
@@ -15,7 +15,7 @@ from typing import Any
|
||||
from desk.sources import strip_html
|
||||
|
||||
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__)
|
||||
|
||||
@@ -36,13 +36,6 @@ READS = Reads(
|
||||
|
||||
_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:
|
||||
@@ -113,12 +106,12 @@ def _salary_text(compensation: dict[str, Any]) -> str:
|
||||
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
|
||||
words. The primary is remote or an office as `workplaceType` says; a
|
||||
place that names itself remote is remote."""
|
||||
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)
|
||||
for s in j.get("secondaryLocations") or []]
|
||||
out: list[Place] = []
|
||||
@@ -127,10 +120,6 @@ def _places(j: dict[str, Any], workplace: str | None) -> list[Place]:
|
||||
return out
|
||||
|
||||
|
||||
def _employment(value: Any) -> str | None:
|
||||
return table_word(_EMPLOYMENT, value, log, "employmentType")
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
data = json.loads(body)
|
||||
rows = []
|
||||
@@ -142,7 +131,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
description = j.get("descriptionHtml") or j.get("descriptionPlain") or ""
|
||||
compensation = j.get("compensation") 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)
|
||||
row: Row = {
|
||||
"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")),
|
||||
"department": (j.get("department") or j.get("team") or "").strip(),
|
||||
"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_min": salary_min,
|
||||
"salary_max": salary_max,
|
||||
"currency": currency,
|
||||
}
|
||||
if employment := _employment(j.get("employmentType")):
|
||||
if employment := str(j.get("employmentType") or "").strip():
|
||||
row["employment"] = employment
|
||||
rows.append(row)
|
||||
return rows
|
||||
@@ -23,7 +23,7 @@ from typing import Any
|
||||
from desk.sources import strip_html
|
||||
|
||||
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__)
|
||||
|
||||
@@ -34,13 +34,6 @@ READS = Reads(
|
||||
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"
|
||||
LABEL = "BambooHR"
|
||||
PATTERNS = (
|
||||
@@ -49,9 +42,6 @@ PATTERNS = (
|
||||
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.
|
||||
_JSON = {"Accept": "application/json"}
|
||||
|
||||
@@ -76,10 +66,11 @@ def feed_url(slug: str, ask: Ask) -> str:
|
||||
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:
|
||||
return "remote"
|
||||
return _REMOTE.get(str(j.get("locationType") if j.get("locationType") is not None else ""))
|
||||
return True
|
||||
return None if j.get("locationType") is None else str(j["locationType"]).strip() or None
|
||||
|
||||
|
||||
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 []
|
||||
|
||||
|
||||
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]:
|
||||
"""`/careers/list` -> `{"meta": {"totalCount": n}, "result": [...]}`. A
|
||||
role has `id`, `jobOpeningName`, `departmentLabel`, `location` (`city`,
|
||||
@@ -136,7 +123,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"remote": _remote(j),
|
||||
"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
|
||||
out.append(row)
|
||||
return out
|
||||
@@ -160,6 +147,6 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
if place := _place(opening):
|
||||
out["location"] = place
|
||||
out["places"] = _places(opening)
|
||||
if remote := _remote(opening):
|
||||
if (remote := _remote(opening)) is not None:
|
||||
out["remote"] = remote
|
||||
return out
|
||||
+5
-14
@@ -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, table_word
|
||||
from ._shared import num, only, parse_dt, pay_line
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -59,15 +59,6 @@ _PUSH = re.compile(r'self\.__next_f\.push\(\[1,("(?:[^"\\]|\\.)*")\]\)')
|
||||
_ROW = re.compile(rb"([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:
|
||||
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:
|
||||
"""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 []:
|
||||
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 None
|
||||
|
||||
@@ -155,7 +146,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
description = p.get("richtextDescription") or ""
|
||||
if description.startswith("$"):
|
||||
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)
|
||||
row: Row = {
|
||||
"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")),
|
||||
"department": ", ".join(dict.fromkeys(departments)),
|
||||
"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")),
|
||||
pay.get("currencyIsoCode"), "")
|
||||
if p.get("isCompensationVisible") else ""),
|
||||
|
||||
@@ -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.
|
||||
_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]:
|
||||
"""`(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")),
|
||||
"department": str(p.get("department") or "").strip(),
|
||||
"description": "",
|
||||
"remote": _REMOTE.get(str(p.get("workLocationOption") or "").strip().lower()),
|
||||
"remote": str(p.get("workLocationOption") or "").strip() or None,
|
||||
"salary_text": "",
|
||||
})
|
||||
return out
|
||||
|
||||
+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
|
||||
|
||||
@@ -23,7 +23,7 @@ from typing import Any
|
||||
from desk.sources import strip_html
|
||||
|
||||
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__)
|
||||
|
||||
@@ -38,21 +38,10 @@ READS = Reads(
|
||||
"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"
|
||||
LABEL = "HiBob"
|
||||
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.
|
||||
_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")),
|
||||
"department": str(ad.get("department") or "").strip(),
|
||||
"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_min": salary_min,
|
||||
"salary_max": salary_max,
|
||||
"currency": code,
|
||||
}
|
||||
if employment := table_word(_EMPLOYMENT, ad.get("employmentType"), log, "employmentType"):
|
||||
if employment := str(ad.get("employmentType") or "").strip():
|
||||
row["employment"] = employment
|
||||
out.append(row)
|
||||
return out
|
||||
@@ -38,7 +38,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, place, table_word
|
||||
from ._shared import Get, Page, add_place, only, parse_dt, place
|
||||
|
||||
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)",
|
||||
)
|
||||
|
||||
#: `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"
|
||||
LABEL = "Jibe"
|
||||
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
|
||||
# gate the others by the site's own.
|
||||
code = str(j.get("country_code") or "").strip().upper()
|
||||
if len(places) == 1 and re.fullmatch(r"[A-Z]{2}", code):
|
||||
code = str(j.get("country_code") or "").strip()
|
||||
if len(places) == 1 and 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
|
||||
out.append(row)
|
||||
return out
|
||||
@@ -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
|
||||
|
||||
@@ -17,14 +17,13 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
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__)
|
||||
|
||||
@@ -36,13 +35,6 @@ READS = Reads(
|
||||
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"
|
||||
LABEL = "Lever"
|
||||
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
|
||||
# gate the others by the first's country.
|
||||
country = str(j.get("country") or "").strip().upper()
|
||||
if len(places) == 1 and re.fullmatch(r"[A-Z]{2}", country):
|
||||
country = str(j.get("country") or "").strip()
|
||||
if len(places) == 1 and 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
|
||||
rows.append(row)
|
||||
return rows
|
||||
Reference in new issue
Block a user