[Bf-extensions-cvs] [8f11aecd] master: Power Sequencer: address docstring warnings

Nathan Lovato noreply at git.blender.org
Fri May 15 02:32:42 CEST 2020


Commit: 8f11aecde7409633595b23f24b446943225aa319
Author: Nathan Lovato
Date:   Thu May 14 18:31:18 2020 -0600
Branches: master
https://developer.blender.org/rBA8f11aecde7409633595b23f24b446943225aa319

Power Sequencer: address docstring warnings

The previous commit passed tests without warnings or errors here, but LazyDodo sent
me a log with warnings he was getting on his machine. This commit
attempts to address them.

Note: I'm not getting warnings when running unit tests here.

===================================================================

M	power_sequencer/operators/cut_strips_under_cursor.py
M	power_sequencer/operators/delete_direct.py
M	power_sequencer/operators/expand_to_surrounding_cuts.py
M	power_sequencer/operators/fade_add.py
M	power_sequencer/operators/fade_clear.py
M	power_sequencer/operators/scene_merge_from.py
M	power_sequencer/operators/select_all_left_or_right.py
M	power_sequencer/operators/snap.py
M	power_sequencer/operators/snap_selection.py
M	power_sequencer/operators/trim_left_or_right_handles.py

===================================================================

diff --git a/power_sequencer/operators/cut_strips_under_cursor.py b/power_sequencer/operators/cut_strips_under_cursor.py
index b7c64135..d7e1141a 100644
--- a/power_sequencer/operators/cut_strips_under_cursor.py
+++ b/power_sequencer/operators/cut_strips_under_cursor.py
@@ -23,14 +23,16 @@ from .utils.functions import get_mouse_frame_and_channel
 class POWER_SEQUENCER_OT_split_strips_under_cursor(bpy.types.Operator):
     """
     Splits all strips under cursor including muted strips, but excluding locked strips.
-    Auto selects sequences under the time cursor when you don't have a selection.
+    Auto selects sequences under the time cursor when you don't have a selection
     """
 
     doc = {
         "name": doc_name(__qualname__),
         "demo": "https://i.imgur.com/ZyEd0jD.gif",
         "description": doc_description(__doc__),
-        "shortcuts": [({"type": "K", "value": "PRESS"}, {}, "Cut All Strips Under Cursor")],
+        "shortcuts": [
+            ({"type": "K", "value": "PRESS"}, {}, "Cut All Strips Under Cursor")
+        ],
         "keymap": "Sequencer",
     }
     bl_idname = doc_idname(__qualname__)
@@ -39,7 +41,10 @@ class POWER_SEQUENCER_OT_split_strips_under_cursor(bpy.types.Operator):
     bl_options = {"REGISTER", "UNDO"}
 
     side: bpy.props.EnumProperty(
-        items=[("LEFT", "", ""), ("RIGHT", "", "")], name="Side", default="LEFT", options={"HIDDEN"}
+        items=[("LEFT", "", ""), ("RIGHT", "", "")],
+        name="Side",
+        default="LEFT",
+        options={"HIDDEN"},
     )
 
     @classmethod
@@ -61,5 +66,10 @@ class POWER_SEQUENCER_OT_split_strips_under_cursor(bpy.types.Operator):
                 deselect = False
         if deselect:
             bpy.ops.sequencer.select_all(action="DESELECT")
-        (context.selected_sequences or bpy.ops.power_sequencer.select_strips_under_cursor())
-        return bpy.ops.sequencer.split(frame=context.scene.frame_current, side=self.side)
+        (
+            context.selected_sequences
+            or bpy.ops.power_sequencer.select_strips_under_cursor()
+        )
+        return bpy.ops.sequencer.split(
+            frame=context.scene.frame_current, side=self.side
+        )
diff --git a/power_sequencer/operators/delete_direct.py b/power_sequencer/operators/delete_direct.py
index c6d77131..b39ae12f 100644
--- a/power_sequencer/operators/delete_direct.py
+++ b/power_sequencer/operators/delete_direct.py
@@ -22,7 +22,7 @@ from .utils.doc import doc_name, doc_idname, doc_brief, doc_description
 
 class POWER_SEQUENCER_OT_delete_direct(bpy.types.Operator):
     """
-    Deletes strips without confirmation, and cleans up crossfades nicely.
+    Deletes strips without confirmation, and cleans up crossfades nicely
     """
 
     doc = {
@@ -50,7 +50,9 @@ class POWER_SEQUENCER_OT_delete_direct(bpy.types.Operator):
     bl_description = doc_brief(doc["description"])
     bl_options = {"REGISTER", "UNDO"}
 
-    is_removing_transitions: bpy.props.BoolProperty(name="Remove Transitions", default=False)
+    is_removing_transitions: bpy.props.BoolProperty(
+        name="Remove Transitions", default=False
+    )
 
     @classmethod
     def poll(cls, context):
@@ -59,12 +61,17 @@ class POWER_SEQUENCER_OT_delete_direct(bpy.types.Operator):
     def invoke(self, context, event):
         frame, channel = get_mouse_frame_and_channel(context, event)
         if not context.selected_sequences:
-            bpy.ops.power_sequencer.select_closest_to_mouse(frame=frame, channel=channel)
+            bpy.ops.power_sequencer.select_closest_to_mouse(
+                frame=frame, channel=channel
+            )
         return self.execute(context)
 
     def execute(self, context):
         selection = context.selected_sequences
-        if self.is_removing_transitions and bpy.ops.power_sequencer.transitions_remove.poll():
+        if (
+            self.is_removing_transitions
+            and bpy.ops.power_sequencer.transitions_remove.poll()
+        ):
             bpy.ops.power_sequencer.transitions_remove()
         bpy.ops.sequencer.delete()
 
diff --git a/power_sequencer/operators/expand_to_surrounding_cuts.py b/power_sequencer/operators/expand_to_surrounding_cuts.py
index d18e5bf6..1435b23c 100644
--- a/power_sequencer/operators/expand_to_surrounding_cuts.py
+++ b/power_sequencer/operators/expand_to_surrounding_cuts.py
@@ -25,7 +25,7 @@ class POWER_SEQUENCER_OT_expand_to_surrounding_cuts(bpy.types.Operator):
     *Brief* Expand selected strips to surrounding cuts
 
     Finds potential gaps surrounding each block of selected sequences and extends the corresponding
-    sequence handle to it.
+    sequence handle to it
     """
 
     doc = {
@@ -33,7 +33,11 @@ class POWER_SEQUENCER_OT_expand_to_surrounding_cuts(bpy.types.Operator):
         "demo": "",
         "description": doc_description(__doc__),
         "shortcuts": [
-            ({"type": "E", "value": "PRESS", "ctrl": True}, {}, "Expand to Surrounding Cuts")
+            (
+                {"type": "E", "value": "PRESS", "ctrl": True},
+                {},
+                "Expand to Surrounding Cuts",
+            )
         ],
         "keymap": "Sequencer",
     }
@@ -64,34 +68,50 @@ class POWER_SEQUENCER_OT_expand_to_surrounding_cuts(bpy.types.Operator):
             sequences_frame_start = min(
                 sequences, key=lambda s: s.frame_final_start
             ).frame_final_start
-            sequences_frame_end = max(sequences, key=lambda s: s.frame_final_end).frame_final_end
+            sequences_frame_end = max(
+                sequences, key=lambda s: s.frame_final_end
+            ).frame_final_end
 
             frame_left, frame_right = find_closest_cuts(
                 context, sequences_frame_start, sequences_frame_end
             )
-            if sequences_frame_start == frame_left and sequences_frame_end == frame_right:
+            if (
+                sequences_frame_start == frame_left
+                and sequences_frame_end == frame_right
+            ):
                 continue
 
-            to_extend_left = [s for s in sequences if s.frame_final_start == sequences_frame_start]
-            to_extend_right = [s for s in sequences if s.frame_final_end == sequences_frame_end]
+            to_extend_left = [
+                s for s in sequences if s.frame_final_start == sequences_frame_start
+            ]
+            to_extend_right = [
+                s for s in sequences if s.frame_final_end == sequences_frame_end
+            ]
 
             for s in to_extend_left:
                 s.frame_final_start = (
-                    frame_left if frame_left < sequences_frame_start else sequences_frame_start
+                    frame_left
+                    if frame_left < sequences_frame_start
+                    else sequences_frame_start
                 )
             for s in to_extend_right:
                 s.frame_final_end = (
-                    frame_right if frame_right > sequences_frame_end else sequences_frame_end
+                    frame_right
+                    if frame_right > sequences_frame_end
+                    else sequences_frame_end
                 )
         return {"FINISHED"}
 
 
 def find_closest_cuts(context, frame_min, frame_max):
     frame_left = max(
-        context.sequences, key=lambda s: s.frame_final_end if s.frame_final_end <= frame_min else -1
+        context.sequences,
+        key=lambda s: s.frame_final_end if s.frame_final_end <= frame_min else -1,
     ).frame_final_end
     frame_right = min(
         context.sequences,
-        key=lambda s: s.frame_final_start if s.frame_final_start >= frame_max else 1000000,
+        key=lambda s: s.frame_final_start
+        if s.frame_final_start >= frame_max
+        else 1000000,
     ).frame_final_start
     return frame_left, frame_right
diff --git a/power_sequencer/operators/fade_add.py b/power_sequencer/operators/fade_add.py
index 1bb808cd..70a0798b 100644
--- a/power_sequencer/operators/fade_add.py
+++ b/power_sequencer/operators/fade_add.py
@@ -31,7 +31,7 @@ class POWER_SEQUENCER_OT_fade_add(bpy.types.Operator):
     - From playhead: the fade animation goes from the start of sequences under the playhead to the playhead
     - To playhead: the fade animation goes from the playhead to the end of sequences under the playhead
 
-    By default, the duration of the fade is 1 second.
+    By default, the duration of the fade is 1 second
     """
 
     doc = {
@@ -51,7 +51,10 @@ class POWER_SEQUENCER_OT_fade_add(bpy.types.Operator):
     bl_options = {"REGISTER", "UNDO"}
 
     duration_seconds: bpy.props.FloatProperty(
-        name="Fade Duration", description="Duration of the fade in seconds", default=1.0, min=0.01
+        name="Fade Duration",
+        description="Duration of the fade in seconds",
+        default=1.0,
+        min=0.01,
     )
     type: bpy.props.EnumProperty(
         items=[
@@ -95,8 +98,12 @@ class POWER_SEQUENCER_OT_fade_add(bpy.types.Operator):
                 if s.frame_final_start < context.scene.frame_current < s.frame_final_end
             ]
 
-        max_duration = min(sequences, key=lambda s: s.frame_final_duration).frame_final_duration
-        max_duration = floor(max_duration / 2.0) if self.type == "IN_OUT" else max_duration
+        max_duration = min(
+            sequences, key=lambda s: s.frame_final_duration
+        ).frame_final_duration
+        max_duration = (
+            floor(max_duration / 2.0) if self.type == "IN_OUT" else max_duration
+        )
 
         faded_sequences = []
         for sequence in sequences:
@@ -106,16 +113,25 @@ class POWER_SEQUENCER_OT_fade_add(bpy.types.Operator):
             if not self.is_long_enough(sequence, duration):
                 continue
 
-            animated_property = "volume" if hasattr(sequence, "volume") else "blend_alpha"
-            fade_fcurve = fade_find_or_create_fcurve(context, sequence, animated_property)
-            fades = self.calculate_fades(sequence, fade_fcurve, animated_property, duration)
+            animated_property = (
+                "volume" if hasattr(sequence, "volume") else "blend_alpha"
+            )
+            fade_fcurve = fade_find_or_crea

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list