mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
ruff: Fix SIM115 Use a context manager for opening files.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
10271fb850
commit
71ca928ec9
@@ -24,9 +24,9 @@ def renumber_migration(conflicts: list[str], order: list[int], last_correct_migr
|
||||
stack.append(conflicts[i - 1][0:4])
|
||||
else:
|
||||
# Replace dependencies with the last correct migration
|
||||
file = fileinput.FileInput("zerver/migrations/" + conflicts[i - 1], inplace=True)
|
||||
for line in file:
|
||||
print(re.sub(r"[\d]+(_[a-z0-9]+)+", last_correct_migration, line), end="")
|
||||
with fileinput.FileInput("zerver/migrations/" + conflicts[i - 1], inplace=True) as file:
|
||||
for line in file:
|
||||
print(re.sub(r"[\d]+(_[a-z0-9]+)+", last_correct_migration, line), end="")
|
||||
|
||||
# Rename the migration indexing at the end
|
||||
new_name = conflicts[i - 1].replace(
|
||||
|
Reference in New Issue
Block a user