Module matching

Source
Expand description

Pattern matching utilities for file filtering.

This module provides glob-style pattern matching compatible with Sphinx’s include_patterns and exclude_patterns functionality. It implements the same pattern translation and matching logic as Sphinx’s util/matching.py.

Functions§

compile_pattern
Compiles a pattern into a regex, using cache for performance.
get_matching_files
Gets matching files from a directory using include and exclude patterns.
normalize_path
Normalizes a path to use forward slashes for pattern matching. This ensures consistent behavior across platforms.
pattern_filter
Filters a list of names by a glob pattern.
pattern_match
Tests if a name matches a glob pattern.
translate_pattern
Translates shell-style glob pattern to regex pattern.