Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/gitingest/query_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
_get_user_and_repo_from_path,
_is_valid_git_commit_hash,
_is_valid_pattern,
_normalize_pattern,
_validate_host,
_validate_url_scheme,
)
Expand Down Expand Up @@ -311,7 +310,7 @@ def _parse_patterns(pattern: set[str] | str) -> set[str]:
if not _is_valid_pattern(p):
raise InvalidPatternError(p)

return {_normalize_pattern(p) for p in parsed_patterns}
return parsed_patterns


def _parse_local_dir_path(path_str: str) -> IngestionQuery:
Expand Down
24 changes: 0 additions & 24 deletions src/gitingest/utils/query_parser_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import os
import string

HEX_DIGITS: set[str] = set(string.hexdigits)
Expand Down Expand Up @@ -150,26 +149,3 @@ def _get_user_and_repo_from_path(path: str) -> tuple[str, str]:
msg = f"Invalid repository URL '{path}'"
raise ValueError(msg)
return path_parts[0], path_parts[1]


def _normalize_pattern(pattern: str) -> str:
"""Normalize the given pattern by removing leading separators and appending a wildcard.

This function processes the pattern string by stripping leading directory separators
and appending a wildcard (``*``) if the pattern ends with a separator.

Parameters
----------
pattern : str
The pattern to normalize.

Returns
-------
str
The normalized pattern.

"""
pattern = pattern.lstrip(os.sep)
if pattern.endswith(os.sep):
pattern += "*"
return pattern
Loading