Cleanup: pep8

This commit is contained in:
Campbell Barton 2018-07-03 06:27:53 +02:00
parent dbe1b07e05
commit b66aa0b0a6
25 changed files with 184 additions and 157 deletions

@ -209,6 +209,8 @@ def modules(module_cache=addons_fake_modules, *, refresh=True):
) )
) )
return mod_list return mod_list
modules._is_first = True modules._is_first = True

@ -172,6 +172,7 @@ def ui_draw_filter_register(
class Wrapper(cls_real): class Wrapper(cls_real):
__slots__ = () __slots__ = ()
def __getattribute__(self, attr): def __getattribute__(self, attr):
if attr == "layout": if attr == "layout":
return UILayout_Fake(self_real.layout) return UILayout_Fake(self_real.layout)

@ -43,14 +43,17 @@ else:
# XXX This is a quick hack to make it work with new I18n... objects! To be reworked! # XXX This is a quick hack to make it work with new I18n... objects! To be reworked!
def main(): def main():
import argparse import argparse
parser = argparse.ArgumentParser(description= parser = argparse.ArgumentParser(
description=(
"Merge one or more .po files into the first dest one.\n" "Merge one or more .po files into the first dest one.\n"
"If a msgkey (msgctxt, msgid) is present in more than one merged po, the one in the first file " "If a msgkey (msgctxt, msgid) is present in more than one merged po, the one in the first file "
"wins, unless its marked as fuzzy and one later is not.\n" "wins, unless its marked as fuzzy and one later is not.\n"
"The fuzzy flag is removed if necessary.\n" "The fuzzy flag is removed if necessary.\n"
"All other comments are never modified.\n" "All other comments are never modified.\n"
"Commented messages in dst will always remain commented, and commented messages are never merged " "Commented messages in dst will always remain commented, and commented messages are never merged "
"from sources.") "from sources."
),
)
parser.add_argument('-s', '--stats', action="store_true", help="Show statistics info.") parser.add_argument('-s', '--stats', action="store_true", help="Show statistics info.")
parser.add_argument('-r', '--replace', action="store_true", parser.add_argument('-r', '--replace', action="store_true",
help="Replace existing messages of same \"level\" already in dest po.") help="Replace existing messages of same \"level\" already in dest po.")

@ -98,5 +98,6 @@ def main():
for value in read_blend_rend_chunk(arg): for value in read_blend_rend_chunk(arg):
print("%d %d %s" % value) print("%d %d %s" % value)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

@ -225,4 +225,5 @@ class BPyOpsSubModOp:
return ("<function bpy.ops.%s.%s at 0x%x'>" % return ("<function bpy.ops.%s.%s at 0x%x'>" %
(self._module, self._func, id(self))) (self._module, self._func, id(self)))
ops_fake_module = BPyOps() ops_fake_module = BPyOps()

@ -183,6 +183,8 @@ def clean_name(name, replace="_"):
trans = maketrans_init() trans = maketrans_init()
return name.translate(trans) return name.translate(trans)
clean_name._trans_cache = {} clean_name._trans_cache = {}
@ -223,6 +225,7 @@ def display_name(name):
name = _clean_utf8(name) name = _clean_utf8(name)
return name return name
def display_name_to_filepath(name): def display_name_to_filepath(name):
""" """
Performs the reverse of display_name using literal versions of characters Performs the reverse of display_name using literal versions of characters

@ -142,7 +142,8 @@ def orientation_helper_factory(name, axis_forward='Y', axis_up='Z'):
members['axis_forward'] = EnumProperty( members['axis_forward'] = EnumProperty(
name="Forward", name="Forward",
items=(('X', "X Forward", ""), items=(
('X', "X Forward", ""),
('Y', "Y Forward", ""), ('Y', "Y Forward", ""),
('Z', "Z Forward", ""), ('Z', "Z Forward", ""),
('-X', "-X Forward", ""), ('-X', "-X Forward", ""),
@ -160,7 +161,8 @@ def orientation_helper_factory(name, axis_forward='Y', axis_up='Z'):
members['axis_up'] = EnumProperty( members['axis_up'] = EnumProperty(
name="Up", name="Up",
items=(('X', "X Up", ""), items=(
('X', "X Up", ""),
('Y', "Y Up", ""), ('Y', "Y Up", ""),
('Z', "Z Up", ""), ('Z', "Z Up", ""),
('-X', "-X Up", ""), ('-X', "-X Up", ""),
@ -394,7 +396,8 @@ def unpack_face_list(list_of_tuples):
path_reference_mode = EnumProperty( path_reference_mode = EnumProperty(
name="Path Mode", name="Path Mode",
description="Method used to reference paths", description="Method used to reference paths",
items=(('AUTO', "Auto", "Use Relative paths with subdirectories only"), items=(
('AUTO', "Auto", "Use Relative paths with subdirectories only"),
('ABSOLUTE', "Absolute", "Always write absolute paths"), ('ABSOLUTE', "Absolute", "Always write absolute paths"),
('RELATIVE', "Relative", "Always write relative paths " ('RELATIVE', "Relative", "Always write relative paths "
"(where possible)"), "(where possible)"),

@ -153,6 +153,7 @@ def topretty_py(py_data, indent=" "):
return "\n".join(lines) return "\n".join(lines)
if __name__ == "__main__": if __name__ == "__main__":
# testing code. # testing code.

@ -19,12 +19,12 @@
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# Original copyright (see docstring): # Original copyright (see docstring):
#***************************************************************************** # ****************************************************************************
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
# #
# Distributed under the terms of the BSD License. The full license is in # Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software. # the file COPYING, distributed as part of this software.
#***************************************************************************** # ****************************************************************************
# <pep8 compliant> # <pep8 compliant>

@ -224,6 +224,7 @@ def execute(context, is_interactive):
return {'FINISHED'} return {'FINISHED'}
execute.hooks = [] execute.hooks = []

@ -40,6 +40,7 @@ def shell_run(text):
add_scrollback(output, style) add_scrollback(output, style)
PROMPT = "$ " PROMPT = "$ "
@ -64,7 +65,7 @@ def execute(context, is_interactive):
def autocomplete(context): def autocomplete(context):
#~ sc = context.space_data # sc = context.space_data
# TODO # TODO
return {'CANCELLED'} return {'CANCELLED'}

@ -179,6 +179,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
print("\nSaved:", filepath) print("\nSaved:", filepath)
return True return True
if __name__ == "__main__": if __name__ == "__main__":
import os import os
tmppath = "/tmp/test.dot" tmppath = "/tmp/test.dot"

@ -219,6 +219,7 @@ def RKS_GEN_scaling(ksi, context, ks, data):
# ------ # ------
# Property identifiers for Bendy Bones # Property identifiers for Bendy Bones
bbone_property_ids = ( bbone_property_ids = (
"bbone_curveinx", "bbone_curveinx",

@ -174,7 +174,7 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level):
sub.prop(kmi, "propvalue", text="") sub.prop(kmi, "propvalue", text="")
else: else:
# One day... # One day...
#~ sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="") # sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
sub.prop(kmi, "idname", text="") sub.prop(kmi, "idname", text="")
if map_type not in {'TEXTINPUT', 'TIMER'}: if map_type not in {'TEXTINPUT', 'TIMER'}:
@ -207,6 +207,7 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level):
draw_km(display_keymaps, kc, kmm, None, layout, level + 1) draw_km(display_keymaps, kc, kmm, None, layout, level + 1)
layout.context_pointer_set("keymap", km) layout.context_pointer_set("keymap", km)
_EVENT_TYPES = set() _EVENT_TYPES = set()
_EVENT_TYPE_MAP = {} _EVENT_TYPE_MAP = {}
_EVENT_TYPE_MAP_EXTRA = {} _EVENT_TYPE_MAP_EXTRA = {}
@ -260,8 +261,8 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
kmi_test_type = [] kmi_test_type = []
# initialize? - so if a if a kmi has a MOD assigned it wont show up. # initialize? - so if a if a kmi has a MOD assigned it wont show up.
#~ for kv in key_mod.values(): # for kv in key_mod.values():
#~ kmi_test_dict[kv] = {False} # kmi_test_dict[kv] = {False}
# altname: attr # altname: attr
for kk, kv in key_mod.items(): for kk, kv in key_mod.items():
@ -374,7 +375,7 @@ def draw_keymaps(context, layout):
row = subcol.row(align=True) row = subcol.row(align=True)
#~ row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config") # row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config")
text = bpy.path.display_name(wm.keyconfigs.active.name) text = bpy.path.display_name(wm.keyconfigs.active.name)
if not text: if not text:
text = "Blender (default)" text = "Blender (default)"
@ -382,8 +383,8 @@ def draw_keymaps(context, layout):
row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMIN') row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMIN')
row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMOUT').remove_active = True row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMOUT').remove_active = True
#~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active) # layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
#~ row.operator("wm.keyconfig_remove", text="", icon='X') # row.operator("wm.keyconfig_remove", text="", icon='X')
row.separator() row.separator()
rowsub = row.split(align=True, percentage=0.33) rowsub = row.split(align=True, percentage=0.33)
# postpone drawing into rowsub, so we can set alert! # postpone drawing into rowsub, so we can set alert!

@ -304,7 +304,8 @@ def select_next(bm, report):
uuid_cmp_test = fn(uuid_cmp) uuid_cmp_test = fn(uuid_cmp)
ele_pair_next_uuid_test = [ ele_pair_next_uuid_test = [
(ele, uuid) for (ele, uuid) in ele_pair_next_uuid (ele, uuid) for (ele, uuid) in ele_pair_next_uuid
if uuid_cmp_test == fn(uuid)] if uuid_cmp_test == fn(uuid)
]
if len(ele_pair_next_uuid_test) > 1: if len(ele_pair_next_uuid_test) > 1:
ele_pair_next_uuid = ele_pair_next_uuid_test ele_pair_next_uuid = ele_pair_next_uuid_test
elif len(ele_pair_next_uuid_test) == 1: elif len(ele_pair_next_uuid_test) == 1:

@ -527,6 +527,8 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
ksi.addProp(ks, bone, prop) ksi.addProp(ks, bone, prop)
# All properties that are likely to get animated in a character rig, only selected bones. # All properties that are likely to get animated in a character rig, only selected bones.
class BUILTIN_KSI_WholeCharacterSelected(KeyingSetInfo): class BUILTIN_KSI_WholeCharacterSelected(KeyingSetInfo):
"""Insert a keyframe for all properties that are likely to get animated in a character rig """ """Insert a keyframe for all properties that are likely to get animated in a character rig """
"""(only selected bones)""" """(only selected bones)"""
@ -557,6 +559,8 @@ class BUILTIN_KSI_WholeCharacterSelected(KeyingSetInfo):
############################### ###############################
# Delta Location # Delta Location
class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): class BUILTIN_KSI_DeltaLocation(KeyingSetInfo):
"""Insert keyframes for additional location offset""" """Insert keyframes for additional location offset"""
bl_label = "Delta Location" bl_label = "Delta Location"
@ -643,6 +647,7 @@ class BUILTIN_KSI_DeltaScale(KeyingSetInfo):
############################### ###############################
# Note that this controls order of options in 'insert keyframe' menu. # Note that this controls order of options in 'insert keyframe' menu.
# Better try to keep some logical order here beyond mere alphabetical one, also because of menu entries shortcut. # Better try to keep some logical order here beyond mere alphabetical one, also because of menu entries shortcut.
# See also T51867. # See also T51867.

@ -69,6 +69,7 @@ def group_tools_draw(self, layout, context):
layout.operator("node.group_ungroup") layout.operator("node.group_ungroup")
layout.separator() layout.separator()
# maps node tree type to group node type # maps node tree type to group node type
node_tree_group_type = { node_tree_group_type = {
'CompositorNodeTree': 'CompositorNodeGroup', 'CompositorNodeTree': 'CompositorNodeGroup',