structlint.utils
Small and simple utility functions.
get_project_root() -> Path
default_module_root_dir() -> Path
default_module_name() -> str
move_path(p: str | Path, old_base: Path, new_base: Path) -> Path
always_true(s: str) -> bool
assert_bool(b: bool) -> bool
sort_on_path(strings: Iterable[str]) -> list[str]
boolean_merge(incumbent: dict, challenger: dict) -> dict
deduplicate_ordered(strings: Iterable[str]) -> list[str]
filter_with(string_set: set[str], contained: str | set[str]) -> set[str]
filter_without(string_set: set[str], contained: str | set[str]) -> set[str]
remove_ordering_index(s: str) -> str
prepend_module_name(s: str, module_name: str) -> str
dedup_underscores(s: str) -> str
remove_body(s: str) -> str
safe_search(p: re.Pattern, s: str, groupnum: int, fallback: str = '') -> str
make_regex(s: str) -> re.Pattern
compile_for_path_segment(s: str | list[str]) -> re.Pattern
compile_string_or_bool(s: str | bool) -> re.Pattern
get_method_name(s: str) -> str
path_matches(p: Path | str, path_pattern: re.Pattern) -> Path | Literal[False]
path_matches_not(p: Path | str, path_pattern: re.Pattern) -> bool
Color
Simple utility to add ANSI color codes to a string, including the reset at the end.