Mini Kabibi Habibi

Current Path : C:/Users/ITO/AppData/Local/Programs/GIMP 2/lib/python2.7/site-packages/attr/
Upload File :
Current File : C:/Users/ITO/AppData/Local/Programs/GIMP 2/lib/python2.7/site-packages/attr/validators.pyo

�
+I�]c	@`s[dZddlmZmZmZddlZddlmZmZm	Z	m
Z
ddlmZddd	d
ddd
ddg	Z
e
dedede�defd��Y�Zd�Ze
dede�defd��Y�Zddd�Ze
dedede�defd��Y�Zd�Ze
dedede�defd��Y�Zd�Ze
dedede�d efd!��Y�Zd"�Ze
dedede�d#efd$��Y�Zd%�Ze
dedede�d&efd'��Y�Zdd(�Ze
dedede�d)efd*��Y�Z dd+�Z!dS(,s
Commonly useful validators.
i(tabsolute_importtdivisiontprint_functionNi(t
_AndValidatortand_tattribtattrs(tNotCallableErrorRt
deep_iterabletdeep_mappingtin_tinstance_oftis_callablet
matches_retoptionaltprovidestreprtslotsthasht_InstanceOfValidatorcB`s#eZe�Zd�Zd�ZRS(c
C`sXt||j�sTtdjd|jd|jd|jd|�||j|��ndS(sP
        We use a callable class to be able to change the ``__repr__``.
        s?'{name}' must be {type!r} (got {value!r} that is a {actual!r}).tnamettypetactualtvalueN(t
isinstanceRt	TypeErrortformatRt	__class__(tselftinsttattrR((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyt__call__s				cC`sdjd|j�S(Ns)<instance_of validator for type {type!r}>R(RR(R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyt__repr__0s	(t__name__t
__module__RRRR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRs		cC`s
t|�S(s�
    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((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR6s
tfrozent_MatchesReValidatorcB`s5eZe�Ze�Ze�Zd�Zd�ZRS(cC`sO|j|�sKtdjd|jd|jjd|�||j|��ndS(sP
        We use a callable class to be able to change the ``__repr__``.
        s7'{name}' must match regex {regex!r} ({value!r} doesn't)RtregexRN(t
match_funct
ValueErrorRRR%tpattern(RRRR((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRLs	cC`sdjd|j�S(Ns,<matches_re validator for pattern {regex!r}>R%(RR%(R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR [s	(R!R"RR%tflagsR&RR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR$Fs
				cC`s�ttdd�}|dtjtjf}||krktddjtd�t|�D���f��ntj	||�}|tjkr�|j}nQ|tjkr�|j}n6|r�|j
}n$tj	dj|�|�}|j}t|||�S(s}
    A validator that raises `ValueError` if the initializer is called
    with a string that doesn't match *regex*.

    :param str regex: a regex string to match against
    :param int flags: flags that will be passed to the underlying re function
        (default 0)
    :param callable func: which underlying `re` function to call (options
        are `re.fullmatch`, `re.search`, `re.match`, default
        is ``None`` which means either `re.fullmatch` or an emulation of
        it on Python 2). For performance reasons, they won't be used directly
        but on a pre-`re.compile`\ ed pattern.

    .. versionadded:: 19.2.0
    t	fullmatchs'func' must be one of %s.s, cs`s$|]}|r|jpdVqdS(tNoneN(R!(t.0te((s7/mingw64/lib/python2.7/site-packages/attr/validators.pys	<genexpr>yss(?:{})\ZN(
tgetattrtreR+tsearchtmatchR'tjointsortedtsettcompileR*RR$(R%R)tfuncR*tvalid_funcsR(R&((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR
as$&	t_ProvidesValidatorcB`s#eZe�Zd�Zd�ZRS(cC`sO|jj|�sKtdjd|jd|jd|�||j|��ndS(sP
        We use a callable class to be able to change the ``__repr__``.
        s<'{name}' must provide {interface!r} which {value!r} doesn't.Rt	interfaceRN(R9t
providedByRRR(RRRR((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR�s	cC`sdjd|j�S(Ns0<provides validator for interface {interface!r}>R9(RR9(R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR �s	(R!R"RR9RR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR8�s		cC`s
t|�S(s
    A validator that raises a `TypeError` if the initializer is called
    with an object that does not provide the requested *interface* (checks are
    performed using ``interface.providedBy(value)`` (see `zope.interface
    <https://zopeinterface.readthedocs.io/en/latest/>`_).

    :param zope.interface.Interface interface: The interface to check for.

    :raises TypeError: With a human readable error message, the attribute
        (of type `attr.Attribute`), the expected interface, and the
        value it got.
    (R8(R9((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR�s
t_OptionalValidatorcB`s#eZe�Zd�Zd�ZRS(cC`s'|dkrdS|j|||�dS(N(R+t	validator(RRRR((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR�scC`sdjdt|j��S(Ns'<optional validator for {what} or None>twhat(RRR<(R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR �s	(R!R"RR<RR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR;�s		cC`s)t|t�rtt|��St|�S(s�
    A validator that makes an attribute optional.  An optional attribute is one
    which can be set to ``None`` in addition to satisfying the requirements of
    the sub-validator.

    :param validator: A validator (or a list of validators) that is used for
        non-``None`` values.
    :type validator: callable or `list` of callables.

    .. versionadded:: 15.1.0
    .. versionchanged:: 17.1.0 *validator* can be a list of validators.
    (RtlistR;R(R<((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR�s
t_InValidatorcB`s#eZe�Zd�Zd�ZRS(cC`sdy||jk}Wntk
r,t}nX|s`tdjd|jd|jd|���ndS(Ns/'{name}' must be in {options!r} (got {value!r})RtoptionsR(R@RtFalseR'RR(RRRRt
in_options((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR�s

	cC`sdjd|j�S(Ns(<in_ validator with options {options!r}>R@(RR@(R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR �s	(R!R"RR@RR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR?�s		
cC`s
t|�S(s�
    A validator that raises a `ValueError` if the initializer is called
    with a value that does not belong in the options provided.  The check is
    performed using ``value in options``.

    :param options: Allowed options.
    :type options: list, tuple, `enum.Enum`, ...

    :raises ValueError: With a human readable error message, the attribute (of
       type `attr.Attribute`), the expected options, and the value it
       got.

    .. versionadded:: 17.1.0
    (R?(R@((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR
�st_IsCallableValidatorcB`seZd�Zd�ZRS(c	C`sLt|�sHd}td|jd|jd|d|j�d|��ndS(sP
        We use a callable class to be able to change the ``__repr__``.
        s?'{name}' must be callable (got {value!r} that is a {actual!r}).tmsgRRRN(tcallableRRRR(RRRRtmessage((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRs	cC`sdS(Ns<is_callable validator>((R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR s(R!R"RR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRCs	cC`st�S(sw
    A validator that raises a `attr.exceptions.NotCallableError` if the
    initializer is called with a value for this particular attribute
    that is not callable.

    .. versionadded:: 19.1.0

    :raises `attr.exceptions.NotCallableError`: With a human readable error
        message containing the attribute (`attr.Attribute`) name,
        and the value it got.
    (RC(((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRst
_DeepIterablecB`sJeZede��Zedddee���Zd�Zd�Z	RS(R<tdefaultcC`sM|jdk	r%|j|||�nx!|D]}|j|||�q,WdS(sP
        We use a callable class to be able to change the ``__repr__``.
        N(titerable_validatorR+tmember_validator(RRRRtmember((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR.s
cC`sC|jdkrdndjd|j�}djd|d|j�S(Nts
 {iterable!r}titerablesJ<deep_iterable validator for{iterable_identifier} iterables of {member!r}>titerable_identifierRK(RIR+RRJ(RRN((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR 8s
	N(
R!R"RRRJR+RRIRR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRG's
	
cC`s
t||�S(s1
    A validator that performs deep validation of an iterable.

    :param member_validator: Validator to apply to iterable members
    :param iterable_validator: Validator to apply to iterable itself
        (optional)

    .. versionadded:: 19.1.0

    :raises TypeError: if any sub-validators fail
    (RG(RJRI((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyRGst_DeepMappingcB`s\eZede��Zede��Zedddee���Zd�Z	d�Z
RS(R<RHcC`sd|jdk	r%|j|||�nx8|D]0}|j|||�|j||||�q,WdS(sP
        We use a callable class to be able to change the ``__repr__``.
        N(tmapping_validatorR+t
key_validatortvalue_validator(RRRRtkey((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR\s

cC`sdjd|jd|j�S(NsA<deep_mapping validator for objects mapping {key!r} to {value!r}>RSR(RRQRR(R((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR gs	N(R!R"RRRQRRR+RRPRR (((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyROVs
	cC`st|||�S(s}
    A validator that performs deep validation of a dictionary.

    :param key_validator: Validator to apply to dictionary keys
    :param value_validator: Validator to apply to dictionary values
    :param mapping_validator: Validator to apply to top-level mapping
        attribute (optional)

    .. versionadded:: 19.1.0

    :raises TypeError: if any sub-validators fail
    (RO(RQRRRP((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyR	ms
("t__doc__t
__future__RRRR/t_makeRRRRt
exceptionsRt__all__RAtTruetobjectRRR$R+R
R8RR;RR?R
RCRRGRROR	(((s7/mingw64/lib/python2.7/site-packages/attr/validators.pyt<module>sJ"		-