glob_to_sqlite#
- barecat.util.glob_helper.glob_to_sqlite(pat)[source]#
Convert Python glob pattern to SQLite GLOB pattern.
Handles the differences between Python glob and SQLite GLOB: - Python uses [!…] for negation, SQLite uses [^…] - Python treats [^…] as a bracket with literal ^, SQLite treats it as negation
Transformations: - [!] (invalid, literal) -> [[]!] - [!X…] (negation) -> [^X…] - [^] (bracket with ^) -> ^ - [^^^…] (only carets) -> ^ - [^^X…] (leading carets) -> [X…^^] - Unclosed [ -> [[]