Merge branch 'gates-any'

# Conflicts:
#	README.md
#	app/storage/store.py
This commit is contained in:
Wolf committed 2026-09-28 19:30:27 +02:00
commit 6779dda888
10 files changed
+143 -28

No files matched your search

+30 -3
View File
@@ -188,6 +188,30 @@ def country_of(place: str) -> str:
Remote = Literal["", "remote", "hybrid", "onsite"]
REMOTE: tuple[str, ...] = get_args(Remote)
#: Words in a location line that say how the role is worked, for a board that
#: gives no remote flag of its own: Greenhouse writes "Remote", "Hybrid" or
#: "Distributed" as the location and nothing else.
_REMOTE_WORDS: tuple[tuple[str, str], ...] = (
("hybrid", "hybrid"),
("remote", "remote"), ("distributed", "remote"), ("home based", "remote"),
("home-based", "remote"), ("work from home", "remote"), ("anywhere", "remote"),
("worldwide", "remote"), ("telecommute", "remote"),
("on-site", "onsite"), ("onsite", "onsite"), ("on site", "onsite"),
("in-office", "onsite"), ("in office", "onsite"),
)
def remote_of(place: str) -> str:
"""How a board's location line says the role is worked, as one of
`REMOTE`, or '' when it does not say. "Hybrid" wins over "remote" in the
same line ("Remote or hybrid, Berlin" is hybrid: some days in an office),
and a line that names only a place is ''."""
folded = _fold(place or "")
for word, mode in _REMOTE_WORDS:
if word in folded:
return mode
return ""
Seniority = Literal["", "intern", "junior", "mid", "senior", "staff", "lead", "manager",
"director", "exec"]
SENIORITIES: tuple[str, ...] = get_args(Seniority)
@@ -363,13 +387,16 @@ GateField = Literal["place", "country", "remote", "seniority", "function", "sala
"currency", "permit", "languages", "company"]
GATE_FIELDS: tuple[str, ...] = get_args(GateField)
GateMode = Literal["require", "prefer"]
GateMode = Literal["require", "any", "prefer"]
class Gate(Model):
"""One condition of an agent. `require` gates a role that fails it (the
row is kept with the reason); `prefer` adds `weight` to its score when it
matches."""
row is kept with the reason); the `any` gates together are one group a
role must match at least one of ("in Denmark, or remote"); `prefer` adds
`weight` to its score when it matches. A gate rejects on evidence only: a
role whose column is empty is not rejected, since `extract` fills the
column later for the roles that rank, and only for those."""
field: GateField
values: list[str | int | float] = Field(min_length=1)