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
@@ -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 is_web_url, num, only, parse_dt, path_slug_ok, pay_line
|
||||
from ._shared import add_place, is_web_url, num, only, parse_dt, path_slug_ok, pay_line, place
|
||||
|
||||
NAME = "greenhouse"
|
||||
LABEL = "Greenhouse"
|
||||
@@ -132,19 +132,16 @@ def _places(j: dict[str, Any]) -> list[Place]:
|
||||
out: list[Place] = []
|
||||
for office in j.get("offices") or []:
|
||||
text = str((office or {}).get("location") or (office or {}).get("name") or "").strip()
|
||||
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 None})
|
||||
add_place(out, place(text))
|
||||
if not out or not name or _PLACEHOLDER.fullmatch(name):
|
||||
return out or ([{"text": name, "remote": True if re.search(r"\bremote\b", name, re.I)
|
||||
else None}] if name else [])
|
||||
return out or ([place(name)] if name else [])
|
||||
# A name that says something the offices do not (a "Remote India" beside
|
||||
# an office in Bangalore) is one more place; one they already contain,
|
||||
# or that contains them, is the same place said twice.
|
||||
low = name.lower()
|
||||
if any(p["text"].lower() in low or low in p["text"].lower() for p in out):
|
||||
return out
|
||||
return [{"text": name, "remote": True if re.search(r"\bremote\b", name, re.I) else None}, *out]
|
||||
return [place(name), *out]
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
|
||||
Reference in new issue
Block a user