ruff: Fix UP006 Use list instead of List for type annotation.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-07-11 17:30:17 -07:00
committed by Tim Abbott
parent c2214b3904
commit e08a24e47f
457 changed files with 3588 additions and 3857 deletions

View File

@@ -4,10 +4,9 @@ import glob
import os
import re
import sys
from typing import List
def validate_order(order: List[int], length: int) -> None:
def validate_order(order: list[int], length: int) -> None:
if len(order) != length:
print("Please enter the sequence of all the conflicting files at once")
sys.exit(1)
@@ -18,8 +17,8 @@ def validate_order(order: List[int], length: int) -> None:
sys.exit(1)
def renumber_migration(conflicts: List[str], order: List[int], last_correct_migration: str) -> None:
stack: List[str] = []
def renumber_migration(conflicts: list[str], order: list[int], last_correct_migration: str) -> None:
stack: list[str] = []
for i in order:
if conflicts[i - 1][0:4] not in stack:
stack.append(conflicts[i - 1][0:4])
@@ -38,7 +37,7 @@ def renumber_migration(conflicts: List[str], order: List[int], last_correct_migr
last_correct_migration = new_name.replace(".py", "")
def resolve_conflicts(conflicts: List[str], files_list: List[str]) -> None:
def resolve_conflicts(conflicts: list[str], files_list: list[str]) -> None:
print("Conflicting migrations:")
for i in range(len(conflicts)):
print(str(i + 1) + ". " + conflicts[i])
@@ -56,8 +55,8 @@ def resolve_conflicts(conflicts: List[str], files_list: List[str]) -> None:
if __name__ == "__main__":
MIGRATIONS_TO_SKIP = {"0209", "0261", "0501"}
while True:
conflicts: List[str] = []
stack: List[str] = []
conflicts: list[str] = []
stack: list[str] = []
files_list = [os.path.basename(path) for path in glob.glob("zerver/migrations/????_*.py")]
file_index = [file[0:4] for file in files_list]