diff --git a/modules/blendfile.py b/modules/blendfile.py index 5e5dfc1b07497e548ede16ee29d768b60668ee2e..fc1fbc13a67cfebeb8b6d5de4d6e662abb699c50 100644 --- a/modules/blendfile.py +++ b/modules/blendfile.py @@ -159,7 +159,7 @@ class BlendFile: def find_block_from_offset(self, offset): # same as looking looping over all blocks, - # then checking ``block.addr_old == offset`` + # then checking `block.addr_old == offset`. assert(type(offset) is int) return self.block_from_offset.get(offset) diff --git a/utils/blender_theme_as_c.py b/utils/blender_theme_as_c.py index 383123be672ce1d292c5a02433d26bad6c9ccca3..32acb941ca5db0f4c9103d5dd62606242b78d67f 100755 --- a/utils/blender_theme_as_c.py +++ b/utils/blender_theme_as_c.py @@ -87,9 +87,9 @@ def dna_rename_defs(blend): import re re_dna_struct_rename_elem = re.compile( r'DNA_STRUCT_RENAME_ELEM+\(' - r'([a-zA-Z0-9_]+)' ',\s*' - r'([a-zA-Z0-9_]+)' ',\s*' - r'([a-zA-Z0-9_]+)' '\)', + r'([a-zA-Z0-9_]+)' r',\s*' + r'([a-zA-Z0-9_]+)' r',\s*' + r'([a-zA-Z0-9_]+)' r'\)', ) with open(dna_rename_defs_h, 'r', encoding='utf-8') as fh: data = fh.read() diff --git a/utils/cycles_timeit.py b/utils/cycles_timeit.py index ae01182e853fbd11af5c89a1984612ebf415dfdd..660cae44a8d258b6b30fdd62b057b691ec05c3dd 100755 --- a/utils/cycles_timeit.py +++ b/utils/cycles_timeit.py @@ -8,6 +8,7 @@ import subprocess import sys import time + class COLORS: HEADER = '\033[95m' OKBLUE = '\033[94m' @@ -18,11 +19,13 @@ class COLORS: BOLD = '\033[1m' UNDERLINE = '\033[4m' + VERBOSE = False ######################################### # Generic helper functions. + def logVerbose(*args): if VERBOSE: print(*args) @@ -101,6 +104,7 @@ def humanReadableTimeToSeconds(time): ######################################### # Benchmark specific helper functions. + def configureArgumentParser(): parser = argparse.ArgumentParser( description="Cycles benchmark helper script.") @@ -120,10 +124,10 @@ def benchmarkFile(blender, blendfile, stats): logHeader("Begin benchmark of file {}" . format(blendfile)) # Prepare some regex for parsing re_path_tracing = re.compile(".*Path Tracing Tile ([0-9]+)/([0-9]+)$") - re_total_render_time = re.compile(".*Total render time: ([0-9]+(\.[0-9]+)?)") + re_total_render_time = re.compile(r".*Total render time: ([0-9]+(\.[0-9]+)?)") re_render_time_no_sync = re.compile( ".*Render time \(without synchronization\): ([0-9]+(\.[0-9]+)?)") - re_pipeline_time = re.compile("Time: ([0-9:\.]+) \(Saving: ([0-9:\.]+)\)") + re_pipeline_time = re.compile(r"Time: ([0-9:\.]+) \(Saving: ([0-9:\.]+)\)") # Prepare output folder. # TODO(sergey): Use some proper output folder. output_folder = "/tmp/" diff --git a/utils/gdb_struct_repr_c99.py b/utils/gdb_struct_repr_c99.py index 76a0f695a3e137fd33a58c72f9c665b1a5fdd28f..8af197747ce03ef5862a580a3a23419161f515c2 100644 --- a/utils/gdb_struct_repr_c99.py +++ b/utils/gdb_struct_repr_c99.py @@ -12,6 +12,7 @@ Example use: (gdb) print_struct_c99 scene->toolsettings ''' + class PrintStructC99(gdb.Command): def __init__(self): super(PrintStructC99, self).__init__( diff --git a/utils_api/bpy_introspect_ui.py b/utils_api/bpy_introspect_ui.py index ecef6a1271284e1ec6af89c88822236a08dc29be..a22518d367a9adaa557c4e343d38f6867f2cdd1b 100644 --- a/utils_api/bpy_introspect_ui.py +++ b/utils_api/bpy_introspect_ui.py @@ -168,7 +168,6 @@ class AttributeBuilder_Seq(AttributeBuilder): return 0 - _attribute_builder_overrides = { "context.gpencil.layers": AttributeBuilder_Seq("context.gpencil.layers", "layers"), "context.gpencil_data.layers": AttributeBuilder_Seq("context.gpencil_data.layers", "layers"), @@ -189,6 +188,7 @@ def NewAttr(attr, attr_single): obj = AttributeBuilder(attr, attr_single) return obj + def NewAttr_Seq(attr, attr_single): obj = AttributeBuilder_Seq(attr, attr_single) return obj @@ -236,6 +236,7 @@ class Menu(BaseFakeUI): def is_extended(cls): return False + class Operator(BaseFakeUI): pass diff --git a/utils_maintenance/c_sort_blocks.py b/utils_maintenance/c_sort_blocks.py index f11f7aaf00fd1fa9e513f834456daea0957ce41e..cdb0a71814da429c7b3290710ddc58e76bb9baa2 100755 --- a/utils_maintenance/c_sort_blocks.py +++ b/utils_maintenance/c_sort_blocks.py @@ -40,7 +40,8 @@ def sort_struct_lists(fn: str, data_src: str) -> Optional[str]: re_match_struct_type = re.compile(r"struct\s+[A-Za-z_][A-Za-z_0-9]*\s+[A-Za-z_][A-Za-z_0-9]*\s*;") # typedef struct Foo Bar; - re_match_typedef_struct_type = re.compile(r"typedef\s+struct\s+[A-Za-z_][A-Za-z_0-9]*\s+[A-Za-z_][A-Za-z_0-9]*\s*;") + re_match_typedef_struct_type = re.compile( + r"typedef\s+struct\s+[A-Za-z_][A-Za-z_0-9]*\s+[A-Za-z_][A-Za-z_0-9]*\s*;") re_match_enum = re.compile(r"enum\s+[A-Za-z_][A-Za-z_0-9]*\s*;") diff --git a/utils_maintenance/c_struct_clean.py b/utils_maintenance/c_struct_clean.py index 609b8fe5777929e08bb8d65f2ae52451293c2c3f..80988888b4f079344a343df6784f06ea373ced51 100755 --- a/utils_maintenance/c_struct_clean.py +++ b/utils_maintenance/c_struct_clean.py @@ -40,6 +40,7 @@ SOURCE_EXT = ( re_words = re.compile("[A-Za-z_][A-Za-z_0-9]*") re_match_struct = re.compile(r"struct\s+([A-Za-z_][A-Za-z_0-9]*)\s*;") + def clean_structs(fn: str, data_src: str) -> Optional[str]: import re diff --git a/utils_maintenance/clang_format_paths.py b/utils_maintenance/clang_format_paths.py index 3109321e582545dd96abbce52f68f075b7865d9e..c0671d4d3a8cb552cabb2391194c89ed11f451ba 100755 --- a/utils_maintenance/clang_format_paths.py +++ b/utils_maintenance/clang_format_paths.py @@ -141,12 +141,13 @@ def clang_format(files): cpu_count = multiprocessing.cpu_count() chunk_size = min(max(len(files) // cpu_count // 2, 1), 32) for i in range(0, len(files), chunk_size): - files_chunk = files[i:i+chunk_size]; + files_chunk = files[i:i + chunk_size] pool.apply_async(clang_format_file, args=[files_chunk], callback=clang_print_output) pool.close() pool.join() + def argparse_create(): import argparse diff --git a/utils_maintenance/cmake_sort_filelists.py b/utils_maintenance/cmake_sort_filelists.py index 41821b5059b8bbb3f7e69c83afa9ac952c3a6133..bc74d6d27170db57d34f37b83dc315f63d8bee5c 100755 --- a/utils_maintenance/cmake_sort_filelists.py +++ b/utils_maintenance/cmake_sort_filelists.py @@ -34,6 +34,7 @@ SOURCE_EXT = ( ".m", ".mm", ) + def sort_cmake_file_lists(fn: str, data_src: str) -> Optional[str]: fn_dir = os.path.dirname(fn) lines = data_src.splitlines(keepends=True) diff --git a/utils_maintenance/modules/batch_edit_text.py b/utils_maintenance/modules/batch_edit_text.py index e684470f8f94db1085dc028d0307ce2e5c0ee243..cffaec8b5d06a483994deff9508be00fd303227e 100644 --- a/utils_maintenance/modules/batch_edit_text.py +++ b/utils_maintenance/modules/batch_edit_text.py @@ -48,7 +48,6 @@ def run(*, if is_text(filepath): yield filepath - if use_multiprocess: args = [ (fn, text_operation) for directory in directories