/opt/alt/python37/lib/python3.7/site-packages/attr/__pycache__
Edit: /opt/alt/python37/lib/python3.7/site-packages/attr/__pycache__/validators.cpython-37.pyc (11646B)
B
^u_, @ s d Z ddlmZmZmZ ddlZddlmZmZm Z m
Z
ddlmZ ddd d
ddd
ddg Z
e
ddddG dd deZdd Ze
ddddG dd deZd,dd
Ze
ddddG dd deZdd Ze
ddddG dd deZdd Ze
ddddG d d! d!eZd"d
Ze
ddddG d#d$ d$eZd%d Ze
ddddG d&d' d'eZd-d(dZe
ddddG d)d* d*eZd.d+d ZdS )/z
Commonly useful validators.
)absolute_importdivisionprint_functionN )
_AndValidatorand_attribattrs)NotCallableErrorr
deep_iterabledeep_mappingin_instance_ofis_callable
matches_reoptionalprovidesFT)reprslotshashc @ s" e Zd Ze Zdd Zdd ZdS )_InstanceOfValidatorc C s4 t || js0tdj|j| j|j|d|| j|dS )zP
We use a callable class to be able to change the ``__repr__``.
z?'{name}' must be {type!r} (got {value!r} that is a {actual!r}).)nametypeactualvalueN)
isinstancer TypeErrorformatr __class__)selfinstattrr r" @/opt/alt/python37/lib/python3.7/site-packages/attr/validators.py__call__ s z_InstanceOfValidator.__call__c C s dj | jdS )Nz)
)r )r r )r r" r" r# __repr__0 s z_InstanceOfValidator.__repr__N)__name__
__module____qualname__r r r$ r% r" r" r" r# r s r c C s t | S )a
A validator that raises a `TypeError` if the initializer is called
with a wrong type for this particular attribute (checks are performed using
`isinstance` therefore it's also valid to pass a tuple of types).
:param type: The type to check for.
:type type: type or tuple of types
:raises TypeError: With a human readable error message, the attribute
(of type `attr.Attribute`), the expected type, and the value it
got.
)r )r r" r" r# r 6 s
)r frozenr c @ s. e Zd Ze Ze Ze Zdd Zdd ZdS )_MatchesReValidatorc C s0 | |s,tdj|j| jj|d|| j|dS )zP
We use a callable class to be able to change the ``__repr__``.
z7'{name}' must match regex {regex!r} ({value!r} doesn't))r regexr N)
match_func
ValueErrorr r r+ pattern)r r r! r r" r" r# r$ L s
z_MatchesReValidator.__call__c C s dj | jdS )Nz,)r+ )r r+ )r r" r" r# r% [ s z_MatchesReValidator.__repr__N) r&