MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / and_

Function and_

src/licensedcode/_vendor/attr/_make.py:3099–3117  ·  view source on GitHub ↗

A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param callables validators: Arbitrary number of validators. .. versionadded:: 17.1.0

(*validators)

Source from the content-addressed store, hash-verified

3097
3098
3099def and_(*validators):
3100 """
3101 A validator that composes multiple validators into one.
3102
3103 When called on a value, it runs all wrapped validators.
3104
3105 :param callables validators: Arbitrary number of validators.
3106
3107 .. versionadded:: 17.1.0
3108 """
3109 vals = []
3110 for validator in validators:
3111 vals.extend(
3112 validator._validators
3113 if isinstance(validator, _AndValidator)
3114 else [validator]
3115 )
3116
3117 return _AndValidator(tuple(vals))
3118
3119
3120def pipe(*converters):

Callers 2

attribFunction · 0.85
validatorMethod · 0.85

Calls 1

_AndValidatorClass · 0.85

Tested by

no test coverage detected