mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
SCons: Integrate annotations where relevant
• Expand Ruff linter to catch & upgrade legacy type-hint syntax
This commit is contained in:
parent
235a32ad11
commit
11fc998368
9 changed files with 116 additions and 104 deletions
|
|
@ -4,10 +4,11 @@
|
|||
# the Unicode Character Database to the `char_range.inc` file.
|
||||
# NOTE: This script is deliberately not integrated into the build system;
|
||||
# you should run it manually whenever you want to update the data.
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Final, List, Set, Tuple
|
||||
from typing import Final
|
||||
from urllib.request import urlopen
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
@ -18,9 +19,9 @@ from methods import generate_copyright_header
|
|||
URL: Final[str] = "https://www.unicode.org/Public/16.0.0/ucd/Blocks.txt"
|
||||
|
||||
|
||||
ranges: List[Tuple[str, str, str]] = []
|
||||
ranges: list[tuple[str, str, str]] = []
|
||||
|
||||
exclude_blocks: Set[str] = {
|
||||
exclude_blocks: set[str] = {
|
||||
"High Surrogates",
|
||||
"High Private Use Surrogates",
|
||||
"Low Surrogates",
|
||||
|
|
@ -33,13 +34,13 @@ exclude_blocks: Set[str] = {
|
|||
|
||||
|
||||
def parse_unicode_data() -> None:
|
||||
lines: List[str] = [line.decode("utf-8") for line in urlopen(URL)]
|
||||
lines: list[str] = [line.decode("utf-8") for line in urlopen(URL)]
|
||||
|
||||
for line in lines:
|
||||
if line.startswith("#") or not line.strip():
|
||||
continue
|
||||
|
||||
split_line: List[str] = line.split(";")
|
||||
split_line: list[str] = line.split(";")
|
||||
|
||||
char_range: str = split_line[0].strip()
|
||||
block: str = split_line[1].strip()
|
||||
|
|
@ -52,7 +53,7 @@ def parse_unicode_data() -> None:
|
|||
ranges.append((f"0x{range_start}", f"0x{range_end}", block))
|
||||
|
||||
|
||||
def make_array(array_name: str, ranges: List[Tuple[str, str, str]]) -> str:
|
||||
def make_array(array_name: str, ranges: list[tuple[str, str, str]]) -> str:
|
||||
result: str = f"static UniRange {array_name}[] = {{\n"
|
||||
|
||||
for start, end, block in ranges:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue