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

Function max_len

src/attr/validators.py:554–564  ·  view source on GitHub ↗

A validator that raises `ValueError` if the initializer is called with a string or iterable that is longer than *length*. Args: length (int): Maximum length of the string or iterable .. versionadded:: 21.3.0

(length)

Source from the content-addressed store, hash-verified

552
553
554def max_len(length):
555 """
556 A validator that raises `ValueError` if the initializer is called
557 with a string or iterable that is longer than *length*.
558
559 Args:
560 length (int): Maximum length of the string or iterable
561
562 .. versionadded:: 21.3.0
563 """
564 return _MaxLengthValidator(length)
565
566
567@attrs(repr=False, frozen=True, slots=True)

Callers 3

TesterClass · 0.90
test_reprMethod · 0.90

Calls 1

_MaxLengthValidatorClass · 0.85

Tested by 2

test_reprMethod · 0.72