Readers oracle to workday and the providers 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
06eb929eaf
48 files changed
+460
-388
No files matched your search
@@ -8,16 +8,13 @@ Recruitee.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Row, add_place, country_if_single, is_web_url, label_slug_ok, num, only, parse_dt, pay_line, table_word, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
from ._shared import Row, add_place, is_web_url, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
|
||||
|
||||
NAME = "recruitee"
|
||||
LABEL = "Recruitee"
|
||||
@@ -27,23 +24,11 @@ PATTERNS = (r"https?://([a-z0-9-]+)\.recruitee\.com",)
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="listing", complete="whole",
|
||||
places="many",
|
||||
fields=Fields(pay="figures", posted="trusted", remote="stated", country="stated",
|
||||
fields=Fields(pay="figures", posted="trusted", remote="stated",
|
||||
seniority="stated", employment="stated"),
|
||||
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
||||
)
|
||||
|
||||
#: `experience_code` -> the app's levels. `experienced` names no level and is
|
||||
#: known, so it maps to none; a word not listed is logged at debug level.
|
||||
_SENIORITY = {"student_school": "intern", "entry_level": "junior", "mid_level": "mid",
|
||||
"experienced": ""}
|
||||
|
||||
#: The words of `employment_type_code` (`fulltime_permanent`), the first that
|
||||
#: is found deciding, so a contract type beats the hours.
|
||||
_EMPLOYMENT = (("internship", "internship"), ("intern", "internship"),
|
||||
("freelance", "contract"), ("contract", "contract"),
|
||||
("temporary", "temporary"), ("fixed", "temporary"),
|
||||
("parttime", "part_time"), ("fulltime", "full_time"))
|
||||
|
||||
#: What the board writes as a place for a role that is worked anywhere.
|
||||
_NO_PLACE = ("remote job",)
|
||||
|
||||
@@ -82,28 +67,13 @@ def _salary_text(salary: dict[str, Any]) -> str:
|
||||
salary.get("currency"), period)
|
||||
|
||||
|
||||
def _seniority(code: str) -> str | None:
|
||||
return table_word(_SENIORITY, code, log, "experience_code")
|
||||
|
||||
|
||||
def _employment(code: str) -> str | None:
|
||||
words = set(code.strip().lower().replace("-", "_").split("_"))
|
||||
for word, value in _EMPLOYMENT:
|
||||
if word in words:
|
||||
return value
|
||||
if code.strip():
|
||||
log.debug("recruitee: unknown employment_type_code %r", code)
|
||||
return None
|
||||
|
||||
|
||||
def _places(offer: dict[str, Any]) -> tuple[list[Place], set[str]]:
|
||||
"""Every place of an offer and the countries' codes among them. `locations`
|
||||
def _places(offer: dict[str, Any]) -> list[Place]:
|
||||
"""Every place of an offer. `locations`
|
||||
lists them (city, state, country), `location` is the first as one line and
|
||||
is the fallback for an offer that lists none. The board writes "Remote
|
||||
job" where an offer has no place: that is not one, and a remote offer with
|
||||
no other place has the place "Remote"."""
|
||||
found: list[Place] = []
|
||||
codes: set[str] = set()
|
||||
|
||||
def add(text: str) -> None:
|
||||
text = text.strip()
|
||||
@@ -119,15 +89,11 @@ def _places(offer: dict[str, Any]) -> tuple[list[Place], set[str]]:
|
||||
if part and part not in parts:
|
||||
parts.append(part)
|
||||
add(", ".join(parts))
|
||||
if code := str(loc.get("country_code") or "").strip().upper():
|
||||
codes.add(code)
|
||||
if not found:
|
||||
add(str(offer.get("location") or offer.get("city") or ""))
|
||||
if code := str(offer.get("country_code") or "").strip().upper():
|
||||
codes.add(code)
|
||||
if not found and offer.get("remote"):
|
||||
found.append({"text": "Remote", "remote": True})
|
||||
return found, codes
|
||||
return found
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
@@ -145,7 +111,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
salary_min, salary_max, currency = yearly_amount(
|
||||
salary.get("min"), salary.get("max"), salary.get("currency"),
|
||||
salary.get("period"), {"year": 1, "month": 12})
|
||||
places, codes = _places(j)
|
||||
places = _places(j)
|
||||
rows.append({
|
||||
"source_id": str(j.get("id") or ""),
|
||||
"title": title,
|
||||
@@ -160,8 +126,7 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"salary_min": salary_min,
|
||||
"salary_max": salary_max,
|
||||
"currency": currency,
|
||||
"country": country_if_single(codes),
|
||||
"seniority": _seniority(str(j.get("experience_code") or "")),
|
||||
"employment": _employment(str(j.get("employment_type_code") or "")),
|
||||
"seniority": str(j.get("experience_code") or "").strip() or None,
|
||||
"employment": str(j.get("employment_type_code") or "").strip() or None,
|
||||
})
|
||||
return rows
|
||||
Reference in new issue
Block a user