Integration check: wp-p-prep with wp-r1-raw and wp-r2-raw
Resolves tests/test_readers_shared.py, adds MATCH_MODE to the pinpoint, recruitee and rippling tables, and removes table_word, country_if_single and remote_word from plugins/readers/_shared.py with their tests and the Helpers paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
55757c41e5
51 files changed
+445
-502
No files matched your search
@@ -8,7 +8,6 @@ import it without either importing the other. The leading underscore keeps
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime
|
||||
@@ -218,36 +217,3 @@ def add_place(found: list[Place], entry: Place) -> None:
|
||||
found.append(entry)
|
||||
|
||||
|
||||
def table_word(table: dict[str, str], value: Any, log: logging.Logger, what: str) -> str | None:
|
||||
"""`table`'s word for a host's `value`, looked up without case. None when
|
||||
the host states none, when the table maps the word to "" (a known word
|
||||
that names no level, such as `experienced`), or when the table does not
|
||||
know it; that last case is logged at debug level so the table can grow."""
|
||||
word = str(value or "").strip()
|
||||
if not word:
|
||||
return None
|
||||
found = table.get(word.lower())
|
||||
if found is None:
|
||||
log.debug("%s: unknown %s %r", log.name.rsplit(".", 1)[-1], what, word)
|
||||
return found or None
|
||||
|
||||
|
||||
def country_if_single(codes: Any) -> str | None:
|
||||
"""The one code among `codes` when there is exactly one, else None: a
|
||||
country is stated for a role only when all its places share it."""
|
||||
return next(iter(codes)) if len(codes) == 1 else None
|
||||
|
||||
|
||||
#: "Birkerød, Hybrid position", "Nordhavn og mulighed for hjemmearbejde".
|
||||
_HYBRID = re.compile(r"\bhybrid|hjemmearbejde", re.IGNORECASE)
|
||||
_REMOTE = re.compile(
|
||||
r"\bremote\b|fjernarbejde|fuldt hjemmearbejde|distansarbete|på distans", re.IGNORECASE)
|
||||
|
||||
|
||||
def remote_word(text: str) -> str | None:
|
||||
"""`remote`, `hybrid` or None: the word a search provider's headline or
|
||||
town line says about where the work is done, in Danish, Swedish and
|
||||
English. A board states its own remote flag and needs none of this."""
|
||||
if _REMOTE.search(text):
|
||||
return "remote"
|
||||
return "hybrid" if _HYBRID.search(text) else None
|
||||
Reference in new issue
Block a user