Skip to content

Commit a3f9290

Browse files
committed
adding better comments
1 parent 68e838f commit a3f9290

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pydra/engine/helpers.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def make_klass(spec):
280280
def custom_validator(instance, attribute, value):
281281
"""simple custom validation
282282
take into account ty.Union, ty.List, ty.Dict (but only one level depth)
283+
adding an additional validator, if allowe_values provided
283284
"""
284285
validators = []
285286
tp_attr = attribute.type
@@ -333,6 +334,12 @@ def custom_validator(instance, attribute, value):
333334

334335

335336
def _type_validator(instance, attribute, value, tp, cont_type):
337+
""" creating a customized type validator,
338+
uses validator.deep_iterable/mapping if the field is a container
339+
(i.e. ty.List or ty.Dict),
340+
it also tries to guess when the value is a list due to the splitter
341+
and validates the elements
342+
"""
336343
if cont_type is None or cont_type is ty.Union:
337344
# if tp is not (list,), we are assuming that the value is a list
338345
# due to the splitter, so checking the member types
@@ -364,7 +371,7 @@ def _type_validator(instance, attribute, value, tp, cont_type):
364371

365372

366373
def _types_updates(tp_list, name):
367-
"""updating the tuple with possible types"""
374+
"""updating the type's tuple with possible additional types"""
368375
tp_upd_list = []
369376
check = True
370377
for tp_el in tp_list:
@@ -379,8 +386,9 @@ def _types_updates(tp_list, name):
379386

380387

381388
def _single_type_update(tp, name, simplify=False):
382-
""" updating a single type - e.g. adding bytes if str is required
389+
""" updating a single type with other related types - e.g. adding bytes for str
383390
if simplify is True, than changing typing.List to list etc.
391+
(assuming that I validate only one depth, so have to simplify at some point)
384392
"""
385393
if isinstance(tp, type) or tp in [File, Directory]:
386394
if tp is str:

0 commit comments

Comments
 (0)