Skip to content

Commit

Permalink
Merge pull request #319 from caracal-pipeline/remember
Browse files Browse the repository at this point in the history
parse element type as function option
  • Loading branch information
o-smirnov authored Jun 14, 2024
2 parents 49713d2 + ae5fca4 commit b5cacdb
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions scabha/schema_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,13 @@ def clickify_parameters(schemas: Union[str, Dict[str, Any]],
dtype = elem_type
elif policies.repeat == '[]': # else assume [X,Y] or X,Y syntax
dtype = str
validator = lambda ctx, param, value, etype=dtype, schema=schema: \
_validate_list(value, element_type=elem_type, schema=schema)
validator = lambda ctx, param, value, etype=dtype, schema=schema, _type=elem_type: \
_validate_list(value, element_type=_type, schema=schema)
elif policies.repeat is not None: # assume XrepY syntax
dtype = str
validator = lambda ctx, param, value, etype=dtype, schema=schema: \
_validate_list(value, element_type=elem_type, schema=schema,
print(elem_type)
validator = lambda ctx, param, value, etype=dtype, schema=schema, _type=elem_type: \
_validate_list(value, element_type=_type, schema=schema,
sep=policies.repeat, brackets=False)
else:
raise SchemaError(f"list-type parameter '{name}' does not have a repeat policy set")
Expand All @@ -237,13 +238,17 @@ def clickify_parameters(schemas: Union[str, Dict[str, Any]],
dtype = elem_types
elif policies.repeat == '[]': # else assume [X,Y] or X,Y syntax
dtype = str
validator = lambda ctx, param, value, etype=dtype, schema=schema: \
_validate_tuple(value, element_types=elem_types, schema=schema)
validator = lambda ctx, param, value, etype=dtype, \
schema=schema, _type=elem_types: \
_validate_tuple(value, element_types=_type,
schema=schema)
elif policies.repeat is not None: # assume XrepY syntax
dtype = str
validator = lambda ctx, param, value, etype=dtype, schema=schema: \
_validate_tuple(value, element_types=elem_types, schema=schema,
sep=policies.repeat, brackets=False)
validator = lambda ctx, param, value, etype=dtype, \
schema=schema, _type=elem_types: \
_validate_tuple(value, element_types=_type,
schema=schema,
sep=policies.repeat, brackets=False)
else:
raise SchemaError(f"tuple-type parameter '{name}' does not have a repeat policy set")
else:
Expand Down

0 comments on commit b5cacdb

Please sign in to comment.