replace import *'s with named imports (using * is convenient for some scripts but considered bad practice by python devs)
This commit is contained in:
parent
52f92b4cb1
commit
fc0c016940
|
@ -26,7 +26,7 @@ to work correctly.
|
|||
"""
|
||||
|
||||
import bpy
|
||||
from keyingsets_utils import *
|
||||
import keyingsets_utils
|
||||
|
||||
###############################
|
||||
# Built-In KeyingSets
|
||||
|
@ -37,13 +37,13 @@ class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo):
|
|||
bl_label = "Location"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_location
|
||||
generate = keyingsets_utils.RKS_GEN_location
|
||||
|
||||
|
||||
# Rotation
|
||||
|
@ -51,13 +51,13 @@ class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo):
|
|||
bl_label = "Rotation"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_rotation
|
||||
generate = keyingsets_utils.RKS_GEN_rotation
|
||||
|
||||
|
||||
# Scale
|
||||
|
@ -65,13 +65,13 @@ class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo):
|
|||
bl_label = "Scaling"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_scaling
|
||||
generate = keyingsets_utils.RKS_GEN_scaling
|
||||
|
||||
# ------------
|
||||
|
||||
|
@ -81,17 +81,17 @@ class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo):
|
|||
bl_label = "LocRot"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator
|
||||
def generate(self, context, ks, data):
|
||||
# location
|
||||
RKS_GEN_location(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_location(self, context, ks, data)
|
||||
# rotation
|
||||
RKS_GEN_rotation(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
|
||||
|
||||
|
||||
# LocScale
|
||||
|
@ -99,17 +99,17 @@ class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo):
|
|||
bl_label = "LocScale"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator
|
||||
def generate(self, context, ks, data):
|
||||
# location
|
||||
RKS_GEN_location(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_location(self, context, ks, data)
|
||||
# scale
|
||||
RKS_GEN_scaling(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
|
||||
|
||||
|
||||
# LocRotScale
|
||||
|
@ -117,19 +117,19 @@ class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo):
|
|||
bl_label = "LocRotScale"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator
|
||||
def generate(self, context, ks, data):
|
||||
# location
|
||||
RKS_GEN_location(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_location(self, context, ks, data)
|
||||
# rotation
|
||||
RKS_GEN_rotation(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
|
||||
# scale
|
||||
RKS_GEN_scaling(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
|
||||
|
||||
|
||||
# RotScale
|
||||
|
@ -137,17 +137,17 @@ class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo):
|
|||
bl_label = "RotScale"
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator
|
||||
def generate(self, context, ks, data):
|
||||
# rotation
|
||||
RKS_GEN_rotation(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
|
||||
# scaling
|
||||
RKS_GEN_scaling(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
|
||||
|
||||
# ------------
|
||||
|
||||
|
@ -159,13 +159,13 @@ class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo):
|
|||
bl_options = {'INSERTKEY_VISUAL'}
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_location
|
||||
generate = keyingsets_utils.RKS_GEN_location
|
||||
|
||||
|
||||
# Rotation
|
||||
|
@ -175,13 +175,13 @@ class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
|
|||
bl_options = {'INSERTKEY_VISUAL'}
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator - use callback for rotation
|
||||
generate = RKS_GEN_rotation
|
||||
generate = keyingsets_utils.RKS_GEN_rotation
|
||||
|
||||
|
||||
# VisualLocRot
|
||||
|
@ -191,17 +191,17 @@ class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
|
|||
bl_options = {'INSERTKEY_VISUAL'}
|
||||
|
||||
# poll - use predefined callback for selected bones/objects
|
||||
poll = RKS_POLL_selected_items
|
||||
poll = keyingsets_utils.RKS_POLL_selected_items
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator
|
||||
def generate(self, context, ks, data):
|
||||
# location
|
||||
RKS_GEN_location(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_location(self, context, ks, data)
|
||||
# rotation
|
||||
RKS_GEN_rotation(self, context, ks, data)
|
||||
keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
|
||||
|
||||
# ------------
|
||||
|
||||
|
@ -213,13 +213,13 @@ class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo):
|
|||
# poll - use predefined callback for selected objects
|
||||
# TODO: this should really check whether the selected object (or datablock)
|
||||
# has any animation data defined yet
|
||||
poll = RKS_POLL_selected_objects
|
||||
poll = keyingsets_utils.RKS_POLL_selected_objects
|
||||
|
||||
# iterator - use callback for selected bones/objects
|
||||
iterator = RKS_ITER_selected_item
|
||||
iterator = keyingsets_utils.RKS_ITER_selected_item
|
||||
|
||||
# generator - use callback for doing this
|
||||
generate = RKS_GEN_available
|
||||
generate = keyingsets_utils.RKS_GEN_available
|
||||
|
||||
###############################
|
||||
|
||||
|
@ -278,7 +278,7 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo):
|
|||
path = id_path + prop
|
||||
else:
|
||||
# standard transforms/properties
|
||||
path = path_add_property(id_path, prop)
|
||||
path = keyingsets_utils.path_add_property(id_path, prop)
|
||||
|
||||
# add Keying Set entry for this...
|
||||
if use_groups:
|
||||
|
@ -363,5 +363,3 @@ def unregister():
|
|||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
###############################
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.props import StringProperty, BoolProperty
|
||||
|
||||
|
||||
class ExportHelper:
|
||||
|
|
|
@ -72,7 +72,7 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg):
|
|||
|
||||
return verts, faces
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import FloatProperty, IntProperty, BoolProperty, FloatVectorProperty
|
||||
|
||||
|
||||
class AddTorus(bpy.types.Operator):
|
||||
|
|
|
@ -124,7 +124,7 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
|
|||
return action
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import IntProperty, BoolProperty
|
||||
|
||||
|
||||
class BakeAction(bpy.types.Operator):
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.props import StringProperty, BoolProperty, EnumProperty, IntProperty
|
||||
|
||||
|
||||
class SelectPattern(bpy.types.Operator):
|
||||
|
|
|
@ -230,7 +230,7 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
|||
return True
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import EnumProperty
|
||||
|
||||
|
||||
class AlignObjects(bpy.types.Operator):
|
||||
|
@ -239,7 +239,7 @@ class AlignObjects(bpy.types.Operator):
|
|||
bl_label = "Align Objects"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
align_mode = bpy.props.EnumProperty(items=(
|
||||
align_mode = EnumProperty(items=(
|
||||
('OPT_1', "Negative Sides", ""),
|
||||
('OPT_2', "Centers", ""),
|
||||
('OPT_3', "Positive Sides", "")),
|
||||
|
@ -247,7 +247,7 @@ class AlignObjects(bpy.types.Operator):
|
|||
description="",
|
||||
default='OPT_2')
|
||||
|
||||
relative_to = bpy.props.EnumProperty(items=(
|
||||
relative_to = EnumProperty(items=(
|
||||
('OPT_1', "Scene Origin", ""),
|
||||
('OPT_2', "3D Cursor", ""),
|
||||
('OPT_3', "Selection", ""),
|
||||
|
|
|
@ -84,7 +84,7 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even):
|
|||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import IntProperty, BoolProperty, FloatProperty, FloatVectorProperty
|
||||
|
||||
|
||||
class RandomizeLocRotSize(bpy.types.Operator):
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import bpy
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import IntProperty
|
||||
|
||||
|
||||
class SequencerCrossfadeSounds(bpy.types.Operator):
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
def write_svg(fw, mesh, image_width, image_height, face_iter):
|
||||
|
@ -239,6 +238,9 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
|||
bpy.data.materials.remove(mat_solid)
|
||||
|
||||
|
||||
from bpy.props import StringProperty, BoolProperty, EnumProperty, IntVectorProperty
|
||||
|
||||
|
||||
class ExportUVLayout(bpy.types.Operator):
|
||||
"""Export UV layout to file"""
|
||||
|
||||
|
|
|
@ -1115,7 +1115,7 @@ def main(context, island_margin, projection_limit):
|
|||
]
|
||||
"""
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import FloatProperty
|
||||
|
||||
|
||||
class SmartProject(bpy.types.Operator):
|
||||
|
|
|
@ -19,11 +19,9 @@
|
|||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||
|
||||
|
||||
class MESH_OT_delete_edgeloop(bpy.types.Operator):
|
||||
'''Delete an edge loop by merging the faces on each side to a single face loop'''
|
||||
bl_idname = "mesh.delete_edgeloop"
|
||||
|
@ -702,9 +700,6 @@ class WM_OT_doc_edit(bpy.types.Operator):
|
|||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
rna_path = StringProperty(name="Property Edit",
|
||||
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import bpy
|
||||
from keyingsets_utils import *
|
||||
|
||||
|
||||
class BUILTIN_KSI_hello(bpy.types.KeyingSetInfo):
|
||||
|
@ -7,7 +6,7 @@ class BUILTIN_KSI_hello(bpy.types.KeyingSetInfo):
|
|||
|
||||
# poll - test for whether Keying Set can be used at all
|
||||
def poll(ksi, context):
|
||||
return (context.active_object) or (context.selected_objects)
|
||||
return context.active_object or context.selected_objects
|
||||
|
||||
# iterator - go over all relevant data, calling generate()
|
||||
def iterator(ksi, context, ks):
|
||||
|
|
|
@ -13,8 +13,7 @@ def write_some_data(context, filepath, use_some_setting):
|
|||
# ExportHelper is a helper class, defines filename and
|
||||
# invoke() function which calls the file selector.
|
||||
from io_utils import ExportHelper
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import StringProperty, BoolProperty, EnumProperty
|
||||
|
||||
|
||||
class ExportSomeData(bpy.types.Operator, ExportHelper):
|
||||
|
@ -31,7 +30,9 @@ class ExportSomeData(bpy.types.Operator, ExportHelper):
|
|||
# to the class instance from the operator settings before calling.
|
||||
use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default=True)
|
||||
|
||||
type = bpy.props.EnumProperty(items=(('OPT_A', "First Option", "Description one"), ('OPT_B', "Second Option", "Description two.")),
|
||||
type = EnumProperty(items=(('OPT_A', "First Option", "Description one"),
|
||||
('OPT_B', "Second Option", "Description two."),
|
||||
),
|
||||
name="Example Enum",
|
||||
description="Choose between two items",
|
||||
default='OPT_A')
|
||||
|
|
|
@ -34,7 +34,7 @@ def add_box(width, height, depth):
|
|||
return vertices, faces
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import FloatProperty, BoolProperty, FloatVectorProperty
|
||||
|
||||
|
||||
class AddBox(bpy.types.Operator):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.props import IntProperty, FloatProperty
|
||||
|
||||
|
||||
class ModalOperator(bpy.types.Operator):
|
||||
|
|
|
@ -195,9 +195,6 @@ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
|
|||
_context_path = "scene"
|
||||
_property_type = bpy.types.Scene
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
# XXX, move operator to op/ dir
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.props import StringProperty
|
||||
|
||||
|
||||
class CONSOLE_HT_header(bpy.types.Header):
|
||||
|
|
|
@ -404,7 +404,7 @@ class InputKeyMapPanel(bpy.types.Panel):
|
|||
self.draw_hierarchy(display_keymaps, col)
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty
|
||||
|
||||
|
||||
def export_properties(prefix, properties, lines=None):
|
||||
|
|
|
@ -87,7 +87,15 @@ def main():
|
|||
for f in files_skip:
|
||||
print(" %s" % f)
|
||||
|
||||
# pyflakes
|
||||
# strict imports
|
||||
print("\n\n\n# running pep8...")
|
||||
import re
|
||||
import_check = re.compile(r"\s*from\s+[A-z\.]+\s+import \*\s*")
|
||||
for f, pep8_type in files:
|
||||
for i, l in enumerate(open(f, 'r', encoding='utf8')):
|
||||
if import_check.match(l):
|
||||
print("%s:%d:0: global import bad practice" % (f, i + 1))
|
||||
|
||||
print("\n\n\n# running pep8...")
|
||||
for f, pep8_type in files:
|
||||
if pep8_type == 1:
|
||||
|
@ -96,6 +104,7 @@ def main():
|
|||
else:
|
||||
os.system("pep8 --repeat '%s'" % (f))
|
||||
|
||||
# pyflakes
|
||||
print("\n\n\n# running pyflakes...")
|
||||
for f, pep8_type in files:
|
||||
os.system("pyflakes '%s'" % f)
|
||||
|
|
Loading…
Reference in New Issue