/opt/alt/python38/lib/python3.8/site-packages/attr/__pycache__
Edit: /opt/alt/python38/lib/python3.8/site-packages/attr/__pycache__/validators.cpython-38.pyc (5621B)
U
#IGZ` @ s d Z ddlmZmZmZ ddlmZmZmZm Z ddddd gZ
e d
dddG d
d deZdd Z
e d
dddG dd deZdd Ze d
dddG dd deZdd Ze d
dddG dd deZdd ZdS )z
Commonly useful validators.
)absolute_importdivisionprint_function )
_AndValidatorand_attribattrsr in_instance_ofoptionalprovidesFT)reprslotshashc @ s" e Zd Ze Zdd Zdd ZdS )_InstanceOfValidatorc C s4 t || js0tdj|j| j|j|d|| j|dS )P
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/python38/lib/python3.8/site-packages/attr/validators.py__call__ s z_InstanceOfValidator.__call__c C s dj | jdS )Nz)
r )r r r r r r __repr__$ 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 :exc:`TypeError` if the initializer is called
with a wrong type for this particular attribute (checks are performed using
:func:`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 :class:`attr.Attribute`), the expected type, and the value it
got.
)r r" r r r r + s
c @ s" e Zd Ze Zdd Zdd ZdS )_ProvidesValidatorc C s0 | j |s,tdj|j| j |d|| j |dS )r z<'{name}' must provide {interface!r} which {value!r} doesn't.)r interfacer N)r) Z
providedByr r r r r r r r! ? s z_ProvidesValidator.__call__c C s dj | jdS )Nz0r) )r r) r# r r r r$ K s z_ProvidesValidator.__repr__N)r% r&