Cleanup: autopep8

This commit is contained in:
Campbell Barton 2023-03-01 22:12:18 +11:00
parent bd0aa88909
commit e1ab9e352c
21 changed files with 45 additions and 46 deletions

@ -231,7 +231,7 @@ class FileBlockHeader:
self.SDNAIndex = 0 self.SDNAIndex = 0
self.Count = 0 self.Count = 0
self.FileOffset = handle.tell() 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)) log.debug("found blend-file-block-fileheader {0} {1}".format(self.Code, self.FileOffset))
def skip(self, handle): def skip(self, handle):

@ -20,7 +20,7 @@ from freestyle.types import IntegrationType, Operators, Stroke
Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectional_chain(ChainSilhouetteIterator()) Operators.bidirectional_chain(ChainSilhouetteIterator())
#Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) # Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2)
Operators.sort(pyZBP1D()) Operators.sort(pyZBP1D())
shaders_list = [ shaders_list = [
ConstantThicknessShader(3), ConstantThicknessShader(3),

@ -76,7 +76,7 @@ class DataPathBuilder:
break break
if type_ok: if type_ok:
try: try:
#print("base." + item_new) # print("base." + item_new)
base_new = eval("base." + item_new) base_new = eval("base." + item_new)
break # found, don't keep looking break # found, don't keep looking
except: except:

@ -92,7 +92,7 @@ def module_list(path):
folder_list = [] folder_list = []
else: else:
folder_list = [] folder_list = []
#folder_list = glob.glob(os.path.join(path,'*')) # folder_list = glob.glob(os.path.join(path,'*'))
folder_list = [ folder_list = [
p for p in folder_list p for p in folder_list
if (os.path.exists(os.path.join(path, p, '__init__.py')) or if (os.path.exists(os.path.join(path, p, '__init__.py')) or

@ -559,7 +559,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings):
# foobar(text="Foo", text_ctxt=i18n_ctxt.id_object) # foobar(text="Foo", text_ctxt=i18n_ctxt.id_object)
if type(node) == ast.Attribute: if type(node) == ast.Attribute:
if node.attr in i18n_ctxt_ids: 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 getattr(i18n_contexts, node.attr)
return i18n_contexts.default return i18n_contexts.default

@ -7,7 +7,7 @@ import os
import re import re
import struct import struct
import tempfile import tempfile
#import time # import time
from bl_i18n_utils import ( from bl_i18n_utils import (
settings, 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])) 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! for num_id, name, uid in settings.LANGUAGES[2:]: # Skip "default" and "en" languages!
best_po = find_best_isocode_matches(uid, isocodes) best_po = find_best_isocode_matches(uid, isocodes)
#print(uid, "->", best_po) # print(uid, "->", best_po)
if best_po: if best_po:
isocode = best_po[0] isocode = best_po[0]
yield (True, uid, num_id, name, isocode, isocodes[isocode]) yield (True, uid, num_id, name, isocode, isocodes[isocode])
@ -438,7 +438,7 @@ class I18nMessages:
# Avoid parsing again! # Avoid parsing again!
# Keys should be (pseudo) file-names, values are tuples (hash, I18nMessages) # Keys should be (pseudo) file-names, values are tuples (hash, I18nMessages)
# Note: only used by po parser currently! # Note: only used by po parser currently!
#_parser_cache = {} # _parser_cache = {}
def __init__(self, uid=None, kind=None, key=None, src=None, settings=settings): def __init__(self, uid=None, kind=None, key=None, src=None, settings=settings):
self.settings = settings self.settings = settings
@ -791,7 +791,7 @@ class I18nMessages:
k &= src_to_msg[src_enum] k &= src_to_msg[src_enum]
msgmap["enum_label"]["key"] = k msgmap["enum_label"]["key"] = k
rlbl = getattr(msgs, msgmap["rna_label"]["msgstr"]) 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: if rlbl:
k = ctxt_to_msg[rna_ctxt].copy() k = ctxt_to_msg[rna_ctxt].copy()
if k and rlbl in msgid_to_msg: if k and rlbl in msgid_to_msg:
@ -831,7 +831,7 @@ class I18nMessages:
# Tips (they never have a specific context). # Tips (they never have a specific context).
etip = getattr(msgs, msgmap["enum_tip"]["msgstr"]) etip = getattr(msgs, msgmap["enum_tip"]["msgstr"])
#print("enum tip: " + etip) # print("enum tip: " + etip)
if etip: if etip:
k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy() k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy()
if etip in msgid_to_msg: if etip in msgid_to_msg:
@ -845,7 +845,7 @@ class I18nMessages:
k &= src_to_msg[src_enum] k &= src_to_msg[src_enum]
msgmap["enum_tip"]["key"] = k msgmap["enum_tip"]["key"] = k
rtip = getattr(msgs, msgmap["rna_tip"]["msgstr"]) rtip = getattr(msgs, msgmap["rna_tip"]["msgstr"])
#print("rna tip: " + rtip) # print("rna tip: " + rtip)
if rtip: if rtip:
k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy() k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy()
if k and rtip in msgid_to_msg: if k and rtip in msgid_to_msg:
@ -860,7 +860,7 @@ class I18nMessages:
msgmap["rna_tip"]["key"] = k msgmap["rna_tip"]["key"] = k
# print(k) # print(k)
btip = getattr(msgs, msgmap["but_tip"]["msgstr"]) btip = getattr(msgs, msgmap["but_tip"]["msgstr"])
#print("button tip: " + btip) # print("button tip: " + btip)
if btip and btip not in {rtip, etip}: if btip and btip not in {rtip, etip}:
k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy() k = ctxt_to_msg[self.settings.DEFAULT_CONTEXT].copy()
if btip in msgid_to_msg: if btip in msgid_to_msg:
@ -1038,7 +1038,7 @@ class I18nMessages:
msgstr_lines.append(line) msgstr_lines.append(line)
else: else:
self.parsing_errors.append((line_nr, "regular string outside msgctxt, msgid or msgstr scope")) 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 no final empty line, last message is not finalized!
if reading_msgstr: if reading_msgstr:

@ -69,7 +69,7 @@ def language_menu(args, settings):
continue continue
for po_path in os.listdir(po_dir): for po_path in os.listdir(po_dir):
uid = po_to_uid.get(po_path, None) 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) po_path = os.path.join(settings.TRUNK_PO_DIR, po_path)
if uid is not None: if uid is not None:
po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=po_path, settings=settings) po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=po_path, settings=settings)

@ -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]) fill = tessellate_polygon([[v[0] for v in loop] for loop in loop_list])
# draw_loops(loop_list) # draw_loops(loop_list)
#raise Exception("done loop") # raise Exception("done loop")
# map to original indices # map to original indices
fill = [[vert_map[i] for i in f] for f in fill] fill = [[vert_map[i] for i in f] for f in fill]

@ -25,8 +25,8 @@ def compat_str(text, line_length=0):
text_ls.append(text) text_ls.append(text)
text = '\n '.join(text_ls) 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("\n", "\\n")
text = text.replace('"', '\\"') text = text.replace('"', '\\"')
return text 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["): if not rna_path.startswith("pose.bones["):
return None 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) # return obj.path_resolve(rna_path_bone)
bone_name = rna_path.split("[")[1].split("]")[0] bone_name = rna_path.split("[")[1].split("]")[0]
return obj.pose.bones[bone_name[1:-1]] return obj.pose.bones[bone_name[1:-1]]

@ -629,7 +629,7 @@ def BuildRNAInfo():
except: except:
return "" # invalid id 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 = [] structs = []
for rna_struct in bpy.doc.structs.values(): for rna_struct in bpy.doc.structs.values():
@ -703,7 +703,7 @@ def BuildRNAInfo():
# Store a list of functions, remove inherited later # Store a list of functions, remove inherited later
# NOT USED YET # 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 # fill in these later
rna_children_dict[identifier] = [] rna_children_dict[identifier] = []
@ -786,7 +786,7 @@ def BuildRNAInfo():
# if rna_struct.nested: # if rna_struct.nested:
# continue # continue
#write_struct(rna_struct, '') # write_struct(rna_struct, '')
info_struct = GetInfoStructRNA(rna_struct) info_struct = GetInfoStructRNA(rna_struct)
if rna_base: if rna_base:
info_struct.base = GetInfoStructRNA(rna_struct_dict[rna_base]) info_struct.base = GetInfoStructRNA(rna_struct_dict[rna_base])

@ -164,7 +164,7 @@ class RandomizeLocRotSize(Operator):
scale = None if not self.use_scale else self.scale scale = None if not self.use_scale else self.scale
scale_even = self.scale_even scale_even = self.scale_even
#scale_min = self.scale_min # scale_min = self.scale_min
scale_min = 0 scale_min = 0
randomize_selected(context, seed, delta, randomize_selected(context, seed, delta,

@ -165,9 +165,9 @@ class prettyface:
def set_uv(f, p1, p2, p3): def set_uv(f, p1, p2, p3):
# cos = # cos =
#v1 = cos[0]-cos[1] # v1 = cos[0]-cos[1]
#v2 = cos[1]-cos[2] # v2 = cos[1]-cos[2]
#v3 = cos[2]-cos[0] # v3 = cos[2]-cos[0]
# angles_co = get_tri_angles(*[v.co for v in f]) # 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 angles_co = get_tri_angles(*[f.id_data.vertices[v].co for v in f.vertices]) # XXX25

@ -132,7 +132,6 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel):
rows=rows, rows=rows,
) )
col = row.column(align=True) col = row.column(align=True)
col.operator("pose.group_add", icon='ADD', text="") col.operator("pose.group_add", icon='ADD', text="")
col.operator("pose.group_remove", icon='REMOVE', 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): class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
#bl_label = "Bones Motion Paths" # bl_label = "Bones Motion Paths"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
bl_context = "data" bl_context = "data"
@ -240,7 +239,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
class DATA_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel): class DATA_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
#bl_label = "Bones Motion Paths" # bl_label = "Bones Motion Paths"
bl_context = "data" bl_context = "data"
bl_parent_id = "DATA_PT_motion_paths" bl_parent_id = "DATA_PT_motion_paths"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}

@ -190,7 +190,7 @@ class MASK_PT_point:
col = layout.column() col = layout.column()
# Currently only parenting the movie-clip is allowed, # Currently only parenting the movie-clip is allowed,
# so do not over-complicate things for now by using single template_ID # 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.label(text="Parent:")
col.prop(parent, "id", text="") col.prop(parent, "id", text="")

@ -325,7 +325,7 @@ class OBJECT_PT_lineart(ObjectButtonsPanel, Panel):
class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel): class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
#bl_label = "Object Motion Paths" # bl_label = "Object Motion Paths"
bl_context = "object" bl_context = "object"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@ -344,7 +344,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel): class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
#bl_label = "Object Motion Paths" # bl_label = "Object Motion Paths"
bl_context = "object" bl_context = "object"
bl_parent_id = "OBJECT_PT_motion_paths" bl_parent_id = "OBJECT_PT_motion_paths"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}

@ -879,7 +879,7 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel):
col.prop(domain, "mesh_concave_lower", text="Lower") col.prop(domain, "mesh_concave_lower", text="Lower")
# TODO (sebbas): for now just interpolate any upres grids, ie not sampling highres grids # 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': if domain.cache_type == 'MODULAR':
col.separator() col.separator()

@ -34,8 +34,8 @@ def seek(r, txt, recurs):
newtxt = '' newtxt = ''
if recurs > MAX_RECURSIVE: if recurs > MAX_RECURSIVE:
#print ("Recursion is over max") # print ("Recursion is over max")
#print (txt) # print (txt)
return return
type_r = type(r) type_r = type(r)
@ -124,7 +124,7 @@ for d in dir(bpy.types):
''' '''
# print dir(bpy) # print dir(bpy)
#import sys # import sys
# sys.exit() # sys.exit()
print("iter over ", seek_count, "rna items") print("iter over ", seek_count, "rna items")

@ -31,7 +31,7 @@ def with_tempdir(wrapped):
@functools.wraps(wrapped) @functools.wraps(wrapped)
def decorator(*args, **kwargs): def decorator(*args, **kwargs):
dirname = tempfile.mkdtemp(prefix='blender-collada-test') dirname = tempfile.mkdtemp(prefix='blender-collada-test')
#print("Using tempdir %s" % dirname) # print("Using tempdir %s" % dirname)
try: try:
retval = wrapped(*args, pathlib.Path(dirname), **kwargs) retval = wrapped(*args, pathlib.Path(dirname), **kwargs)
except: except:

@ -31,7 +31,7 @@ def with_tempdir(wrapped):
@functools.wraps(wrapped) @functools.wraps(wrapped)
def decorator(*args, **kwargs): def decorator(*args, **kwargs):
dirname = tempfile.mkdtemp(prefix='blender-collada-test') dirname = tempfile.mkdtemp(prefix='blender-collada-test')
#print("Using tempdir %s" % dirname) # print("Using tempdir %s" % dirname)
try: try:
retval = wrapped(*args, pathlib.Path(dirname), **kwargs) retval = wrapped(*args, pathlib.Path(dirname), **kwargs)
except: except:

@ -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) main_cat = sub_cats_to_main_cats.get(main_cat, None)
else: else:
sub_cat = None sub_cat = None
#~ print("hl MAINCAT:", hl, main_cat, " | ", sub_cat) # print("hl MAINCAT:", hl, main_cat, " | ", sub_cat)
break break
header.append(hl) header.append(hl)
@ -372,7 +372,7 @@ def release_log_init(path, source_dir, blender_rev, start_sha1, end_sha1, rstate
sub_cat = None sub_cat = None
else: else:
main_cat = None main_cat = None
#~ print("l SUBCAT:", l, main_cat, " | ", sub_cat) # print("l SUBCAT:", l, main_cat, " | ", sub_cat)
elif l.startswith("=="): elif l.startswith("=="):
main_cat = l.strip(" =") main_cat = l.strip(" =")
if main_cat not in main_cats: 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) main_cat = sub_cats_to_main_cats.get(main_cat, None)
else: else:
sub_cat = None sub_cat = None
#~ print("l MAINCAT:", l, main_cat, " | ", sub_cat) # print("l MAINCAT:", l, main_cat, " | ", sub_cat)
elif "Fix " in l: elif "Fix " in l:
if "Fix {{BugReport|" in l: if "Fix {{BugReport|" in l:
main_cat_data, _ = release_log.setdefault(main_cat, ({}, {})) main_cat_data, _ = release_log.setdefault(main_cat, ({}, {}))
main_cat_data.setdefault(sub_cat, []).append(l) main_cat_data.setdefault(sub_cat, []).append(l)
count[0] += 1 count[0] += 1
#~ print("l REPORTED:", l) # print("l REPORTED:", l)
else: else:
_, main_cat_data_unreported = release_log.setdefault(main_cat, ({}, {})) _, main_cat_data_unreported = release_log.setdefault(main_cat, ({}, {}))
main_cat_data_unreported.setdefault(sub_cat, []).append(l) main_cat_data_unreported.setdefault(sub_cat, []).append(l)
count[1] += 1 count[1] += 1
#~ print("l UNREPORTED:", l) # print("l UNREPORTED:", l)
l_rstate = l.strip("* ") l_rstate = l.strip("* ")
if l_rstate.startswith("["): if l_rstate.startswith("["):
end = l_rstate.find("]") end = l_rstate.find("]")

@ -56,8 +56,8 @@ class App:
self.doit = Button(frame2, text="Print", command=self.doit) self.doit = Button(frame2, text="Print", command=self.doit)
self.doit.grid(row=0, column=1, pady=20) self.doit.grid(row=0, column=1, pady=20)
#self.doitlab = Label(frame2, text="(Output to stdout)"); # self.doitlab = Label(frame2, text="(Output to stdout)");
#self.doitlab.grid(row=1, column=1); # self.doitlab.grid(row=1, column=1);
self.parse = Button(frame2, text="Parse", command=self.parsetext) self.parse = Button(frame2, text="Parse", command=self.parsetext)
self.parse.grid(row=0, column=2, pady=20) 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) self.prev.config(width=self.size + 1, height=self.size + 1)
for n in range(self.states): for n in range(self.states):
self.updateprev(n) 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): def scrnclick1(self, event):
self.scrnclick(event, 1) self.scrnclick(event, 1)
@ -264,7 +264,7 @@ class App:
m |= 1 m |= 1
if (self.state[(i * 8) + (7 - j)] == 1): if (self.state[(i * 8) + (7 - j)] == 1):
b |= 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) mask.append(m)
bitmap.append(b) bitmap.append(b)