mirror of
https://github.com/blender/blender-dev-tools.git
synced 2025-08-15 23:08:52 +00:00
Cleanup: style
This commit is contained in:
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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/"
|
||||
|
@ -12,6 +12,7 @@ Example use:
|
||||
(gdb) print_struct_c99 scene->toolsettings
|
||||
'''
|
||||
|
||||
|
||||
class PrintStructC99(gdb.Command):
|
||||
def __init__(self):
|
||||
super(PrintStructC99, self).__init__(
|
||||
|
@ -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
|
||||
|
||||
|
@ -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*;")
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -48,7 +48,6 @@ def run(*,
|
||||
if is_text(filepath):
|
||||
yield filepath
|
||||
|
||||
|
||||
if use_multiprocess:
|
||||
args = [
|
||||
(fn, text_operation) for directory in directories
|
||||
|
Reference in New Issue
Block a user