Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseProcessor validators #27

Open
yakovistomin opened this issue May 27, 2020 · 0 comments
Open

BaseProcessor validators #27

yakovistomin opened this issue May 27, 2020 · 0 comments

Comments

@yakovistomin
Copy link
Collaborator

yakovistomin commented May 27, 2020

Необходимо добавить необязательный параметр validators: Optional[List[Callable]] в BaseProcessor

Пример использования:

IntegerProcessor(…., validators=[lambda x: x > 10, lambda x: x <= 1000])
StringProcessor(..., validators=[lambda x: x.startswith('a')])
DateProcessor(..., validators=[lambda x: x.year == 2000])

Валидируем значение, возвращаемое process_value. Если хоть один из валидаторов вернул False или вызвал исключение, то ColumnError(f'{value} is not valid')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant