Skip to content

Commit

Permalink
A few minor docstring edits + exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain MARIE committed Oct 10, 2019
1 parent 0386528 commit 1595f6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions valid8/common_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# 3. the syntax to describe several validation functions at once
VFDefinitionElement = Union[str, Type[ValidationFailure], ValidationCallableOrLambda]
"""This type represents one of the elements that can define a checker"""
"""This type represents one of the elements that can define a checker: help msg, failure type, callable"""

OneOrSeveralVFDefinitions = Union[ValidationFuncDefinition,
Iterable[ValidationFuncDefinition],
Expand Down Expand Up @@ -61,7 +61,7 @@ class FunctionDefinitionError(Exception):

supported_syntax = 'a callable, a tuple(callable, help_msg_str), a tuple(callable, failure_type), ' \
'tuple(callable, help_msg_str, failure_type), or a list of ' \
'several such elements. Tuples indicate an implicit `failure_raiser`. ' \
'several such elements. Dicts are supported too. Tuples indicate an implicit `failure_raiser`. ' \
'[mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead of ' \
'callables, they will be transformed to functions automatically.'

Expand Down Expand Up @@ -233,7 +233,7 @@ def make_validation_func_callables(*vf_definition, # type: OneO
:param vf_definition: the base validation function or list of base validation functions to use. A callable, a
tuple(callable, help_msg_str), a tuple(callable, failure_type), tuple(callable, help_msg_str, failure_type)
or a list of several such elements.
or a list of several such elements. A dict can also be used (see doc).
Tuples indicate an implicit `failure_raiser`.
[mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead
of callables, they will be transformed to functions automatically.
Expand All @@ -246,7 +246,7 @@ def make_validation_func_callables(*vf_definition, # type: OneO

# handle the case where vf_definition is not yet a list or is empty or none
if len(vf_definition) == 0:
raise ValueError('mandatory vf_definition is None')
raise ValueError('No validation function definition was provided')
elif len(vf_definition) == 1:
# a single item has been received. If it is not a tuple, use it: it might be a list or dict
single_entry = vf_definition[0]
Expand Down
2 changes: 1 addition & 1 deletion valid8/entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def my_validator(x):
:param validation_func: the base validation function or list of base validation functions to use. A callable, a
tuple(callable, help_msg_str), a tuple(callable, failure_type), tuple(callable, help_msg_str, failure_type)
or a list of several such elements.
or a list of several such elements. A dict can also be used (see doc).
Tuples indicate an implicit `failure_raiser`.
[mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead
of callables, they will be transformed to functions automatically.
Expand Down

0 comments on commit 1595f6e

Please sign in to comment.