MCPcopy
hub / github.com/python-attrs/attrs / and_

Function and_

src/attr/_make.py:3326–3346  ·  view source on GitHub ↗

A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. Args: validators (~collections.abc.Iterable[typing.Callable]): Arbitrary number of validators. .. versionadded:: 17.1.0

(*validators)

Source from the content-addressed store, hash-verified

3324
3325
3326def and_(*validators):
3327 """
3328 A validator that composes multiple validators into one.
3329
3330 When called on a value, it runs all wrapped validators.
3331
3332 Args:
3333 validators (~collections.abc.Iterable[typing.Callable]):
3334 Arbitrary number of validators.
3335
3336 .. versionadded:: 17.1.0
3337 """
3338 vals = []
3339 for validator in validators:
3340 vals.extend(
3341 validator._validators
3342 if isinstance(validator, _AndValidator)
3343 else [validator]
3344 )
3345
3346 return _AndValidator(tuple(vals))
3347
3348
3349def pipe(*converters):

Callers 9

attribFunction · 0.85
validatorMethod · 0.85
deep_iterableFunction · 0.85
deep_mappingFunction · 0.85
test_successMethod · 0.85
test_failMethod · 0.85
CClass · 0.85

Calls 1

_AndValidatorClass · 0.85

Tested by 4

test_successMethod · 0.68
test_failMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…