Skip to content

Commit

Permalink
CI: Update static checks to black 23.3.0
Browse files Browse the repository at this point in the history
And apply it to the codebase, removing empty lines at the start of blocks.
  • Loading branch information
akien-mga committed Jun 19, 2023
1 parent 7641936 commit c9c941e
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Install Python dependencies and general setup
run: |
pip3 install black==22.3.0 pytest==7.1.2 mypy==0.971
pip3 install black==23.3.0 pytest==7.1.2 mypy==0.971
git config diff.wsErrorHighlight all
- name: Get changed files
Expand Down
1 change: 0 additions & 1 deletion core/core_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def next_tag(self):
data_list += part["Copyright"]

with open(dst, "w", encoding="utf-8") as f:

f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
f.write("#ifndef LICENSE_GEN_H\n")
f.write("#define LICENSE_GEN_H\n")
Expand Down
2 changes: 0 additions & 2 deletions core/object/make_virtuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def generate_version(argcount, const=False, returns=False):


def run(target, source, env):

max_versions = 12

txt = """
Expand All @@ -165,7 +164,6 @@ def run(target, source, env):
"""

for i in range(max_versions + 1):

txt += "/* " + str(i) + " Arguments */\n\n"
txt += generate_version(i, False, False)
txt += generate_version(i, False, True)
Expand Down
1 change: 0 additions & 1 deletion doc/tools/make_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,6 @@ def make_link(url: str, title: str) -> str:


def make_rst_index(grouped_classes: Dict[str, List[str]], dry_run: bool, output_dir: str) -> None:

if dry_run:
f = open(os.devnull, "w", encoding="utf-8")
else:
Expand Down
3 changes: 0 additions & 3 deletions editor/editor_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


def make_doc_header(target, source, env):

dst = target[0]
g = open(dst, "w", encoding="utf-8")
buf = ""
Expand Down Expand Up @@ -51,7 +50,6 @@ def make_doc_header(target, source, env):


def make_fonts_header(target, source, env):

dst = target[0]

g = open(dst, "w", encoding="utf-8")
Expand Down Expand Up @@ -80,7 +78,6 @@ def make_fonts_header(target, source, env):


def make_translations_header(target, source, env, category):

dst = target[0]

g = open(dst, "w", encoding="utf-8")
Expand Down
4 changes: 1 addition & 3 deletions editor/icons/editor_icons_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
from io import StringIO
from platform_methods import subprocess_main


# See also `scene/resources/default_theme/default_theme_icons_builders.py`.
def make_editor_icons_action(target, source, env):

dst = target[0]
svg_icons = source

icons_string = StringIO()

for f in svg_icons:

fname = str(f)

icons_string.write('\t"')
Expand Down Expand Up @@ -48,7 +47,6 @@ def make_editor_icons_action(target, source, env):
thumb_big_indices = []
index = 0
for f in svg_icons:

fname = str(f)

# Trim the `.svg` extension from the string.
Expand Down
7 changes: 0 additions & 7 deletions gles3_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
line = fs.readline()

while line:

if line.find("=") != -1 and header_data.reading == "":
# Mode
eqpos = line.find("=")
Expand Down Expand Up @@ -121,7 +120,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:

x = x.strip()
x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
Expand All @@ -143,7 +141,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
uline = uline.replace("{", "").strip()
lines = uline.split(",")
for x in lines:

x = x.strip()
x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
Expand All @@ -159,7 +156,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:

x = x.strip()
x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
Expand Down Expand Up @@ -486,7 +482,6 @@ def build_gles3_header(
fd.write("\tvirtual void _init() override {\n\n")

if header_data.uniforms:

fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if header_data.uniforms:
for x in header_data.uniforms:
Expand All @@ -497,7 +492,6 @@ def build_gles3_header(

variant_count = 1
if len(header_data.variant_defines) > 0:

fd.write("\t\tstatic const char* _variant_defines[]={\n")
for x in header_data.variant_defines:
fd.write('\t\t\t"' + x + '",\n')
Expand Down Expand Up @@ -542,7 +536,6 @@ def build_gles3_header(
feedback_count = 0

if header_data.feedbacks:

fd.write("\t\tstatic const Feedback _feedbacks[]={\n")
for x in header_data.feedbacks:
name = x[0]
Expand Down
2 changes: 0 additions & 2 deletions glsl_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth:
line = fs.readline()

while line:

index = line.find("//")
if index != -1:
line = line[:index]
Expand Down Expand Up @@ -184,7 +183,6 @@ def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, dept
line = fs.readline()

while line:

while line.find("#include ") != -1:
includeline = line.replace("#include ", "").strip()[1:-1]

Expand Down
9 changes: 0 additions & 9 deletions methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,11 @@ def generate_version_header(module_version_string=""):


def parse_cg_file(fname, uniforms, sizes, conditionals):

fs = open(fname, "r")
line = fs.readline()

while line:

if re.match(r"^\s*uniform", line):

res = re.match(r"uniform ([\d\w]*) ([\d\w]*)")
type = res.groups(1)
name = res.groups(2)
Expand Down Expand Up @@ -507,7 +504,6 @@ def sort_module_list(env):


def use_windows_spawn_fix(self, platform=None):

if os.name != "nt":
return # not needed, only for windows

Expand All @@ -522,7 +518,6 @@ def use_windows_spawn_fix(self, platform=None):
self.Replace(ARFLAGS="q")

def mySubProcess(cmdline, env):

startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
popen_args = {
Expand All @@ -545,7 +540,6 @@ def mySubProcess(cmdline, env):
return rv

def mySpawn(sh, escape, cmd, args, env):

newargs = " ".join(args[1:])
cmdline = cmd + " " + newargs

Expand All @@ -566,7 +560,6 @@ def mySpawn(sh, escape, cmd, args, env):


def save_active_platforms(apnames, ap):

for x in ap:
svg_names = []
if os.path.isfile(x + "/logo.svg"):
Expand Down Expand Up @@ -594,7 +587,6 @@ def save_active_platforms(apnames, ap):


def no_verbose(sys, env):

colors = {}

# Colors are disabled in non-TTY environments such as pipes. This means
Expand Down Expand Up @@ -708,7 +700,6 @@ def detect_visual_c_compiler_version(tools_env):

# and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
if "VCTOOLSINSTALLDIR" in tools_env:

# Newer versions have a different path available
vc_amd64_compiler_detection_index = (
tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX64\\X64;")
Expand Down
2 changes: 1 addition & 1 deletion modules/denoise/resource_to_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import os
from array import array


# Generates a C++ file from the specified binary resource file
def generate(in_path, out_path):

namespace = "oidn::weights"
scopes = namespace.split("::")

Expand Down
1 change: 0 additions & 1 deletion platform/uwp/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def can_build():
if os.name == "nt":
# building natively on windows!
if os.getenv("VSINSTALLDIR"):

if os.getenv("ANGLE_SRC_PATH") is None:
return False

Expand Down
1 change: 0 additions & 1 deletion platform_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
def run_in_subprocess(builder_function):
@functools.wraps(builder_function)
def wrapper(target, source, env):

# Convert SCons Node instances to absolute paths
target = [node.srcnode().abspath for node in target]
source = [node.srcnode().abspath for node in source]
Expand Down
3 changes: 0 additions & 3 deletions scene/resources/default_theme/default_theme_icons_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@

# See also `editor/icons/editor_icons_builders.py`.
def make_default_theme_icons_action(target, source, env):

dst = target[0]
svg_icons = source

icons_string = StringIO()

for f in svg_icons:

fname = str(f)

icons_string.write('\t"')
Expand Down Expand Up @@ -49,7 +47,6 @@ def make_default_theme_icons_action(target, source, env):

index = 0
for f in svg_icons:

fname = str(f)

# Trim the `.svg` extension from the string.
Expand Down
4 changes: 1 addition & 3 deletions scu_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def find_files_in_folder(folder, sub_folder, include_list, extension, sought_exc
sub_folder_slashed = sub_folder + "/"

for file in glob.glob("*." + extension):

simple_name = Path(file).stem

if file.endswith(".gen.cpp"):
Expand All @@ -62,7 +61,6 @@ def find_files_in_folder(folder, sub_folder, include_list, extension, sought_exc


def write_output_file(file_count, include_list, start_line, end_line, output_folder, output_filename_prefix, extension):

output_folder = os.path.abspath(output_folder)

if not os.path.isdir(output_folder):
Expand Down Expand Up @@ -160,6 +158,7 @@ def find_section_name(sub_folder):
# which is slow like a normal build, but prevents the naming conflicts.
# Ideally in these situations, the source code should be changed to prevent naming conflicts.


# "extension" will usually be cpp, but can also be set to c (for e.g. third party libraries that use c)
def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension="cpp"):
if len(folders) == 0:
Expand Down Expand Up @@ -243,7 +242,6 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=


def generate_scu_files(verbose, is_release_build):

print("=============================")
print("Single Compilation Unit Build")
print("=============================")
Expand Down

0 comments on commit c9c941e

Please sign in to comment.