Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d767bb

Browse files
committed
Replace match.group(n) with match[n]
1 parent 9000e9d commit 5d767bb

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pre_commit/commands/autoupdate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ def _write_new_config(path: str, rev_infos: List[Optional[RevInfo]]) -> None:
121121
new_rev = new_rev_s.split(':', 1)[1].strip()
122122
if rev_info.frozen is not None:
123123
comment = f' # frozen: {rev_info.frozen}'
124-
elif match.group(4).strip().startswith('# frozen:'):
124+
elif match[4].strip().startswith('# frozen:'):
125125
comment = ''
126126
else:
127-
comment = match.group(4)
127+
comment = match[4]
128128
lines[idx] = f'{match[1]}rev:{match[2]}{new_rev}{comment}{match[5]}'
129129

130130
with open(path, 'w') as f:

pre_commit/languages/pygrep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _process_filename_at_once(pattern: Pattern[bytes], filename: str) -> int:
4141
line_no = contents[:match.start()].count(b'\n')
4242
output.write(f'{filename}:{line_no + 1}:')
4343

44-
matched_lines = match.group().split(b'\n')
44+
matched_lines = match[0].split(b'\n')
4545
matched_lines[0] = contents.split(b'\n')[line_no]
4646

4747
output.write_line(b'\n'.join(matched_lines))

0 commit comments

Comments
 (0)