Skip to content

Commit 92052a0

Browse files
Copilotjoocer
andcommitted
Address code review feedback - clarify comments and test docstrings
Co-authored-by: joocer <[email protected]>
1 parent ddef1a4 commit 92052a0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

opteryx/utils/paths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ def match_wildcard(pattern: str, path: str) -> bool:
128128
>>> match_wildcard("bucket/path/*.parquet", "bucket/path/sub/file.parquet")
129129
False
130130
"""
131-
# Split pattern and path into parts
131+
# Split pattern and path into parts using OS path separator for cross-platform compatibility
132132
pattern_parts = pattern.split(OS_SEP)
133133
path_parts = path.split(OS_SEP)
134134

135-
# Must have same number of parts for a match (unless using ** which we don't support yet)
135+
# Must have same number of path parts for a match (wildcards don't cross directory boundaries)
136136
if len(pattern_parts) != len(path_parts):
137137
return False
138138

tests/unit/utils/test_paths_wildcards.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ def test_split_wildcard_path():
5555

5656

5757
def test_match_wildcard():
58-
"""Test wildcard pattern matching with glob-like semantics"""
58+
"""
59+
Test wildcard pattern matching with glob-like semantics.
60+
61+
Glob-like semantics means wildcards don't cross directory boundaries:
62+
- * matches any characters except path separators
63+
- ? matches single character except path separators
64+
- [range] matches character range except path separators
65+
"""
5966
# Asterisk matches multiple characters (but not path separators)
6067
assert paths.match_wildcard("bucket/path/*.parquet", "bucket/path/file1.parquet") is True
6168
assert paths.match_wildcard("bucket/path/*.parquet", "bucket/path/file2.parquet") is True

0 commit comments

Comments
 (0)