Wire freehire, Jobnet and Akademikernes Jobbank into the CLI, the Sources form, dupes and the docs
Provider names, the CLI's choices and the dupes rule's search hosts now come from readers.PROVIDERS, and the regions, work modes and remote words from the modules' REGIONS, MODES and REMOTE, read with getattr so main works before and after the readers merge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
018a1ad895
commit
6e6e655203
16 files changed
+422
-39
No files matched your search
+18
-5
@@ -37,18 +37,31 @@ the strings boards really write and the storage layer only feeds it rows.
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import sys
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import dataclass
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
|
||||
from app import places
|
||||
from app.models import country_of
|
||||
|
||||
#: Hosts that search across companies rather than run a company's own board.
|
||||
#: A board closes a role reliably and carries the full text, so it is kept
|
||||
#: over a copy found here.
|
||||
SEARCH_HOSTS: frozenset[str] = frozenset({"jobindex", "adzuna", "platsbanken"})
|
||||
|
||||
def is_search_host(host: str) -> bool:
|
||||
"""Whether `host` is a provider that searches across companies rather than
|
||||
a company's own board: a reader of `scope="search"`. A board closes a role
|
||||
reliably and carries the full text, so it is kept over a copy found here.
|
||||
`plugins` is a top-level folder beside `app`, reached lazily, with the
|
||||
repo root put on the path when it is not there yet, as
|
||||
`app.models._declared_posted` does."""
|
||||
try:
|
||||
from plugins import readers
|
||||
except ImportError:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from plugins import readers
|
||||
|
||||
return host in readers.PROVIDERS
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -101,7 +114,7 @@ def keep_order(c: Copy) -> tuple[bool, bool, bool, str, str]:
|
||||
board over a search provider, then one with a description, then the
|
||||
earliest `posted_at` (none last), then the smallest `uid`, so the choice
|
||||
is the same on every run."""
|
||||
return (c.host in SEARCH_HOSTS, not c.has_description, not c.posted_at,
|
||||
return (is_search_host(c.host), not c.has_description, not c.posted_at,
|
||||
c.posted_at or "", c.uid)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user