Add object_type param to named object check#136
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #136 +/- ##
==========================================
+ Coverage 82.35% 82.43% +0.08%
==========================================
Files 31 31
Lines 2278 2289 +11
==========================================
+ Hits 1876 1887 +11
Misses 402 402
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
| depends on whether `seq_to_check` follows sequence of named | ||
| BaseObject format. | ||
|
|
||
| object_type : class, default=None |
There was a problem hiding this comment.
I would say that it can also be a tuple of class, this might be useful, e.g., in pipelines
| @@ -157,6 +174,7 @@ def check_sequence_named_objects( | |||
| seq_to_check: Union[Sequence[Tuple[str, BaseObject]], Dict[str, BaseObject]], | |||
There was a problem hiding this comment.
I really don't like this additional amount of non-functional code generated from overload, but it's a matter of taste and not a blocker for me...
| - If False, then whether or not the function returns True or False | ||
| depends on whether `seq_to_check` follows sequence of named BaseObject format. | ||
|
|
||
| object_type : class, default=None |
fkiraly
left a comment
There was a problem hiding this comment.
Happy to merge.
I would suggest to extend the contract to allow tuples of classes, which it already does anyway (but doesn't say so in the docstring, and doesn't check in the tests).
Why: pipelines can be heterogeneous, and we may like to cover that case.
|
Good point on tuples. Will update docstring and tests pre-merge. |
Reference Issues/PRs
Fixes #135
What does this implement/fix? Explain your changes.
Allows users to specify a specific class type to be used in the named object checks (
is_sequence_named_objectsandcheck_sequence_named_objects.Does your contribution introduce a new dependency? If yes, which one?
No
PR checklist
For all contributions
the PR topic is related to enhancement, CI/CD, maintenance, documentation, or a bug.
For code contributions