Skip to content

Commit 2728dcd

Browse files
committed
Match style of surrounding fnmatch code a little better.
1 parent a07118b commit 2728dcd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Lib/fnmatch.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ def translate(pat, seps=None):
9292
i = i+1
9393
if c == '*':
9494
# compress consecutive `*` into one
95-
h = i - 1
95+
h = i-1
9696
while i < n and pat[i] == '*':
97-
i = i + 1
98-
97+
i = i+1
9998
if seps:
100-
star_count = i - h
101-
is_segment = (h == 0 or pat[h - 1] in seps) and (i == n or pat[i] in seps)
99+
star_count = i-h
100+
is_segment = (h == 0 or pat[h-1] in seps) and (i == n or pat[i] in seps)
102101
if star_count == 1:
103102
if is_segment:
104103
add(f'{DOT}+')
@@ -109,7 +108,7 @@ def translate(pat, seps=None):
109108
add('.*')
110109
else:
111110
add(f'(.*[{SEPS}])?')
112-
i += 1
111+
i = i+1
113112
else:
114113
raise ValueError("Invalid pattern: '**' can only be an entire path component")
115114
else:

0 commit comments

Comments
 (0)