Skip to content

Commit 1974070

Browse files
committed
remove simple wildcard func and added desc
1 parent 0606a15 commit 1974070

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

aws_xray_sdk/core/utils/search_pattern.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def wildcard_match(pattern, text, case_insensitive=True):
1818
# Check the special case of a single * pattern, as it's common
1919
if pattern == '*':
2020
return True
21-
21+
22+
# If elif logic Checking different conditions like match between the first i chars in text
23+
# and the first j chars in pattern, checking pattern has '?' or '*' also check for case_insensitivity
24+
# iStar is introduced to store length of the text and i, p and pStar for indexing
2225
i = 0
2326
p = 0
2427
iStar = len(text)
@@ -53,30 +56,3 @@ def wildcard_match(pattern, text, case_insensitive=True):
5356
p = p + 1
5457

5558
return p == len(pattern) and i == len(text)
56-
57-
58-
def _simple_wildcard_match(pattern, text):
59-
j = 0
60-
pattern_len = len(pattern)
61-
text_len = len(text)
62-
for i in range(0, pattern_len):
63-
p = pattern[i]
64-
if p == '*':
65-
# Presumption for this method is that globs only occur at end
66-
return True
67-
elif p == '?':
68-
if j == text_len:
69-
# No character to match
70-
return False
71-
j += 1
72-
else:
73-
if j >= text_len:
74-
return False
75-
76-
if p != text[j]:
77-
return False
78-
j += 1
79-
80-
# Ate up all the pattern and didn't end at a glob, so a match
81-
# will have consumed all the text
82-
return j == text_len

0 commit comments

Comments
 (0)