EvSys

AliasMatcher

Looks up whether predicted is an accepted answer for expected.

Inputs:

  • primary_aliases - flat map {slug_a: slug_b}. Treated as a symmetric equivalence: slug_a and slug_b are accepted interchangeably.
  • secondary_aliases - {slug_a: [slug_b, slug_c, ...]} for cases where multiple slugs are valid replacements (e.g. GOOGLESHEETS_QUERY_TABLE → {BATCH_GET, LOOKUP_SPREADSHEET_ROW, VALUES_GET}). Also symmetric.
  • bidirectional - set to False to disable reverse lookup (forward match only, like the original semantics).

Attributes

attributeprimary_aliasesdict[str, str]
= field(default_factory=dict)
attributesecondary_aliasesdict[str, list[str]]
= field(default_factory=dict)
attributebidirectionalbool
= True

Functions

func__post_init__(self) -> None
paramself

Returns

None
func_build_equivalence(self) -> None

Build {slug: {all_equivalents}} via union-find over alias pairs.

paramself

Returns

None
funcfrom_files(cls, primary_path, secondary_path=None, *, bidirectional=True) -> 'AliasMatcher'
paramcls
paramprimary_pathstr | Path
paramsecondary_pathstr | Path | None
= None
parambidirectionalbool
= True

Returns

'AliasMatcher'
funcaccepted_slugs(self, expected) -> list[str]

All slugs that count as a correct prediction for expected.

paramself
paramexpectedstr

Returns

list[str]
funcmatches(self, expected, predicted) -> bool
paramself
paramexpectedstr
parampredictedstr

Returns

bool
funcfound_in(self, expected, returned) -> bool

True if any accepted slug appears in returned (a list of slugs).

paramself
paramexpectedstr
paramreturnedlist[str]

Returns

bool
func__init__(self, primary_aliases=dict(), secondary_aliases=dict(), bidirectional=True) -> None
paramself
paramprimary_aliasesdict[str, str]
= dict()
paramsecondary_aliasesdict[str, list[str]]
= dict()
parambidirectionalbool
= True

Returns

None

On this page