From e1ab9e352c2da76d1ae73422bee8de4fa0c7c18f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Mar 2023 22:12:18 +1100 Subject: [PATCH] Cleanup: autopep8 --- doc/blender_file_format/BlendFileReader.py | 2 +- scripts/freestyle/styles/uniformpruning_zsort.py | 2 +- scripts/modules/animsys_refactor.py | 2 +- .../autocomplete/complete_import.py | 2 +- .../modules/bl_i18n_utils/bl_extract_messages.py | 2 +- scripts/modules/bl_i18n_utils/utils.py | 16 ++++++++-------- scripts/modules/bl_i18n_utils/utils_cli.py | 2 +- scripts/modules/bpy_extras/mesh_utils.py | 2 +- scripts/modules/graphviz_export.py | 6 +++--- scripts/modules/rna_info.py | 6 +++--- .../bl_operators/object_randomize_transform.py | 2 +- scripts/startup/bl_operators/uvcalc_lightmap.py | 6 +++--- .../startup/bl_ui/properties_data_armature.py | 5 ++--- scripts/startup/bl_ui/properties_mask_common.py | 2 +- scripts/startup/bl_ui/properties_object.py | 4 ++-- .../startup/bl_ui/properties_physics_fluid.py | 2 +- source/blender/python/rna_dump.py | 6 +++--- .../collada/animation/test_animation_simple.py | 2 +- tests/python/collada/mesh/test_mesh_simple.py | 2 +- tools/utils/git_log_review_commits_advanced.py | 10 +++++----- tools/utils/make_cursor_gui.py | 8 ++++---- 21 files changed, 45 insertions(+), 46 deletions(-) diff --git a/doc/blender_file_format/BlendFileReader.py b/doc/blender_file_format/BlendFileReader.py index 54fab630452..39f68aebb2c 100644 --- a/doc/blender_file_format/BlendFileReader.py +++ b/doc/blender_file_format/BlendFileReader.py @@ -231,7 +231,7 @@ class FileBlockHeader: self.SDNAIndex = 0 self.Count = 0 self.FileOffset = handle.tell() - #self.Code += ' ' * (4 - len(self.Code)) + # self.Code += ' ' * (4 - len(self.Code)) log.debug("found blend-file-block-fileheader {0} {1}".format(self.Code, self.FileOffset)) def skip(self, handle): diff --git a/scripts/freestyle/styles/uniformpruning_zsort.py b/scripts/freestyle/styles/uniformpruning_zsort.py index ec9c28b8801..ff084d22325 100644 --- a/scripts/freestyle/styles/uniformpruning_zsort.py +++ b/scripts/freestyle/styles/uniformpruning_zsort.py @@ -20,7 +20,7 @@ from freestyle.types import IntegrationType, Operators, Stroke Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator()) -#Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) +# Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) Operators.sort(pyZBP1D()) shaders_list = [ ConstantThicknessShader(3), diff --git a/scripts/modules/animsys_refactor.py b/scripts/modules/animsys_refactor.py index 0ab486efa11..5765a3b0496 100644 --- a/scripts/modules/animsys_refactor.py +++ b/scripts/modules/animsys_refactor.py @@ -76,7 +76,7 @@ class DataPathBuilder: break if type_ok: try: - #print("base." + item_new) + # print("base." + item_new) base_new = eval("base." + item_new) break # found, don't keep looking except: diff --git a/scripts/modules/bl_console_utils/autocomplete/complete_import.py b/scripts/modules/bl_console_utils/autocomplete/complete_import.py index c506e674cd5..ee232263cc4 100644 --- a/scripts/modules/bl_console_utils/autocomplete/complete_import.py +++ b/scripts/modules/bl_console_utils/autocomplete/complete_import.py @@ -92,7 +92,7 @@ def module_list(path): folder_list = [] else: folder_list = [] - #folder_list = glob.glob(os.path.join(path,'*')) + # folder_list = glob.glob(os.path.join(path,'*')) folder_list = [ p for p in folder_list if (os.path.exists(os.path.join(path, p, '__init__.py')) or diff --git a/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/scripts/modules/bl_i18n_utils/bl_extract_messages.py index 4915ee3f47d..946cc07951e 100644 --- a/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -559,7 +559,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings): # foobar(text="Foo", text_ctxt=i18n_ctxt.id_object) if type(node) == ast.Attribute: if node.attr in i18n_ctxt_ids: - #print(node, node.attr, getattr(i18n_contexts, node.attr)) + # print(node, node.attr, getattr(i18n_contexts, node.attr)) return getattr(i18n_contexts, node.attr) return i18n_contexts.default diff --git a/scripts/modules/bl_i18n_utils/utils.py b/scripts/modules/bl_i18n_utils/utils.py index 784b206fb84..0ad5b98fd38 100644 --- a/scripts/modules/bl_i18n_utils/utils.py +++ b/scripts/modules/bl_i18n_utils/utils.py @@ -7,7 +7,7 @@ import os import re import struct import tempfile -#import time +# import time from bl_i18n_utils import ( settings, @@ -173,7 +173,7 @@ def list_po_dir(root_path, settings): isocodes = dict(e for e in isocodes if os.path.isfile(e[1])) for num_id, name, uid in settings.LANGUAGES[2:]: # Skip "default" and "en" languages! best_po = find_best_isocode_matches(uid, isocodes) - #print(uid, "->", best_po) + # print(uid, "->", best_po) if best_po: isocode = best_po[0] yield (True, uid, num_id, name, isocode, isocodes[isocode]) @@ -438,7 +438,7 @@ class I18nMessages: # Avoid parsing again! # Keys should be (pseudo) file-names, values are tuples (hash, I18nMessages) # Note: only used by po parser currently! - #_parser_cache = {} + # _parser_cache = {} def __init__(self, uid=None, kind=None, key=None, src=None, settings=settings): self.settings = settings @@ -791,7 +791,7 @@ class I18nMessages: k &= src_to_msg[src_enum] msgmap["enum_label"]["key"] = k rlbl = getattr(msgs, msgmap["rna_label"]["msgstr"]) - #print("rna label: " + rlbl, rlbl in msgid_to_msg, rlbl in msgstr_to_msg) + # print("rna label: " + rlbl, rlbl in msgid_to_msg, rlbl in msgstr_to_msg) if rlbl: k = ctxt_to_msg[rna_ctxt].copy() if k and rlbl in msgid_to_msg: @@ -831,7 +831,7 @@ class I18nMessages: # Tips (they never have a specific context). etip = getattr(msgs, msgmap["enum_tip"]["msgstr"]) - #print("enum tip: " + etip) + # print("enum tip: " + etip) if etip: k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy() if etip in msgid_to_msg: @@ -845,7 +845,7 @@ class I18nMessages: k &= src_to_msg[src_enum] msgmap["enum_tip"]["key"] = k rtip = getattr(msgs, msgmap["rna_tip"]["msgstr"]) - #print("rna tip: " + rtip) + # print("rna tip: " + rtip) if rtip: k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy() if k and rtip in msgid_to_msg: @@ -860,7 +860,7 @@ class I18nMessages: msgmap["rna_tip"]["key"] = k # print(k) btip = getattr(msgs, msgmap["but_tip"]["msgstr"]) - #print("button tip: " + btip) + # print("button tip: " + btip) if btip and btip not in {rtip, etip}: k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy() if btip in msgid_to_msg: @@ -1038,7 +1038,7 @@ class I18nMessages: msgstr_lines.append(line) else: self.parsing_errors.append((line_nr, "regular string outside msgctxt, msgid or msgstr scope")) - #self.parsing_errors += (str(comment_lines), str(msgctxt_lines), str(msgid_lines), str(msgstr_lines)) + # self.parsing_errors += (str(comment_lines), str(msgctxt_lines), str(msgid_lines), str(msgstr_lines)) # If no final empty line, last message is not finalized! if reading_msgstr: diff --git a/scripts/modules/bl_i18n_utils/utils_cli.py b/scripts/modules/bl_i18n_utils/utils_cli.py index 4b00816d132..253966205d3 100644 --- a/scripts/modules/bl_i18n_utils/utils_cli.py +++ b/scripts/modules/bl_i18n_utils/utils_cli.py @@ -69,7 +69,7 @@ def language_menu(args, settings): continue for po_path in os.listdir(po_dir): uid = po_to_uid.get(po_path, None) - #print("Checking %s, found uid %s" % (po_path, uid)) + # print("Checking %s, found uid %s" % (po_path, uid)) po_path = os.path.join(settings.TRUNK_PO_DIR, po_path) if uid is not None: po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=po_path, settings=settings) diff --git a/scripts/modules/bpy_extras/mesh_utils.py b/scripts/modules/bpy_extras/mesh_utils.py index d593ce6a1e4..dd550049b51 100644 --- a/scripts/modules/bpy_extras/mesh_utils.py +++ b/scripts/modules/bpy_extras/mesh_utils.py @@ -392,7 +392,7 @@ def ngon_tessellate(from_data, indices, fix_loops=True, debug_print=True): fill = tessellate_polygon([[v[0] for v in loop] for loop in loop_list]) # draw_loops(loop_list) - #raise Exception("done loop") + # raise Exception("done loop") # map to original indices fill = [[vert_map[i] for i in f] for f in fill] diff --git a/scripts/modules/graphviz_export.py b/scripts/modules/graphviz_export.py index b6e73590386..007f2e018a7 100644 --- a/scripts/modules/graphviz_export.py +++ b/scripts/modules/graphviz_export.py @@ -25,8 +25,8 @@ def compat_str(text, line_length=0): text_ls.append(text) text = '\n '.join(text_ls) - #text = text.replace('.', '.\n') - #text = text.replace(']', ']\n') + # text = text.replace('.', '.\n') + # text = text.replace(']', ']\n') text = text.replace("\n", "\\n") text = text.replace('"', '\\"') return text @@ -135,7 +135,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr if not rna_path.startswith("pose.bones["): return None - #rna_path_bone = rna_path[:rna_path.index("]") + 1] + # rna_path_bone = rna_path[:rna_path.index("]") + 1] # return obj.path_resolve(rna_path_bone) bone_name = rna_path.split("[")[1].split("]")[0] return obj.pose.bones[bone_name[1:-1]] diff --git a/scripts/modules/rna_info.py b/scripts/modules/rna_info.py index b56bfdefb35..aa3e9945f9e 100644 --- a/scripts/modules/rna_info.py +++ b/scripts/modules/rna_info.py @@ -629,7 +629,7 @@ def BuildRNAInfo(): except: return "" # invalid id - #structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] + # structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] ''' structs = [] for rna_struct in bpy.doc.structs.values(): @@ -703,7 +703,7 @@ def BuildRNAInfo(): # Store a list of functions, remove inherited later # NOT USED YET - ## rna_functions_dict[identifier] = get_direct_functions(rna_struct) + # rna_functions_dict[identifier] = get_direct_functions(rna_struct) # fill in these later rna_children_dict[identifier] = [] @@ -786,7 +786,7 @@ def BuildRNAInfo(): # if rna_struct.nested: # continue - #write_struct(rna_struct, '') + # write_struct(rna_struct, '') info_struct = GetInfoStructRNA(rna_struct) if rna_base: info_struct.base = GetInfoStructRNA(rna_struct_dict[rna_base]) diff --git a/scripts/startup/bl_operators/object_randomize_transform.py b/scripts/startup/bl_operators/object_randomize_transform.py index 0b8b2868349..93915568e39 100644 --- a/scripts/startup/bl_operators/object_randomize_transform.py +++ b/scripts/startup/bl_operators/object_randomize_transform.py @@ -164,7 +164,7 @@ class RandomizeLocRotSize(Operator): scale = None if not self.use_scale else self.scale scale_even = self.scale_even - #scale_min = self.scale_min + # scale_min = self.scale_min scale_min = 0 randomize_selected(context, seed, delta, diff --git a/scripts/startup/bl_operators/uvcalc_lightmap.py b/scripts/startup/bl_operators/uvcalc_lightmap.py index 6d1d0f1be99..e5107b83a7b 100644 --- a/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -165,9 +165,9 @@ class prettyface: def set_uv(f, p1, p2, p3): # cos = - #v1 = cos[0]-cos[1] - #v2 = cos[1]-cos[2] - #v3 = cos[2]-cos[0] + # v1 = cos[0]-cos[1] + # v2 = cos[1]-cos[2] + # v3 = cos[2]-cos[0] # angles_co = get_tri_angles(*[v.co for v in f]) angles_co = get_tri_angles(*[f.id_data.vertices[v].co for v in f.vertices]) # XXX25 diff --git a/scripts/startup/bl_ui/properties_data_armature.py b/scripts/startup/bl_ui/properties_data_armature.py index 4b90f389cca..9520d8f28b3 100644 --- a/scripts/startup/bl_ui/properties_data_armature.py +++ b/scripts/startup/bl_ui/properties_data_armature.py @@ -132,7 +132,6 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel): rows=rows, ) - col = row.column(align=True) col.operator("pose.group_add", icon='ADD', text="") col.operator("pose.group_remove", icon='REMOVE', text="") @@ -218,7 +217,7 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel): class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel): - #bl_label = "Bones Motion Paths" + # bl_label = "Bones Motion Paths" bl_options = {'DEFAULT_CLOSED'} bl_context = "data" @@ -240,7 +239,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel): class DATA_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel): - #bl_label = "Bones Motion Paths" + # bl_label = "Bones Motion Paths" bl_context = "data" bl_parent_id = "DATA_PT_motion_paths" bl_options = {'DEFAULT_CLOSED'} diff --git a/scripts/startup/bl_ui/properties_mask_common.py b/scripts/startup/bl_ui/properties_mask_common.py index 9dc1ef3cc4b..1a08dcedd73 100644 --- a/scripts/startup/bl_ui/properties_mask_common.py +++ b/scripts/startup/bl_ui/properties_mask_common.py @@ -190,7 +190,7 @@ class MASK_PT_point: col = layout.column() # Currently only parenting the movie-clip is allowed, # so do not over-complicate things for now by using single template_ID - #col.template_any_ID(parent, "id", "id_type", text="") + # col.template_any_ID(parent, "id", "id_type", text="") col.label(text="Parent:") col.prop(parent, "id", text="") diff --git a/scripts/startup/bl_ui/properties_object.py b/scripts/startup/bl_ui/properties_object.py index 836ac2dcb75..3977782050f 100644 --- a/scripts/startup/bl_ui/properties_object.py +++ b/scripts/startup/bl_ui/properties_object.py @@ -325,7 +325,7 @@ class OBJECT_PT_lineart(ObjectButtonsPanel, Panel): class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel): - #bl_label = "Object Motion Paths" + # bl_label = "Object Motion Paths" bl_context = "object" bl_options = {'DEFAULT_CLOSED'} @@ -344,7 +344,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel): class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel): - #bl_label = "Object Motion Paths" + # bl_label = "Object Motion Paths" bl_context = "object" bl_parent_id = "OBJECT_PT_motion_paths" bl_options = {'DEFAULT_CLOSED'} diff --git a/scripts/startup/bl_ui/properties_physics_fluid.py b/scripts/startup/bl_ui/properties_physics_fluid.py index cbf385adbc8..8aae3a8d855 100644 --- a/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/scripts/startup/bl_ui/properties_physics_fluid.py @@ -879,7 +879,7 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel): col.prop(domain, "mesh_concave_lower", text="Lower") # TODO (sebbas): for now just interpolate any upres grids, ie not sampling highres grids - #col.prop(domain, "highres_sampling", text="Flow Sampling:") + # col.prop(domain, "highres_sampling", text="Flow Sampling:") if domain.cache_type == 'MODULAR': col.separator() diff --git a/source/blender/python/rna_dump.py b/source/blender/python/rna_dump.py index b4e23547c62..48c0819eb9b 100644 --- a/source/blender/python/rna_dump.py +++ b/source/blender/python/rna_dump.py @@ -34,8 +34,8 @@ def seek(r, txt, recurs): newtxt = '' if recurs > MAX_RECURSIVE: - #print ("Recursion is over max") - #print (txt) + # print ("Recursion is over max") + # print (txt) return type_r = type(r) @@ -124,7 +124,7 @@ for d in dir(bpy.types): ''' # print dir(bpy) -#import sys +# import sys # sys.exit() print("iter over ", seek_count, "rna items") diff --git a/tests/python/collada/animation/test_animation_simple.py b/tests/python/collada/animation/test_animation_simple.py index 038ad522109..b724b0619e9 100644 --- a/tests/python/collada/animation/test_animation_simple.py +++ b/tests/python/collada/animation/test_animation_simple.py @@ -31,7 +31,7 @@ def with_tempdir(wrapped): @functools.wraps(wrapped) def decorator(*args, **kwargs): dirname = tempfile.mkdtemp(prefix='blender-collada-test') - #print("Using tempdir %s" % dirname) + # print("Using tempdir %s" % dirname) try: retval = wrapped(*args, pathlib.Path(dirname), **kwargs) except: diff --git a/tests/python/collada/mesh/test_mesh_simple.py b/tests/python/collada/mesh/test_mesh_simple.py index badd6c53d06..849bb3bcec2 100644 --- a/tests/python/collada/mesh/test_mesh_simple.py +++ b/tests/python/collada/mesh/test_mesh_simple.py @@ -31,7 +31,7 @@ def with_tempdir(wrapped): @functools.wraps(wrapped) def decorator(*args, **kwargs): dirname = tempfile.mkdtemp(prefix='blender-collada-test') - #print("Using tempdir %s" % dirname) + # print("Using tempdir %s" % dirname) try: retval = wrapped(*args, pathlib.Path(dirname), **kwargs) except: diff --git a/tools/utils/git_log_review_commits_advanced.py b/tools/utils/git_log_review_commits_advanced.py index 55a7bd1f0ad..856f39b6719 100755 --- a/tools/utils/git_log_review_commits_advanced.py +++ b/tools/utils/git_log_review_commits_advanced.py @@ -347,7 +347,7 @@ def release_log_init(path, source_dir, blender_rev, start_sha1, end_sha1, rstate main_cat = sub_cats_to_main_cats.get(main_cat, None) else: sub_cat = None - #~ print("hl MAINCAT:", hl, main_cat, " | ", sub_cat) + # print("hl MAINCAT:", hl, main_cat, " | ", sub_cat) break header.append(hl) @@ -372,7 +372,7 @@ def release_log_init(path, source_dir, blender_rev, start_sha1, end_sha1, rstate sub_cat = None else: main_cat = None - #~ print("l SUBCAT:", l, main_cat, " | ", sub_cat) + # print("l SUBCAT:", l, main_cat, " | ", sub_cat) elif l.startswith("=="): main_cat = l.strip(" =") if main_cat not in main_cats: @@ -380,18 +380,18 @@ def release_log_init(path, source_dir, blender_rev, start_sha1, end_sha1, rstate main_cat = sub_cats_to_main_cats.get(main_cat, None) else: sub_cat = None - #~ print("l MAINCAT:", l, main_cat, " | ", sub_cat) + # print("l MAINCAT:", l, main_cat, " | ", sub_cat) elif "Fix " in l: if "Fix {{BugReport|" in l: main_cat_data, _ = release_log.setdefault(main_cat, ({}, {})) main_cat_data.setdefault(sub_cat, []).append(l) count[0] += 1 - #~ print("l REPORTED:", l) + # print("l REPORTED:", l) else: _, main_cat_data_unreported = release_log.setdefault(main_cat, ({}, {})) main_cat_data_unreported.setdefault(sub_cat, []).append(l) count[1] += 1 - #~ print("l UNREPORTED:", l) + # print("l UNREPORTED:", l) l_rstate = l.strip("* ") if l_rstate.startswith("["): end = l_rstate.find("]") diff --git a/tools/utils/make_cursor_gui.py b/tools/utils/make_cursor_gui.py index f206ae5f3e5..88d8b80e212 100755 --- a/tools/utils/make_cursor_gui.py +++ b/tools/utils/make_cursor_gui.py @@ -56,8 +56,8 @@ class App: self.doit = Button(frame2, text="Print", command=self.doit) self.doit.grid(row=0, column=1, pady=20) - #self.doitlab = Label(frame2, text="(Output to stdout)"); - #self.doitlab.grid(row=1, column=1); + # self.doitlab = Label(frame2, text="(Output to stdout)"); + # self.doitlab.grid(row=1, column=1); self.parse = Button(frame2, text="Parse", command=self.parsetext) self.parse.grid(row=0, column=2, pady=20) @@ -117,7 +117,7 @@ class App: self.prev.config(width=self.size + 1, height=self.size + 1) for n in range(self.states): self.updateprev(n) - #self.prev.grid(row=0, column=4, padx=self.gridsz, pady=self.gridsz) + # self.prev.grid(row=0, column=4, padx=self.gridsz, pady=self.gridsz) def scrnclick1(self, event): self.scrnclick(event, 1) @@ -264,7 +264,7 @@ class App: m |= 1 if (self.state[(i * 8) + (7 - j)] == 1): b |= 1 - #print((i * 8) + (7 - j), self.state[(i * 8) + (7 - j)], m) + # print((i * 8) + (7 - j), self.state[(i * 8) + (7 - j)], m) mask.append(m) bitmap.append(b)