11from pathlib import Path
22from typing import Iterable , Optional , Tuple
3- import pathspec
3+ from pathspec import PathSpec
44
55def parse_cgcignore_lines (lines : Iterable [str ]) -> list [str ]:
66 """Return valid ignore patterns from raw .cgcignore lines.
@@ -47,7 +47,7 @@ def build_ignore_spec(
4747 ignore_root : Path ,
4848 default_patterns : list [str ],
4949 explicit_path : Optional [str ] = None ,
50- ) -> Tuple [pathspec . PathSpec , Optional [Path ]]:
50+ ) -> Tuple [PathSpec , Optional [Path ]]:
5151 """Build PathSpec using merged default + user .cgcignore patterns.
5252
5353 Returns the compiled spec and the discovered/created .cgcignore path.
@@ -57,7 +57,7 @@ def build_ignore_spec(
5757 if cgcignore_path :
5858 user_patterns = parse_cgcignore_lines (cgcignore_path .read_text (encoding = "utf-8" ).splitlines ())
5959 all_patterns = default_patterns + user_patterns
60- return pathspec . PathSpec .from_lines ("gitwildmatch" , all_patterns ), cgcignore_path
60+ return PathSpec .from_lines ("gitwildmatch" , all_patterns ), cgcignore_path
6161
6262 if explicit_path :
6363 target_path = Path (explicit_path )
@@ -66,4 +66,4 @@ def build_ignore_spec(
6666 else :
6767 target_path = ignore_root / ".cgcignore"
6868 ensure_default_cgcignore (target_path , default_patterns )
69- return pathspec . PathSpec .from_lines ("gitwildmatch" , default_patterns ), target_path
69+ return PathSpec .from_lines ("gitwildmatch" , default_patterns ), target_path
0 commit comments