Skip to content

Commit 5a39fa0

Browse files
Fix order of arguments mmSolver._api.solverstandard._compile_single_frame()
I have incorrectly passed the arguments to the function creating the "single frame solver" recipe. This created a silent error where the "precomputed data" (a `dict`) was passed to the `remove_unused_objects` argument which then asserted the wrong type. I have added more type asserts to mitigate type of problem, in this file. Issue #232
1 parent 25b4ec0 commit 5a39fa0

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

python/mmSolver/_api/solverstandard.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ def _compile_multi_root_frames(col,
212212
solving, second Action is to validate the inputs given.
213213
:rtype: (Action, Action or None)
214214
"""
215+
assert isinstance(root_iter_num, int)
216+
assert isinstance(remove_unused_objects, bool)
217+
assert isinstance(withtest, bool)
218+
assert isinstance(verbose, bool)
219+
215220
# Solve root frames.
216221
for frm_list in batch_frame_list:
217222
# Get root markers
@@ -290,6 +295,9 @@ def _compile_remove_inbetween_frames(attr_list,
290295
Yields an Action and None, at each iteration.
291296
:rtype: (Action, None)
292297
"""
298+
assert isinstance(withtest, bool)
299+
assert isinstance(verbose, bool)
300+
293301
# Solve in-between frames
294302
attr_names = [x.get_name() for x in attr_list]
295303

@@ -378,6 +386,14 @@ def _compile_multi_inbetween_frames(col,
378386
the second Action is for validation of inputs.
379387
:rtype: (Action, Action)
380388
"""
389+
assert isinstance(global_solve, bool)
390+
assert isinstance(eval_complex_graphs, bool)
391+
assert isinstance(anim_iter_num, int)
392+
assert isinstance(remove_unused_objects, bool)
393+
assert isinstance(precomputed_data, dict)
394+
assert isinstance(withtest, bool)
395+
assert isinstance(verbose, bool)
396+
381397
if global_solve is True:
382398
# Do Global Solve with all frames.
383399
sol = solverstep.SolverStep()
@@ -499,7 +515,7 @@ def _compile_multi_frame(col,
499515
:param root_frame_strategy:
500516
The strategy ordering of root frames and how to solve them.
501517
Value must be one in ROOT_FRAME_STRATEGY_VALUE_LIST.
502-
:type root_frame_strategy:
518+
:type root_frame_strategy: ROOT_FRAME_STRATEGY_*
503519
504520
:param triangulate_bundles:
505521
If True, unlocked bundles will be triangulated before being
@@ -530,6 +546,20 @@ def _compile_multi_frame(col,
530546
the second Action is for validation of inputs.
531547
:rtype: (Action, Action)
532548
"""
549+
assert isinstance(auto_attr_blocks, bool)
550+
assert isinstance(block_iter_num, int)
551+
assert isinstance(only_root_frames, bool)
552+
assert isinstance(root_iter_num, int)
553+
assert isinstance(anim_iter_num, int)
554+
assert isinstance(global_solve, bool)
555+
assert root_frame_strategy in const.ROOT_FRAME_STRATEGY_VALUE_LIST
556+
assert isinstance(triangulate_bundles, bool)
557+
assert isinstance(use_euler_filter, bool)
558+
assert isinstance(remove_unused_objects, bool)
559+
assert isinstance(precomputed_data, dict)
560+
assert isinstance(withtest, bool)
561+
assert isinstance(verbose, bool)
562+
533563
# Get Frame numbers.
534564
root_frame_list_num = [x.get_number() for x in root_frame_list]
535565
frame_list_num = [x.get_number() for x in frame_list]
@@ -727,8 +757,8 @@ def _compile_single_frame(col,
727757
block_iter_num,
728758
lineup_iter_num,
729759
auto_attr_blocks,
730-
precomputed_data,
731760
remove_unused_objects,
761+
precomputed_data,
732762
withtest,
733763
verbose):
734764
"""
@@ -777,6 +807,14 @@ def _compile_single_frame(col,
777807
the second Action is for validation of inputs.
778808
:rtype: (Action, Action)
779809
"""
810+
assert isinstance(auto_attr_blocks, bool)
811+
assert isinstance(block_iter_num, int)
812+
assert isinstance(lineup_iter_num, int)
813+
assert isinstance(remove_unused_objects, bool)
814+
assert isinstance(precomputed_data, dict)
815+
assert isinstance(withtest, bool)
816+
assert isinstance(verbose, bool)
817+
780818
if auto_attr_blocks is True:
781819
meta_mkr_list, meta_attr_list = _split_mkr_attr_into_categories(
782820
mkr_list,

0 commit comments

Comments
 (0)