Module dirct.key_mappers.basename_key_mapper

Classes

class BasenameKeyMapper (hidden: bool = True, strict: bool = True)

A key mapper that ignores leading dots and trailing file extensions in both keys and file names.

Args

hidden
Whether to include hidden files (i.e. files starting with a dot).
strict
Whether to raise a AmbiguityError if multiple files match a key.

Methods

def get_path(self, key: str, parent: pathlib.Path) ‑> pathlib.Path | None
def key_of(self, path: pathlib.Path) ‑> str | None