Update pre-commit hooks configuration to use ruff instead of black

This commit is contained in:
Jakub Marcowski
2024-05-21 15:14:59 +02:00
committed by Thaddeus Crews
parent aaa4560729
commit d9f8ef68df
47 changed files with 244 additions and 241 deletions

View File

@ -10,11 +10,11 @@ import os
import pickle
import sys
import time
from types import ModuleType
from collections import OrderedDict
from importlib.util import spec_from_file_location, module_from_spec
from SCons import __version__ as scons_raw_version
from importlib.util import module_from_spec, spec_from_file_location
from types import ModuleType
from SCons import __version__ as scons_raw_version
# Explicitly resolve the helper modules, this is done to avoid clash with
# modules of the same name that might be randomly added (e.g. someone adding
@ -53,12 +53,12 @@ _helper_module("core.core_builders", "core/core_builders.py")
_helper_module("main.main_builders", "main/main_builders.py")
# Local
import methods
import glsl_builders
import gles3_builders
import glsl_builders
import methods
import scu_builders
from methods import print_warning, print_error
from platform_methods import architectures, architecture_aliases
from methods import print_error, print_warning
from platform_methods import architecture_aliases, architectures
if ARGUMENTS.get("target", "editor") == "editor":
_helper_module("editor.editor_builders", "editor/editor_builders.py")
@ -68,7 +68,7 @@ if ARGUMENTS.get("target", "editor") == "editor":
# <https://github.com/python/cpython/issues/73245>
if sys.stdout.isatty() and sys.platform == "win32":
try:
from ctypes import windll, byref, WinError # type: ignore
from ctypes import WinError, byref, windll # type: ignore
from ctypes.wintypes import DWORD # type: ignore
stdout_handle = windll.kernel32.GetStdHandle(DWORD(-11))
@ -562,7 +562,7 @@ if env["build_profile"] != "":
dbo = ft["disabled_build_options"]
for c in dbo:
env[c] = dbo[c]
except:
except json.JSONDecodeError:
print_error('Failed to open feature build profile: "{}"'.format(env["build_profile"]))
Exit(255)
@ -570,7 +570,7 @@ if env["build_profile"] != "":
# These can sometimes override default options.
flag_list = platform_flags[env["platform"]]
for f in flag_list:
if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
if f[0] not in ARGUMENTS or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
env[f[0]] = f[1]
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
@ -591,7 +591,7 @@ if env["production"]:
# Run SCU file generation script if in a SCU build.
if env["scu_build"]:
max_includes_per_scu = 8
if env.dev_build == True:
if env.dev_build:
max_includes_per_scu = 1024
read_scu_limit = int(env["scu_limit"])
@ -984,7 +984,7 @@ GLSL_BUILDERS = {
env.Append(BUILDERS=GLSL_BUILDERS)
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
if scons_cache_path is not None:
CacheDir(scons_cache_path)
print("Scons cache enabled... (path: '" + scons_cache_path + "')")