Cleanup: prefer 'arg' over 'params' for sphinx documentation
While both are supported, 'arg' is in more common use so prefer it.
This commit is contained in:
@@ -43,10 +43,10 @@ class ModifierSpec:
|
||||
def __init__(self, modifier_name: str, modifier_type: str, modifier_parameters: dict, frame_end=0):
|
||||
"""
|
||||
Constructs a modifier spec.
|
||||
:param modifier_name: str - name of object modifier, e.g. "myFirstSubsurfModif"
|
||||
:param modifier_type: str - type of object modifier, e.g. "SUBSURF"
|
||||
:param modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"quality" : 4}
|
||||
:param frame_end: int - frame at which simulation needs to be baked or modifier needs to be applied.
|
||||
:arg modifier_name: str - name of object modifier, e.g. "myFirstSubsurfModif"
|
||||
:arg modifier_type: str - type of object modifier, e.g. "SUBSURF"
|
||||
:arg modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"quality" : 4}
|
||||
:arg frame_end: int - frame at which simulation needs to be baked or modifier needs to be applied.
|
||||
"""
|
||||
self.modifier_name = modifier_name
|
||||
self.modifier_type = modifier_type
|
||||
@@ -66,10 +66,10 @@ class ParticleSystemSpec:
|
||||
def __init__(self, modifier_name: str, modifier_type: str, modifier_parameters: dict, frame_end: int):
|
||||
"""
|
||||
Constructs a particle system spec.
|
||||
:param modifier_name: str - name of object modifier, e.g. "Particles"
|
||||
:param modifier_type: str - type of object modifier, e.g. "PARTICLE_SYSTEM"
|
||||
:param modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"seed" : 1}
|
||||
:param frame_end: int - the last frame of the simulation at which the modifier is applied
|
||||
:arg modifier_name: str - name of object modifier, e.g. "Particles"
|
||||
:arg modifier_type: str - type of object modifier, e.g. "PARTICLE_SYSTEM"
|
||||
:arg modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"seed" : 1}
|
||||
:arg frame_end: int - the last frame of the simulation at which the modifier is applied
|
||||
"""
|
||||
self.modifier_name = modifier_name
|
||||
self.modifier_type = modifier_type
|
||||
@@ -97,11 +97,11 @@ class OperatorSpecEditMode:
|
||||
):
|
||||
"""
|
||||
Constructs an OperatorSpecEditMode. Raises ValueError if selec_mode is invalid.
|
||||
:param operator_name: str - name of mesh operator from bpy.ops.mesh, e.g. "bevel" or "fill"
|
||||
:param operator_parameters: dict - {name : val} dictionary containing operator parameters.
|
||||
:param select_mode: str - mesh selection mode, must be either 'VERT', 'EDGE' or 'FACE'
|
||||
:param selection: sequence - vertices/edges/faces indices to select, e.g. [0, 9, 10].
|
||||
:param: select_history: bool - load selection into bmesh selection history.
|
||||
:arg operator_name: str - name of mesh operator from bpy.ops.mesh, e.g. "bevel" or "fill"
|
||||
:arg operator_parameters: dict - {name : val} dictionary containing operator parameters.
|
||||
:arg select_mode: str - mesh selection mode, must be either 'VERT', 'EDGE' or 'FACE'
|
||||
:arg selection: sequence - vertices/edges/faces indices to select, e.g. [0, 9, 10].
|
||||
:arg: select_history: bool - load selection into bmesh selection history.
|
||||
"""
|
||||
self.operator_name = operator_name
|
||||
self.operator_parameters = operator_parameters
|
||||
@@ -125,8 +125,8 @@ class OperatorSpecObjectMode:
|
||||
|
||||
def __init__(self, operator_name: str, operator_parameters: dict):
|
||||
"""
|
||||
:param operator_name: str - name of the object operator from bpy.ops.object, e.g. "shade_smooth" or "shape_keys"
|
||||
:param operator_parameters: dict - contains operator parameters.
|
||||
:arg operator_name: str - name of the object operator from bpy.ops.object, e.g. "shade_smooth" or "shape_keys"
|
||||
:arg operator_parameters: dict - contains operator parameters.
|
||||
"""
|
||||
self.operator_name = operator_name
|
||||
self.operator_parameters = operator_parameters
|
||||
@@ -144,9 +144,9 @@ class DeformModifierSpec:
|
||||
def __init__(self, frame_number: int, modifier_list: list, object_operator_spec: OperatorSpecObjectMode = None):
|
||||
"""
|
||||
Constructs a Deform Modifier spec (for user input)
|
||||
:param frame_number: int - the frame at which animated keyframe is inserted
|
||||
:param modifier_list: ModifierSpec - contains modifiers
|
||||
:param object_operator_spec: OperatorSpecObjectMode - contains object operators
|
||||
:arg frame_number: int - the frame at which animated keyframe is inserted
|
||||
:arg modifier_list: ModifierSpec - contains modifiers
|
||||
:arg object_operator_spec: OperatorSpecObjectMode - contains object operators
|
||||
"""
|
||||
self.frame_number = frame_number
|
||||
self.modifier_list = modifier_list
|
||||
@@ -163,12 +163,12 @@ class MeshTest(ABC):
|
||||
|
||||
def __init__(self, test_object_name, exp_object_name, test_name=None, threshold=None, do_compare=True):
|
||||
"""
|
||||
:param test_object_name: str - Name of object of mesh type to run the operations on.
|
||||
:param exp_object_name: str - Name of object of mesh type that has the expected
|
||||
:arg test_object_name: str - Name of object of mesh type to run the operations on.
|
||||
:arg exp_object_name: str - Name of object of mesh type that has the expected
|
||||
geometry after running the operations.
|
||||
:param test_name: str - Name of the test.
|
||||
:param threshold: exponent: To allow variations and accept difference to a certain degree.
|
||||
:param do_compare: bool - True if we want to compare the test and expected objects, False otherwise.
|
||||
:arg test_name: str - Name of the test.
|
||||
:arg threshold: exponent: To allow variations and accept difference to a certain degree.
|
||||
:arg do_compare: bool - True if we want to compare the test and expected objects, False otherwise.
|
||||
"""
|
||||
self.test_object_name = test_object_name
|
||||
self.exp_object_name = exp_object_name
|
||||
@@ -302,10 +302,10 @@ class MeshTest(ABC):
|
||||
def do_selection(self, mesh: bpy.types.Mesh, select_mode: str, selection, select_history: bool):
|
||||
"""
|
||||
Do selection on a mesh.
|
||||
:param mesh: bpy.types.Mesh - input mesh
|
||||
:param: select_mode: str - selection mode. Must be 'VERT', 'EDGE' or 'FACE'
|
||||
:param: selection: sequence - indices of selection.
|
||||
:param: select_history: bool - load selection into bmesh selection history
|
||||
:arg mesh: bpy.types.Mesh - input mesh
|
||||
:arg: select_mode: str - selection mode. Must be 'VERT', 'EDGE' or 'FACE'
|
||||
:arg: selection: sequence - indices of selection.
|
||||
:arg: select_history: bool - load selection into bmesh selection history
|
||||
|
||||
Example: select_mode='VERT' and selection={1,2,3} selects veritces 1, 2 and 3 of input mesh
|
||||
"""
|
||||
@@ -366,9 +366,9 @@ class MeshTest(ABC):
|
||||
def compare_meshes(evaluated_object, expected_object, threshold):
|
||||
"""
|
||||
Compares evaluated object mesh with expected object mesh.
|
||||
:param evaluated_object: first object for comparison.
|
||||
:param expected_object: second object for comparison.
|
||||
:param threshold: exponent: To allow variations and accept difference to a certain degree.
|
||||
:arg evaluated_object: first object for comparison.
|
||||
:arg expected_object: second object for comparison.
|
||||
:arg threshold: exponent: To allow variations and accept difference to a certain degree.
|
||||
:return: dict: Contains results of different comparisons.
|
||||
"""
|
||||
objects = bpy.data.objects
|
||||
@@ -439,14 +439,14 @@ class SpecMeshTest(MeshTest):
|
||||
"""
|
||||
Constructor for SpecMeshTest.
|
||||
|
||||
:param test_name: str - Name of the test.
|
||||
:param test_object_name: str - Name of object of mesh type to run the operations on.
|
||||
:param exp_object_name: str - Name of object of mesh type that has the expected
|
||||
geometry after running the operations.
|
||||
:param operations_stack: list - stack holding operations to perform on the test_object.
|
||||
:param apply_modifier: bool - True if we want to apply the modifiers right after adding them to the object.
|
||||
- True if we want to apply the modifier to list of modifiers, after some operation.
|
||||
This affects operations of type ModifierSpec and DeformModifierSpec.
|
||||
:arg test_name: str - Name of the test.
|
||||
:arg test_object_name: str - Name of object of mesh type to run the operations on.
|
||||
:arg exp_object_name: str - Name of object of mesh type that has the expected
|
||||
geometry after running the operations.
|
||||
:arg operations_stack: list - stack holding operations to perform on the test_object.
|
||||
:arg apply_modifier: bool - True if we want to apply the modifiers right after adding them to the object.
|
||||
- True if we want to apply the modifier to list of modifiers, after some operation.
|
||||
This affects operations of type ModifierSpec and DeformModifierSpec.
|
||||
"""
|
||||
|
||||
super().__init__(test_object_name, exp_object_name, test_name, threshold)
|
||||
@@ -491,9 +491,9 @@ class SpecMeshTest(MeshTest):
|
||||
def _set_parameters_impl(self, modifier, modifier_parameters, nested_settings_path, modifier_name):
|
||||
"""
|
||||
Doing a depth first traversal of the modifier parameters and setting their values.
|
||||
:param: modifier: Of type modifier, its altered to become a setting in recursion.
|
||||
:param: modifier_parameters : dict or sequence, a simple/nested dictionary of modifier parameters.
|
||||
:param: nested_settings_path : list(stack): helps in tracing path to each node.
|
||||
:arg: modifier: Of type modifier, its altered to become a setting in recursion.
|
||||
:arg: modifier_parameters : dict or sequence, a simple/nested dictionary of modifier parameters.
|
||||
:arg: nested_settings_path : list(stack): helps in tracing path to each node.
|
||||
"""
|
||||
if not isinstance(modifier_parameters, dict):
|
||||
param_setting = None
|
||||
@@ -540,8 +540,8 @@ class SpecMeshTest(MeshTest):
|
||||
def _add_modifier(self, test_object, modifier_spec: ModifierSpec):
|
||||
"""
|
||||
Add modifier to object.
|
||||
:param test_object: bpy.types.Object - Blender object to apply modifier on.
|
||||
:param modifier_spec: ModifierSpec - ModifierSpec object with parameters
|
||||
:arg test_object: bpy.types.Object - Blender object to apply modifier on.
|
||||
:arg modifier_spec: ModifierSpec - ModifierSpec object with parameters
|
||||
"""
|
||||
bakers_list = ['CLOTH', 'SOFT_BODY', 'DYNAMIC_PAINT', 'FLUID']
|
||||
scene = bpy.context.scene
|
||||
@@ -645,8 +645,8 @@ class SpecMeshTest(MeshTest):
|
||||
def _apply_operator_edit_mode(self, test_object, operator: OperatorSpecEditMode):
|
||||
"""
|
||||
Apply operator on test object.
|
||||
:param test_object: bpy.types.Object - Blender object to apply operator on.
|
||||
:param operator: OperatorSpecEditMode - OperatorSpecEditMode object with parameters.
|
||||
:arg test_object: bpy.types.Object - Blender object to apply operator on.
|
||||
:arg operator: OperatorSpecEditMode - OperatorSpecEditMode object with parameters.
|
||||
"""
|
||||
self.do_selection(
|
||||
test_object.data,
|
||||
@@ -695,7 +695,7 @@ class SpecMeshTest(MeshTest):
|
||||
|
||||
def _apply_deform_modifier(self, test_object, operation: list):
|
||||
"""
|
||||
param: operation: list: List of modifiers or combination of modifier and object operator.
|
||||
arg: operation: list: List of modifiers or combination of modifier and object operator.
|
||||
"""
|
||||
|
||||
scene = bpy.context.scene
|
||||
@@ -761,7 +761,7 @@ class RunTest:
|
||||
def __init__(self, tests, apply_modifiers=False, do_compare=False):
|
||||
"""
|
||||
Construct a test suite.
|
||||
:param tests: list - list of modifier or operator test cases. Each element in the list must contain the
|
||||
:arg tests: list - list of modifier or operator test cases. Each element in the list must contain the
|
||||
following
|
||||
in the correct order:
|
||||
0) test_name: str - unique test name
|
||||
@@ -825,7 +825,7 @@ class RunTest:
|
||||
def run_test(self, test_name: str):
|
||||
"""
|
||||
Run a single test from self.tests list
|
||||
:param test_name: int - name of test
|
||||
:arg test_name: int - name of test
|
||||
:return: bool - True if test passed, False otherwise.
|
||||
"""
|
||||
case = None
|
||||
|
||||
@@ -46,8 +46,8 @@ class AbstractBlenderRunnerTest(unittest.TestCase):
|
||||
|
||||
Returns Blender's stdout + stderr combined into one string.
|
||||
|
||||
:param filepath: taken relative to self.testdir.
|
||||
:param timeout: in seconds
|
||||
:arg filepath: taken relative to self.testdir.
|
||||
:arg timeout: in seconds
|
||||
"""
|
||||
|
||||
assert self.blender, "Path to Blender binary is to be set in setUpClass()"
|
||||
|
||||
Reference in New Issue
Block a user