Cleanup: Python imports

Split over lines to diff more easily.
This commit is contained in:
Campbell Barton
2017-11-29 18:00:41 +11:00
parent c17c6557b4
commit ad7fb1c028
14 changed files with 67 additions and 47 deletions

View File

@@ -35,9 +35,9 @@ if __package__ is None:
import utils import utils
else: else:
from . import ( from . import (
settings, settings,
utils, utils,
) )
# 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!

View File

@@ -24,7 +24,11 @@
import os import os
import bpy import bpy
from mathutils import Vector, Euler, Matrix from mathutils import (
Euler,
Matrix,
Vector,
)
INTERN_PREVIEW_TYPES = {'MATERIAL', 'LAMP', 'WORLD', 'TEXTURE', 'IMAGE'} INTERN_PREVIEW_TYPES = {'MATERIAL', 'LAMP', 'WORLD', 'TEXTURE', 'IMAGE'}
@@ -39,7 +43,7 @@ def rna_backup_gen(data, include_props=None, exclude_props=None, root=()):
# only writable properties... # only writable properties...
for p in data.bl_rna.properties: for p in data.bl_rna.properties:
pid = p.identifier pid = p.identifier
if pid in {'rna_type', }: if pid == "rna_type":
continue continue
path = root + (pid,) path = root + (pid,)
if include_props is not None and path not in include_props: if include_props is not None and path not in include_props:

View File

@@ -35,10 +35,19 @@ __all__ = (
# internal blender C module # internal blender C module
from _bpy import types, props, app, data, context from _bpy import (
app,
context,
data,
props,
types,
)
# python modules # python modules
from . import utils, path from . import (
path,
utils,
)
# fake operator module # fake operator module
from .ops import ops_fake_module as ops from .ops import ops_fake_module as ops

View File

@@ -36,10 +36,10 @@ __all__ = (
import bpy import bpy
from bpy.props import ( from bpy.props import (
StringProperty, BoolProperty,
BoolProperty, EnumProperty,
EnumProperty, StringProperty,
) )
def _check_axis_conversion(op): def _check_axis_conversion(op):

View File

@@ -32,10 +32,10 @@ __all__ = (
import bpy import bpy
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
BoolVectorProperty, BoolVectorProperty,
FloatVectorProperty, FloatVectorProperty,
) )
def add_object_align_init(context, operator): def add_object_align_init(context, operator):

View File

@@ -21,7 +21,11 @@
import bpy as _bpy import bpy as _bpy
import bpyml import bpyml
from bpyml import TAG, ARGS, CHILDREN from bpyml import (
TAG,
ARGS,
CHILDREN,
)
_uilayout_rna = _bpy.types.UILayout.bl_rna _uilayout_rna = _bpy.types.UILayout.bl_rna
@@ -29,7 +33,7 @@ _uilayout_tags = (
["ui"] + ["ui"] +
_uilayout_rna.properties.keys() + _uilayout_rna.properties.keys() +
_uilayout_rna.functions.keys() _uilayout_rna.functions.keys()
) )
# these need to be imported directly # these need to be imported directly
# >>> from bpyml_ui.locals import * # >>> from bpyml_ui.locals import *

View File

@@ -21,10 +21,10 @@ import bpy
from bpy.types import Operator from bpy.types import Operator
from bpy.props import ( from bpy.props import (
FloatProperty, BoolProperty,
IntProperty, FloatProperty,
BoolProperty, IntProperty,
) )
from bpy.app.translations import pgettext_data as data_ from bpy.app.translations import pgettext_data as data_
from bpy_extras import object_utils from bpy_extras import object_utils
@@ -286,4 +286,4 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
classes = ( classes = (
AddTorus, AddTorus,
) )

View File

@@ -21,9 +21,9 @@
import bpy import bpy
from bpy.types import Operator from bpy.types import Operator
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
StringProperty, StringProperty,
) )
def _lang_module_get(sc): def _lang_module_get(sc):
@@ -167,4 +167,4 @@ classes = (
ConsoleCopyAsScript, ConsoleCopyAsScript,
ConsoleExec, ConsoleExec,
ConsoleLanguage, ConsoleLanguage,
) )

View File

@@ -21,10 +21,10 @@
import bpy import bpy
from bpy.types import Operator from bpy.types import Operator
from bpy.props import ( from bpy.props import (
StringProperty, BoolProperty,
BoolProperty, CollectionProperty,
CollectionProperty, StringProperty,
) )
# ########## Datablock previews... ########## # ########## Datablock previews... ##########
@@ -252,4 +252,4 @@ class WM_OT_previews_batch_clear(Operator):
classes = ( classes = (
WM_OT_previews_batch_clear, WM_OT_previews_batch_clear,
WM_OT_previews_batch_generate, WM_OT_previews_batch_generate,
) )

View File

@@ -1,4 +1,5 @@
# ##### BEGIN GPL LICENSE BLOCK ##### # ##### BEGIN GPL LICENSE BLOCK #####
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@@ -351,9 +352,9 @@ def align_objects(context,
from bpy.props import ( from bpy.props import (
EnumProperty, BoolProperty,
BoolProperty EnumProperty,
) )
class AlignObjects(Operator): class AlignObjects(Operator):

View File

@@ -24,9 +24,9 @@ from bpy.types import Operator
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
EnumProperty, EnumProperty,
IntProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
IntProperty,
) )

View File

@@ -90,9 +90,11 @@ def randomize_selected(context, seed, delta,
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0) uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
from bpy.props import (IntProperty, from bpy.props import (
BoolProperty, BoolProperty,
FloatVectorProperty) FloatVectorProperty,
IntProperty,
)
class RandomizeLocRotSize(Operator): class RandomizeLocRotSize(Operator):
@@ -189,4 +191,4 @@ class RandomizeLocRotSize(Operator):
classes = ( classes = (
RandomizeLocRotSize, RandomizeLocRotSize,
) )

View File

@@ -21,11 +21,11 @@
import bpy import bpy
from bpy.types import Operator from bpy.types import Operator
from bpy.props import ( from bpy.props import (
StringProperty,
BoolProperty, BoolProperty,
IntProperty,
FloatProperty,
EnumProperty, EnumProperty,
FloatProperty,
IntProperty,
StringProperty,
) )
from bpy.app.translations import pgettext_tip as tip_ from bpy.app.translations import pgettext_tip as tip_

View File

@@ -34,11 +34,11 @@ def add_box(width, height, depth):
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
BoolVectorProperty, BoolVectorProperty,
FloatProperty, FloatProperty,
FloatVectorProperty, FloatVectorProperty,
) )
class AddBox(bpy.types.Operator): class AddBox(bpy.types.Operator):