python: Normalize quotes with Black.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-11 23:20:45 -08:00
committed by Tim Abbott
parent 11741543da
commit 6e4c3e41dc
989 changed files with 32792 additions and 32792 deletions

View File

@@ -25,23 +25,23 @@ 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)
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='')
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(
conflicts[i - 1][0:4], f'{int(last_correct_migration[0:4]) + 1:04}'
conflicts[i - 1][0:4], f"{int(last_correct_migration[0:4]) + 1:04}"
)
os.rename('zerver/migrations/' + conflicts[i - 1], 'zerver/migrations/' + new_name)
os.rename("zerver/migrations/" + conflicts[i - 1], "zerver/migrations/" + new_name)
last_correct_migration = new_name.replace('.py', '')
last_correct_migration = new_name.replace(".py", "")
def resolve_conflicts(conflicts: List[str], files_list: List[str]) -> None:
print("Conflicting migrations:")
for i in range(0, len(conflicts)):
print(str(i + 1) + '. ' + conflicts[i])
print(str(i + 1) + ". " + conflicts[i])
order_input = input("Enter the order in which these migrations should be arranged: ")
order = list(map(int, order_input.split()))
@@ -49,13 +49,13 @@ def resolve_conflicts(conflicts: List[str], files_list: List[str]) -> None:
last_correct_migration = conflicts[order[0] - 1]
last_correct_migration = last_correct_migration.replace('.py', '')
last_correct_migration = last_correct_migration.replace(".py", "")
renumber_migration(conflicts, order, last_correct_migration)
if __name__ == '__main__':
if __name__ == "__main__":
MIGRATIONS_TO_SKIP = {'0209', '0261'}
MIGRATIONS_TO_SKIP = {"0209", "0261"}
while True:
conflicts: List[str] = []
stack: List[str] = []