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
@@ -9,14 +9,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 is_web_url, num, only, parse_dt, path_slug_ok, pay_line, yearly_amount
|
||||
from ._shared import add_place, is_web_url, num, only, parse_dt, path_slug_ok, pay_line, place, table_word, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -42,7 +41,7 @@ _API = "api.ashbyhq.com"
|
||||
_WORKPLACE = {"remote": "remote", "hybrid": "hybrid", "onsite": "onsite"}
|
||||
|
||||
#: `employmentType` -> the app's employment words.
|
||||
_EMPLOYMENT = {"fulltime": "full_time", "parttime": "part_time", "intern": "intern",
|
||||
_EMPLOYMENT = {"fulltime": "full_time", "parttime": "part_time", "intern": "internship",
|
||||
"contract": "contract", "temporary": "temporary"}
|
||||
|
||||
|
||||
@@ -124,20 +123,12 @@ def _places(j: dict[str, Any], workplace: str | None) -> list[Place]:
|
||||
for s in j.get("secondaryLocations") or []]
|
||||
out: list[Place] = []
|
||||
for text, remote in named:
|
||||
if text and text not in (p["text"] for p in out):
|
||||
out.append({"text": text, "remote": True if re.search(r"\bremote\b", text, re.I)
|
||||
else remote})
|
||||
add_place(out, place(text, remote))
|
||||
return out
|
||||
|
||||
|
||||
def _employment(value: Any) -> str | None:
|
||||
word = str(value or "").strip()
|
||||
if not word:
|
||||
return None
|
||||
found = _EMPLOYMENT.get(word.lower())
|
||||
if found is None:
|
||||
log.debug("ashby: unknown employmentType %r", word)
|
||||
return found
|
||||
return table_word(_EMPLOYMENT, value, log, "employmentType")
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
|
||||
Reference in new issue
Block a user