Skip to content

Commit b1eebae

Browse files
Remove helper function _normalize_pattern (and its use inside _parse_patterns) (#386)
1 parent dead917 commit b1eebae

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

src/gitingest/query_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
_get_user_and_repo_from_path,
1919
_is_valid_git_commit_hash,
2020
_is_valid_pattern,
21-
_normalize_pattern,
2221
_validate_host,
2322
_validate_url_scheme,
2423
)
@@ -311,7 +310,7 @@ def _parse_patterns(pattern: set[str] | str) -> set[str]:
311310
if not _is_valid_pattern(p):
312311
raise InvalidPatternError(p)
313312

314-
return {_normalize_pattern(p) for p in parsed_patterns}
313+
return parsed_patterns
315314

316315

317316
def _parse_local_dir_path(path_str: str) -> IngestionQuery:

src/gitingest/utils/query_parser_utils.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
import os
65
import string
76

87
HEX_DIGITS: set[str] = set(string.hexdigits)
@@ -150,26 +149,3 @@ def _get_user_and_repo_from_path(path: str) -> tuple[str, str]:
150149
msg = f"Invalid repository URL '{path}'"
151150
raise ValueError(msg)
152151
return path_parts[0], path_parts[1]
153-
154-
155-
def _normalize_pattern(pattern: str) -> str:
156-
"""Normalize the given pattern by removing leading separators and appending a wildcard.
157-
158-
This function processes the pattern string by stripping leading directory separators
159-
and appending a wildcard (``*``) if the pattern ends with a separator.
160-
161-
Parameters
162-
----------
163-
pattern : str
164-
The pattern to normalize.
165-
166-
Returns
167-
-------
168-
str
169-
The normalized pattern.
170-
171-
"""
172-
pattern = pattern.lstrip(os.sep)
173-
if pattern.endswith(os.sep):
174-
pattern += "*"
175-
return pattern

0 commit comments

Comments
 (0)