Plan seniority as a ladder with two tracks and a range filter; the ladder in models

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 12:58:12 +02:00
1 parent d858020068
commit ae978594b4
4 files changed
+111 -4

No files matched your search

+37 -1
View File
@@ -643,12 +643,48 @@ def remote_of(place: str) -> str:
return mode
return ""
#: A role's level, '' when nothing says. From `staff` up a level sits on one
#: of two tracks, individual contributor or people lead, and each rung pairs
#: the two as big tech firms do: Staff with Manager, Principal with Senior
#: Manager, Distinguished with Director. `lead` is a team lead (Team Lead,
#: Supervisor, Teamleiter); a "Tech Lead" or "Marketing Lead" is `staff`.
Seniority = Literal["", "intern", "junior", "mid", "senior", "staff", "lead", "manager",
"director", "exec"]
"principal", "senior_manager", "distinguished", "director", "exec"]
SENIORITIES: tuple[str, ...] = get_args(Seniority)
#: The levels a seniority filter may name: `SENIORITIES` without the unknown.
LEVELS: tuple[str, ...] = tuple(level for level in SENIORITIES if level)
#: The rungs of the ladder from the bottom, each named after its lowest
#: individual level; a range filter names two of them.
RUNGS: tuple[str, ...] = ("intern", "junior", "mid", "senior", "staff", "principal",
"distinguished", "exec")
#: The tracks a filter may keep: `ic` (individual contributor) or `people`.
TRACKS: tuple[str, ...] = ("ic", "people")
#: Each level's rung (an index into `RUNGS`) and track; the rungs below
#: `staff` have no track and pass either.
LADDER: dict[str, tuple[int, str]] = {
"intern": (0, ""), "junior": (1, ""), "mid": (2, ""), "senior": (3, ""),
"staff": (4, "ic"), "lead": (4, "people"), "manager": (4, "people"),
"principal": (5, "ic"), "senior_manager": (5, "people"),
"distinguished": (6, "ic"), "director": (6, "people"),
"exec": (7, "people"),
}
def levels_between(low: str = "", high: str = "", track: str = "") -> tuple[str, ...]:
"""The levels from rung `low` to rung `high` (names in `RUNGS`, '' for
the open end) on `track` (`TRACKS`, '' for both), in `LEVELS` order. A
level with no track passes any track. An unknown name is a ValueError."""
for name, value, allowed in (("low", low, RUNGS), ("high", high, RUNGS),
("track", track, TRACKS)):
if value and value not in allowed:
raise ValueError(f"{name} is one of {', '.join(allowed)}, not {value!r}")
bottom = RUNGS.index(low) if low else 0
top = RUNGS.index(high) if high else len(RUNGS) - 1
return tuple(level for level in LEVELS
if bottom <= LADDER[level][0] <= top
and (not track or LADDER[level][1] in ("", track)))
#: The kind of contract a posting states, as `app.prep` maps a host's word.
#: '' is "it does not say". `plugins/readers/_shared.py` keeps a copy for the
#: readers' own tests, since a plugin imports nothing from `app`.