[Bf-blender-cvs] [432bfbf7a3b] master: Cleanup: pep8
Campbell Barton
noreply at git.blender.org
Tue Jul 6 04:10:37 CEST 2021
Commit: 432bfbf7a3b74943b1c251c12bd76616da23991f
Author: Campbell Barton
Date: Tue Jul 6 12:05:27 2021 +1000
Branches: master
https://developer.blender.org/rB432bfbf7a3b74943b1c251c12bd76616da23991f
Cleanup: pep8
===================================================================
M doc/python_api/examples/bpy.app.handlers.2.py
M doc/python_api/examples/bpy.app.timers.5.py
M doc/python_api/examples/bpy.msgbus.1.py
M doc/python_api/examples/bpy.types.Depsgraph.7.py
M doc/python_api/examples/gpu.6.py
M release/scripts/modules/bl_i18n_utils/utils.py
M release/scripts/modules/bl_i18n_utils/utils_cli.py
M release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
M release/scripts/modules/bl_previews_utils/bl_previews_render.py
M release/scripts/modules/bl_rna_utils/data_path.py
M release/scripts/modules/bpy/utils/__init__.py
M release/scripts/modules/bpy_extras/asset_utils.py
M release/scripts/modules/bpy_extras/node_shader_utils.py
M release/scripts/modules/console/complete_calltip.py
M release/scripts/startup/bl_operators/spreadsheet.py
M release/scripts/startup/bl_operators/wm.py
M release/scripts/startup/bl_ui/properties_collection.py
M release/scripts/startup/bl_ui/properties_data_gpencil.py
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_clip.py
M release/scripts/startup/bl_ui/space_dopesheet.py
M release/scripts/startup/bl_ui/space_image.py
M release/scripts/startup/bl_ui/space_outliner.py
M release/scripts/startup/bl_ui/space_sequencer.py
M release/scripts/startup/bl_ui/space_spreadsheet.py
M release/scripts/startup/bl_ui/space_userpref.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M release/scripts/startup/keyingsets_builtins.py
M release/scripts/templates_py/image_processing.py
M release/scripts/templates_py/operator_mesh_add.py
M tests/performance/api/__init__.py
M tests/performance/api/config.py
M tests/performance/api/device.py
M tests/performance/api/environment.py
M tests/performance/api/graph.py
M tests/performance/api/test.py
M tests/performance/tests/__init__.py
M tests/performance/tests/animation.py
M tests/performance/tests/blend_load.py
M tests/performance/tests/cycles.py
M tests/python/bl_animation_fcurves.py
M tests/python/bl_blendfile_library_overrides.py
M tests/python/bl_pyapi_idprop.py
M tests/python/compositor_render_tests.py
M tests/python/cycles_render_tests.py
M tests/python/modules/mesh_test.py
M tests/python/operators.py
===================================================================
diff --git a/doc/python_api/examples/bpy.app.handlers.2.py b/doc/python_api/examples/bpy.app.handlers.2.py
index aaaedeabecb..d514fa3fa4b 100644
--- a/doc/python_api/examples/bpy.app.handlers.2.py
+++ b/doc/python_api/examples/bpy.app.handlers.2.py
@@ -12,6 +12,7 @@ such cases, lock the interface (Render → Lock Interface or
Below is an example of a mesh that is altered from a handler:
"""
+
def frame_change_pre(scene):
# A triangle that shifts in the z direction
zshift = scene.frame_current * 0.1
diff --git a/doc/python_api/examples/bpy.app.timers.5.py b/doc/python_api/examples/bpy.app.timers.5.py
index 821a047d7c7..dda5ea12e73 100644
--- a/doc/python_api/examples/bpy.app.timers.5.py
+++ b/doc/python_api/examples/bpy.app.timers.5.py
@@ -16,10 +16,12 @@ execution_queue = queue.Queue()
def run_in_main_thread(function):
execution_queue.put(function)
+
def execute_queued_functions():
while not execution_queue.empty():
function = execution_queue.get()
function()
return 1.0
+
bpy.app.timers.register(execute_queued_functions)
diff --git a/doc/python_api/examples/bpy.msgbus.1.py b/doc/python_api/examples/bpy.msgbus.1.py
index 21198471ffa..8164272d521 100644
--- a/doc/python_api/examples/bpy.msgbus.1.py
+++ b/doc/python_api/examples/bpy.msgbus.1.py
@@ -31,11 +31,13 @@ owner = object()
subscribe_to = bpy.context.object.location
+
def msgbus_callback(*args):
# This will print:
# Something changed! (1, 2, 3)
print("Something changed!", args)
+
bpy.msgbus.subscribe_rna(
key=subscribe_to,
owner=owner,
diff --git a/doc/python_api/examples/bpy.types.Depsgraph.7.py b/doc/python_api/examples/bpy.types.Depsgraph.7.py
index 11982730fc9..afea8dfd618 100644
--- a/doc/python_api/examples/bpy.types.Depsgraph.7.py
+++ b/doc/python_api/examples/bpy.types.Depsgraph.7.py
@@ -44,7 +44,7 @@ class OBJECT_OT_object_to_curve(bpy.types.Operator):
# Remove temporary curve.
obj.to_curve_clear()
# Invoke to_curve() with applying modifiers.
- curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers = True)
+ curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers=True)
self.report({'INFO'}, f"{len(curve_with_modifiers.splines)} splines in new curve with modifiers.")
# Remove temporary curve.
obj.to_curve_clear()
diff --git a/doc/python_api/examples/gpu.6.py b/doc/python_api/examples/gpu.6.py
index 334a606055a..be164a03028 100644
--- a/doc/python_api/examples/gpu.6.py
+++ b/doc/python_api/examples/gpu.6.py
@@ -21,6 +21,7 @@ batch = batch_for_shader(
},
)
+
def draw():
shader.bind()
shader.uniform_sampler("image", texture)
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index f63b6990cdd..fda93682dc5 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -781,7 +781,6 @@ class I18nMessages:
print("Could not import bpy, find_best_messages_matches must be run from whithin Blender.")
return
-
# Build helper mappings.
# Note it's user responsibility to know when to invalidate (and hence force rebuild) this cache!
if self._reverse_cache is None:
diff --git a/release/scripts/modules/bl_i18n_utils/utils_cli.py b/release/scripts/modules/bl_i18n_utils/utils_cli.py
index d3750d5e9a4..e18491fa042 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_cli.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_cli.py
@@ -140,6 +140,7 @@ def main():
args.func(args=args, settings=settings)
+
if __name__ == "__main__":
print("\n\n *** Running {} *** \n".format(__file__))
main()
diff --git a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
index aff1108568b..26f38cf09fc 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
@@ -449,6 +449,5 @@ def generate(context, space_type, *, use_fallback_keys=True, use_reset=True):
)
kmi.properties.skip_depressed = True
-
wm.keyconfigs.update()
return keymap
diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py
index 51ea53c0eba..17577a9a9f2 100644
--- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py
+++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py
@@ -37,6 +37,7 @@ OBJECT_TYPES_RENDER = {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT'}
def ids_nolib(bids):
return (bid for bid in bids if not bid.library)
+
def ids_nolib_with_preview(bids):
return (bid for bid in bids if (not bid.library and bid.preview))
diff --git a/release/scripts/modules/bl_rna_utils/data_path.py b/release/scripts/modules/bl_rna_utils/data_path.py
index 42942b7a295..439dfcae12a 100644
--- a/release/scripts/modules/bl_rna_utils/data_path.py
+++ b/release/scripts/modules/bl_rna_utils/data_path.py
@@ -23,6 +23,7 @@ __all__ = (
"decompose_data_path",
)
+
class _TokenizeDataPath:
"""
Class to split up tokens of a data-path.
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index e6c7bca3e3c..58b20d9e3c8 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -155,6 +155,7 @@ def _test_import(module_name, loaded_modules):
# This supports the case of loading a new preferences file which may reset scripts path.
_sys_path_ensure_paths = set()
+
def _sys_path_ensure_prepend(path):
if path not in _sys.path:
_sys.path.insert(0, path)
diff --git a/release/scripts/modules/bpy_extras/asset_utils.py b/release/scripts/modules/bpy_extras/asset_utils.py
index 1656c21a137..e41eeeed4fa 100644
--- a/release/scripts/modules/bpy_extras/asset_utils.py
+++ b/release/scripts/modules/bpy_extras/asset_utils.py
@@ -31,6 +31,7 @@ __all__ = (
"SpaceAssetInfo",
)
+
class SpaceAssetInfo:
@classmethod
def is_asset_browser(cls, space_data: bpy.types.Space):
@@ -46,6 +47,7 @@ class SpaceAssetInfo:
active_file = context.active_file
return active_file.asset_data if active_file else None
+
class AssetBrowserPanel:
bl_space_type = 'FILE_BROWSER'
@@ -53,6 +55,7 @@ class AssetBrowserPanel:
def poll(cls, context):
return SpaceAssetInfo.is_asset_browser_poll(context)
+
class AssetMetaDataPanel:
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
diff --git a/release/scripts/modules/bpy_extras/node_shader_utils.py b/release/scripts/modules/bpy_extras/node_shader_utils.py
index 54124fd4ca6..e37c1a17152 100644
--- a/release/scripts/modules/bpy_extras/node_shader_utils.py
+++ b/release/scripts/modules/bpy_extras/node_shader_utils.py
@@ -681,7 +681,10 @@ class ShaderImageTextureWrapper():
tree = self.owner_shader.material.node_tree
node_image = tree.nodes.new(type='ShaderNodeTexImage')
- self.owner_shader._grid_to_location(-1, 0 + self.grid_row_diff, dst_node=node_image, ref_node=self.node_dst)
+ self.owner_shader._grid_to_location(
+ -1, 0 + self.grid_row_diff,
+ dst_node=node_image, ref_node=self.node_dst,
+ )
tree.links.new(node_image.outputs["Alpha" if self.use_alpha else "Color"], self.socket_dst)
if self.use_alpha:
@@ -778,7 +781,7 @@ class ShaderImageTextureWrapper():
socket_dst = self.node_image.inputs["Vector"]
# If not already existing, we need to create texcoords -> mapping link (from UV).
socket_src = (socket_dst.links[0].from_socket if socket_dst.is_linked
- else self.owner_shader.node_texcoords.outputs['UV'])
+ else self.owner_shader.node_texcoords.outputs['UV'])
tree = self.owner_shader.material.node_tree
node_mapping = tree.nodes.new(type='ShaderNodeMapping')
diff --git a/release/scripts/modules/console/complete_calltip.py b/release/scripts/modules/console/complete_calltip.py
index 706af67905b..60daa1d2045 100644
--- a/release/scripts/modules/console/complete_calltip.py
+++ b/release/scripts/modules/console/complete_calltip.py
@@ -41,7 +41,7 @@ RE_DEF_COMPLETE = re.compile(
# allow empty string
'''|)'''
# allow opening bracket(s)
- '''(?:\(|\s)*)$''')
+ r'''(?:\(|\s)*)$''')
def reduce_newlines(text):
diff --git a/release/scripts/startup/bl_operators/spreadsheet.py b/release/scripts/startup/bl_operators/spreadsheet.py
index 1907a69a3d3..b5098d63dac 100644
--- a/release/scripts/startup/bl_operators/spreadsheet.py
+++ b/release/scripts/startup/bl_operators/spreadsheet.py
@@ -20,6 +20,7 @@ from __future__ import annotations
from bpy.types import Operator
+
class SPREADSHEET_OT_toggle_pin(Operator):
'''Turn on or off pinning'''
bl_idname = "spreadsheet.toggle_pin"
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 2cc7b828c11..6a3830ad1e4 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -135,7 +135,7 @@ def context_path_decompose(data_path):
if base_path:
assert(base_path.startswith("."))
- base_path= base_path[1:]
+ base_path = base_path[1:]
if prop_attr:
assert(prop_attr.startswith("."))
prop_attr = prop_attr[1:]
diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
index 27de80bb88d..b51d7157c06 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -35,7 +35,7 @@ def lineart_make_line_type_entry(col, line_type, text_disp, expand, search_from)
if line_type.use and expand:
col.prop_search(line_type, "layer", search_from,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list