Skip to content
Snippets Groups Projects
Commit 1e658ca9 authored by Campbell Barton's avatar Campbell Barton
Browse files

Cleanup: style

parent c540dcee
No related branches found
No related tags found
No related merge requests found
...@@ -159,7 +159,7 @@ class BlendFile: ...@@ -159,7 +159,7 @@ class BlendFile:
def find_block_from_offset(self, offset): def find_block_from_offset(self, offset):
# same as looking looping over all blocks, # same as looking looping over all blocks,
# then checking ``block.addr_old == offset`` # then checking `block.addr_old == offset`.
assert(type(offset) is int) assert(type(offset) is int)
return self.block_from_offset.get(offset) return self.block_from_offset.get(offset)
......
...@@ -87,9 +87,9 @@ def dna_rename_defs(blend): ...@@ -87,9 +87,9 @@ def dna_rename_defs(blend):
import re import re
re_dna_struct_rename_elem = re.compile( re_dna_struct_rename_elem = re.compile(
r'DNA_STRUCT_RENAME_ELEM+\(' r'DNA_STRUCT_RENAME_ELEM+\('
r'([a-zA-Z0-9_]+)' ',\s*' r'([a-zA-Z0-9_]+)' r',\s*'
r'([a-zA-Z0-9_]+)' ',\s*' r'([a-zA-Z0-9_]+)' r',\s*'
r'([a-zA-Z0-9_]+)' '\)', r'([a-zA-Z0-9_]+)' r'\)',
) )
with open(dna_rename_defs_h, 'r', encoding='utf-8') as fh: with open(dna_rename_defs_h, 'r', encoding='utf-8') as fh:
data = fh.read() data = fh.read()
......
...@@ -8,6 +8,7 @@ import subprocess ...@@ -8,6 +8,7 @@ import subprocess
import sys import sys
import time import time
class COLORS: class COLORS:
HEADER = '\033[95m' HEADER = '\033[95m'
OKBLUE = '\033[94m' OKBLUE = '\033[94m'
...@@ -18,11 +19,13 @@ class COLORS: ...@@ -18,11 +19,13 @@ class COLORS:
BOLD = '\033[1m' BOLD = '\033[1m'
UNDERLINE = '\033[4m' UNDERLINE = '\033[4m'
VERBOSE = False VERBOSE = False
######################################### #########################################
# Generic helper functions. # Generic helper functions.
def logVerbose(*args): def logVerbose(*args):
if VERBOSE: if VERBOSE:
print(*args) print(*args)
...@@ -101,6 +104,7 @@ def humanReadableTimeToSeconds(time): ...@@ -101,6 +104,7 @@ def humanReadableTimeToSeconds(time):
######################################### #########################################
# Benchmark specific helper functions. # Benchmark specific helper functions.
def configureArgumentParser(): def configureArgumentParser():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Cycles benchmark helper script.") description="Cycles benchmark helper script.")
...@@ -120,10 +124,10 @@ def benchmarkFile(blender, blendfile, stats): ...@@ -120,10 +124,10 @@ def benchmarkFile(blender, blendfile, stats):
logHeader("Begin benchmark of file {}" . format(blendfile)) logHeader("Begin benchmark of file {}" . format(blendfile))
# Prepare some regex for parsing # Prepare some regex for parsing
re_path_tracing = re.compile(".*Path Tracing Tile ([0-9]+)/([0-9]+)$") 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( re_render_time_no_sync = re.compile(
".*Render time \(without synchronization\): ([0-9]+(\.[0-9]+)?)") ".*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. # Prepare output folder.
# TODO(sergey): Use some proper output folder. # TODO(sergey): Use some proper output folder.
output_folder = "/tmp/" output_folder = "/tmp/"
......
...@@ -12,6 +12,7 @@ Example use: ...@@ -12,6 +12,7 @@ Example use:
(gdb) print_struct_c99 scene->toolsettings (gdb) print_struct_c99 scene->toolsettings
''' '''
class PrintStructC99(gdb.Command): class PrintStructC99(gdb.Command):
def __init__(self): def __init__(self):
super(PrintStructC99, self).__init__( super(PrintStructC99, self).__init__(
......
...@@ -168,7 +168,6 @@ class AttributeBuilder_Seq(AttributeBuilder): ...@@ -168,7 +168,6 @@ class AttributeBuilder_Seq(AttributeBuilder):
return 0 return 0
_attribute_builder_overrides = { _attribute_builder_overrides = {
"context.gpencil.layers": AttributeBuilder_Seq("context.gpencil.layers", "layers"), "context.gpencil.layers": AttributeBuilder_Seq("context.gpencil.layers", "layers"),
"context.gpencil_data.layers": AttributeBuilder_Seq("context.gpencil_data.layers", "layers"), "context.gpencil_data.layers": AttributeBuilder_Seq("context.gpencil_data.layers", "layers"),
...@@ -189,6 +188,7 @@ def NewAttr(attr, attr_single): ...@@ -189,6 +188,7 @@ def NewAttr(attr, attr_single):
obj = AttributeBuilder(attr, attr_single) obj = AttributeBuilder(attr, attr_single)
return obj return obj
def NewAttr_Seq(attr, attr_single): def NewAttr_Seq(attr, attr_single):
obj = AttributeBuilder_Seq(attr, attr_single) obj = AttributeBuilder_Seq(attr, attr_single)
return obj return obj
...@@ -236,6 +236,7 @@ class Menu(BaseFakeUI): ...@@ -236,6 +236,7 @@ class Menu(BaseFakeUI):
def is_extended(cls): def is_extended(cls):
return False return False
class Operator(BaseFakeUI): class Operator(BaseFakeUI):
pass pass
......
...@@ -40,7 +40,8 @@ def sort_struct_lists(fn: str, data_src: str) -> Optional[str]: ...@@ -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*;") 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; # 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*;") re_match_enum = re.compile(r"enum\s+[A-Za-z_][A-Za-z_0-9]*\s*;")
......
...@@ -40,6 +40,7 @@ SOURCE_EXT = ( ...@@ -40,6 +40,7 @@ SOURCE_EXT = (
re_words = re.compile("[A-Za-z_][A-Za-z_0-9]*") 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*;") 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]: def clean_structs(fn: str, data_src: str) -> Optional[str]:
import re import re
......
...@@ -141,12 +141,13 @@ def clang_format(files): ...@@ -141,12 +141,13 @@ def clang_format(files):
cpu_count = multiprocessing.cpu_count() cpu_count = multiprocessing.cpu_count()
chunk_size = min(max(len(files) // cpu_count // 2, 1), 32) chunk_size = min(max(len(files) // cpu_count // 2, 1), 32)
for i in range(0, len(files), chunk_size): 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.apply_async(clang_format_file, args=[files_chunk], callback=clang_print_output)
pool.close() pool.close()
pool.join() pool.join()
def argparse_create(): def argparse_create():
import argparse import argparse
......
...@@ -34,6 +34,7 @@ SOURCE_EXT = ( ...@@ -34,6 +34,7 @@ SOURCE_EXT = (
".m", ".mm", ".m", ".mm",
) )
def sort_cmake_file_lists(fn: str, data_src: str) -> Optional[str]: def sort_cmake_file_lists(fn: str, data_src: str) -> Optional[str]:
fn_dir = os.path.dirname(fn) fn_dir = os.path.dirname(fn)
lines = data_src.splitlines(keepends=True) lines = data_src.splitlines(keepends=True)
......
...@@ -48,7 +48,6 @@ def run(*, ...@@ -48,7 +48,6 @@ def run(*,
if is_text(filepath): if is_text(filepath):
yield filepath yield filepath
if use_multiprocess: if use_multiprocess:
args = [ args = [
(fn, text_operation) for directory in directories (fn, text_operation) for directory in directories
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment