HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyc
�
1�3\c@`sEdZddlmZmZmZddlmZmZmZm	Z	ddddd	gZ
ed
edede�d
e
fd��Y�Zd�Zed
edede�de
fd��Y�Zd�Zed
edede�de
fd��Y�Zd�Zed
edede�de
fd��Y�Zd�ZdS(s
Commonly useful validators.
i(tabsolute_importtdivisiontprint_functioni(tattrt
attributestand_t
_AndValidatorRtin_tinstance_oftoptionaltprovidestreprtslotsthasht_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__(tselftinstRR((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyt__call__s	cC`sdjd|j�S(Ns)<instance_of validator for type {type!r}>R(RR(R((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyt__repr__$s	(t__name__t
__module__RRRR(((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyRs		
cC`s
t|�S(s�
    A validator that raises a :exc:`TypeError` if the initializer is called
    with a wrong type for this particular attribute (checks are perfomed 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((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR+s
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(Rt
providedByRRR(RRRR((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR?s
	cC`sdjd|j�S(Ns0<provides validator for interface {interface!r}>R(RR(R((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyRKs	(RRRRRR(((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR;s		cC`s
t|�S(s
    A validator that raises a :exc:`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 :class:`attr.Attribute`), the expected interface, and the
        value it got.
    (R(R((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR
Rs
t_OptionalValidatorcB`s#eZe�Zd�Zd�ZRS(cC`s'|dkrdS|j|||�dS(N(tNonet	validator(RRRR((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyRfscC`sdjdt|j��S(Ns'<optional validator for {what} or None>twhat(RRR"(R((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyRls	(RRRR"RR(((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR bs		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 :class:`list` of callables.

    .. versionadded:: 15.1.0
    .. versionchanged:: 17.1.0 *validator* can be a list of validators.
    (RtlistR R(R"((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR	ss
t_InValidatorcB`s#eZe�Zd�Zd�ZRS(cC`s@||jkr<tdjd|jd|jd|���ndS(Ns/'{name}' must be in {options!r} (got {value!r})RtoptionsR(R&t
ValueErrorRR(RRRR((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR�s	cC`sdjd|j�S(Ns(<in_ validator with options {options!r}>R&(RR&(R((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR�s	(RRRR&RR(((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR%�s		cC`s
t|�S(s�
    A validator that raises a :exc:`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, :class:`enum.Enum`, ...

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

    .. versionadded:: 17.1.0
    (R%(R&((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyR�sN(t__doc__t
__future__RRRt_makeRRRRt__all__tFalsetTruetobjectRRRR
R R	R%R(((sJ/usr/lib64/python2.7/site-packages/mercurial/thirdparty/attr/validators.pyt<module>s&"