Share the readers' place, table-lookup and country helpers, unify the employment vocabulary, and list the enrich switch with the stages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ca80219bbb
commit
903b69b6d3
34 files changed
+290
-207
No files matched your search
@@ -17,14 +17,13 @@ from __future__ import annotations
|
||||
import html
|
||||
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 Get, label_slug_ok, only, parse_dt
|
||||
from ._shared import Get, label_slug_ok, only, parse_dt, place, table_word
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -39,7 +38,7 @@ READS = Reads(
|
||||
#: 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": "intern", "internship": "intern",
|
||||
"temporary": "temporary", "intern": "internship", "internship": "internship",
|
||||
"freelance": "freelance"}
|
||||
|
||||
NAME = "bamboohr"
|
||||
@@ -97,18 +96,11 @@ def _place(j: dict[str, Any]) -> str:
|
||||
def _places(j: dict[str, Any]) -> list[Place]:
|
||||
"""The one place BambooHR states, if it states any."""
|
||||
text = _place(j)
|
||||
return [{"text": text, "remote": True if re.search(r"\bremote\b", text, re.I) else None}] \
|
||||
if text else []
|
||||
return [place(text)] if text else []
|
||||
|
||||
|
||||
def _employment(j: dict[str, Any]) -> str | None:
|
||||
label = str(j.get("employmentStatusLabel") or "").strip()
|
||||
if not label:
|
||||
return None
|
||||
found = _EMPLOYMENT.get(label.lower())
|
||||
if found is None:
|
||||
log.debug("bamboohr: unknown employmentStatusLabel %r", label)
|
||||
return found
|
||||
return table_word(_EMPLOYMENT, j.get("employmentStatusLabel"), log, "employmentStatusLabel")
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
|
||||
Reference in new issue
Block a user