Skip to content

Commit 382c760

Browse files
committed
SCons: Apply new ruff/mypy fixes
1 parent f60f69a commit 382c760

File tree

6 files changed

+29
-31
lines changed

6 files changed

+29
-31
lines changed

SConstruct

+2-3
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ if not env["platform"]:
313313
env["platform"] = "windows"
314314

315315
if env["platform"]:
316-
print(f'Automatically detected platform: {env["platform"]}')
316+
print(f"Automatically detected platform: {env['platform']}")
317317

318318
# Deprecated aliases kept for compatibility.
319319
if env["platform"] in compatibility_platform_aliases:
@@ -998,8 +998,7 @@ if env["disable_3d"]:
998998
if env["disable_advanced_gui"]:
999999
if env.editor_build:
10001000
print_error(
1001-
"Build option `disable_advanced_gui=yes` cannot be used for editor builds, "
1002-
"only for export template builds."
1001+
"Build option `disable_advanced_gui=yes` cannot be used for editor builds, only for export template builds."
10031002
)
10041003
Exit(255)
10051004
else:

doc/tools/make_rst.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
920920
# Ascendants
921921
if class_def.inherits:
922922
inherits = class_def.inherits.strip()
923-
f.write(f'**{translate("Inherits:")}** ')
923+
f.write(f"**{translate('Inherits:')}** ")
924924
first = True
925925
while inherits is not None:
926926
if not first:
@@ -947,7 +947,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
947947
inherited.append(c.name)
948948

949949
if len(inherited):
950-
f.write(f'**{translate("Inherited By:")}** ')
950+
f.write(f"**{translate('Inherited By:')}** ")
951951
for i, child in enumerate(inherited):
952952
if i > 0:
953953
f.write(", ")
@@ -1496,7 +1496,7 @@ def resolve_type(link_type: str) -> str:
14961496
return f"``{link_type}``"
14971497

14981498
if klass.endswith("[]"): # Typed array, strip [] to link to contained type.
1499-
return f":ref:`Array<class_Array>`\\[{resolve_type(klass[:-len('[]')])}\\]"
1499+
return f":ref:`Array<class_Array>`\\[{resolve_type(klass[: -len('[]')])}\\]"
15001500

15011501
if klass.startswith("Dictionary["): # Typed dictionary, split elements to link contained types.
15021502
parts = klass[len("Dictionary[") : -len("]")].partition(", ")
@@ -2542,7 +2542,7 @@ def format_table(f: TextIO, data: List[Tuple[Optional[str], ...]], remove_empty_
25422542
for i, text in enumerate(row):
25432543
if column_sizes[i] == 0 and remove_empty_columns:
25442544
continue
2545-
row_text += f' {(text or "").ljust(column_sizes[i])} |'
2545+
row_text += f" {(text or '').ljust(column_sizes[i])} |"
25462546
row_text += "\n"
25472547

25482548
f.write(f" {row_text}")

gles3_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def build_gles3_header(
499499
fd.write("\t\t};\n\n")
500500
variant_count = len(header_data.variant_defines)
501501
else:
502-
fd.write("\t\tstatic const char **_variant_defines[]={" "};\n")
502+
fd.write('\t\tstatic const char **_variant_defines[]={" "};\n')
503503

504504
if header_data.texunits:
505505
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")

methods.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import subprocess
88
import sys
99
from collections import OrderedDict
10-
from io import StringIO, TextIOWrapper
10+
from io import StringIO, TextIOBase
1111
from pathlib import Path
1212
from typing import Generator, List, Optional, Union, cast
1313

@@ -1201,7 +1201,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12011201
vsconf = ""
12021202
for a in vs_configuration["arches"]:
12031203
if arch == a["architecture"]:
1204-
vsconf = f'{target}|{a["platform"]}'
1204+
vsconf = f"{target}|{a['platform']}"
12051205
break
12061206

12071207
condition = "'$(GodotConfiguration)|$(GodotPlatform)'=='" + vsconf + "'"
@@ -1217,7 +1217,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12171217
properties.append(
12181218
"<ActiveProjectItemList_%s>;%s;</ActiveProjectItemList_%s>" % (x, ";".join(itemlist[x]), x)
12191219
)
1220-
output = f'bin\\godot{env["PROGSUFFIX"]}'
1220+
output = f"bin\\godot{env['PROGSUFFIX']}"
12211221

12221222
with open("misc/msvs/props.template", "r", encoding="utf-8") as file:
12231223
props_template = file.read()
@@ -1453,7 +1453,7 @@ def generated_wrapper(
14531453
guard: Optional[bool] = None,
14541454
prefix: str = "",
14551455
suffix: str = "",
1456-
) -> Generator[TextIOWrapper, None, None]:
1456+
) -> Generator[TextIOBase, None, None]:
14571457
"""
14581458
Wrapper class to automatically handle copyright headers and header guards
14591459
for generated scripts. Meant to be invoked via `with` statement similar to
@@ -1475,8 +1475,7 @@ def generated_wrapper(
14751475
if isinstance(path, list):
14761476
if len(path) > 1:
14771477
print_warning(
1478-
"Attempting to use generated wrapper with multiple targets; "
1479-
f"will only use first entry: {path[0]}"
1478+
f"Attempting to use generated wrapper with multiple targets; will only use first entry: {path[0]}"
14801479
)
14811480
path = path[0]
14821481
if not hasattr(path, "get_abspath"):

modules/text_server_adv/gdextension_build/SConstruct

+10-10
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if env["thorvg_enabled"] and env["freetype_enabled"]:
110110
env.Append(CPPDEFINES=["MODULE_SVG_ENABLED"])
111111

112112
lib = env_tvg.Library(
113-
f'tvg_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
113+
f"tvg_builtin{env['suffix']}{env['LIBSUFFIX']}",
114114
thirdparty_tvg_sources,
115115
)
116116
env.Append(LIBS=[lib])
@@ -155,7 +155,7 @@ if env["msdfgen_enabled"] and env["freetype_enabled"]:
155155
env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"])
156156

157157
lib = env_msdfgen.Library(
158-
f'msdfgen_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
158+
f"msdfgen_builtin{env['suffix']}{env['LIBSUFFIX']}",
159159
thirdparty_msdfgen_sources,
160160
)
161161
env.Append(LIBS=[lib])
@@ -284,7 +284,7 @@ if env["freetype_enabled"]:
284284
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
285285

286286
lib = env_freetype.Library(
287-
f'freetype_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
287+
f"freetype_builtin{env['suffix']}{env['LIBSUFFIX']}",
288288
thirdparty_freetype_sources,
289289
)
290290
env.Append(LIBS=[lib])
@@ -418,7 +418,7 @@ if env["freetype_enabled"]:
418418
env.Append(CPPPATH=["../../../thirdparty/harfbuzz/src"])
419419

420420
lib = env_harfbuzz.Library(
421-
f'harfbuzz_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
421+
f"harfbuzz_builtin{env['suffix']}{env['LIBSUFFIX']}",
422422
thirdparty_harfbuzz_sources,
423423
)
424424
env.Prepend(LIBS=[lib])
@@ -478,7 +478,7 @@ if env["graphite_enabled"] and env["freetype_enabled"]:
478478
)
479479

480480
lib = env_graphite.Library(
481-
f'graphite_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
481+
f"graphite_builtin{env['suffix']}{env['LIBSUFFIX']}",
482482
thirdparty_graphite_sources,
483483
)
484484
env.Append(LIBS=[lib])
@@ -737,7 +737,7 @@ env.Append(CPPPATH=["../../../thirdparty/icu4c/common/", "../../../thirdparty/ic
737737
if env["platform"] == "windows":
738738
env.Append(LIBS=["advapi32"])
739739

740-
lib = env_icu.Library(f'icu_builtin{env["suffix"]}{env["LIBSUFFIX"]}', thirdparty_icu_sources)
740+
lib = env_icu.Library(f"icu_builtin{env['suffix']}{env['LIBSUFFIX']}", thirdparty_icu_sources)
741741
env.Append(LIBS=[lib])
742742

743743
env.Append(CPPDEFINES=["GDEXTENSION"])
@@ -746,18 +746,18 @@ sources = Glob("../*.cpp")
746746

747747
if env["platform"] == "macos":
748748
methods.write_macos_plist(
749-
f'./bin/libtextserver_advanced.macos.{env["target"]}.framework',
750-
f'libtextserver_advanced.macos.{env["target"]}',
749+
f"./bin/libtextserver_advanced.macos.{env['target']}.framework",
750+
f"libtextserver_advanced.macos.{env['target']}",
751751
"org.godotengine.textserver_advanced",
752752
"ICU / HarfBuzz / Graphite Text Server",
753753
)
754754
library = env.SharedLibrary(
755-
f'./bin/libtextserver_advanced.macos.{env["target"]}.framework/libtextserver_advanced.macos.{env["target"]}',
755+
f"./bin/libtextserver_advanced.macos.{env['target']}.framework/libtextserver_advanced.macos.{env['target']}",
756756
source=sources,
757757
)
758758
else:
759759
library = env.SharedLibrary(
760-
f'./bin/libtextserver_advanced{env["suffix"]}{env["SHLIBSUFFIX"]}',
760+
f"./bin/libtextserver_advanced{env['suffix']}{env['SHLIBSUFFIX']}",
761761
source=sources,
762762
)
763763

modules/text_server_fb/gdextension_build/SConstruct

+7-7
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ if env["thorvg_enabled"] and env["freetype_enabled"]:
105105
env.Append(CPPDEFINES=["MODULE_SVG_ENABLED"])
106106

107107
lib = env_tvg.Library(
108-
f'tvg_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
108+
f"tvg_builtin{env['suffix']}{env['LIBSUFFIX']}",
109109
thirdparty_tvg_sources,
110110
)
111111
env.Append(LIBS=[lib])
@@ -150,7 +150,7 @@ if env["msdfgen_enabled"] and env["freetype_enabled"]:
150150
env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"])
151151

152152
lib = env_msdfgen.Library(
153-
f'msdfgen_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
153+
f"msdfgen_builtin{env['suffix']}{env['LIBSUFFIX']}",
154154
thirdparty_msdfgen_sources,
155155
)
156156
env.Append(LIBS=[lib])
@@ -279,7 +279,7 @@ if env["freetype_enabled"]:
279279
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
280280

281281
lib = env_freetype.Library(
282-
f'freetype_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
282+
f"freetype_builtin{env['suffix']}{env['LIBSUFFIX']}",
283283
thirdparty_freetype_sources,
284284
)
285285
env.Append(LIBS=[lib])
@@ -291,18 +291,18 @@ sources = Glob("../*.cpp")
291291

292292
if env["platform"] == "macos":
293293
methods.write_macos_plist(
294-
f'./bin/libtextserver_fallback.macos.{env["target"]}.framework',
295-
f'libtextserver_fallback.macos.{env["target"]}',
294+
f"./bin/libtextserver_fallback.macos.{env['target']}.framework",
295+
f"libtextserver_fallback.macos.{env['target']}",
296296
"org.godotengine.textserver_fallback",
297297
"Fallback Text Server",
298298
)
299299
library = env.SharedLibrary(
300-
f'./bin/libtextserver_fallback.macos.{env["target"]}.framework/libtextserver_fallback.macos.{env["target"]}',
300+
f"./bin/libtextserver_fallback.macos.{env['target']}.framework/libtextserver_fallback.macos.{env['target']}",
301301
source=sources,
302302
)
303303
else:
304304
library = env.SharedLibrary(
305-
f'./bin/libtextserver_fallback{env["suffix"]}{env["SHLIBSUFFIX"]}',
305+
f"./bin/libtextserver_fallback{env['suffix']}{env['SHLIBSUFFIX']}",
306306
source=sources,
307307
)
308308

0 commit comments

Comments
 (0)