a
    ¡˜ëjL`  ã                   @  sh  d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ ejrzdd	lmZ e d
¡ZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZejdejd�ZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZ G dd „ d eƒZ!G d!d"„ d"eƒZ"G d#d$„ d$e"ƒZ#G d%d&„ d&e!ƒZ$dS )'z-Validation classes for various types of data.é    )ÚannotationsN)ÚABCÚabstractmethod)Úzip_longest)Ú
attrgetter)ÚValidationError)ÚChangedInMarshmallow4Warning)ÚtypesÚ_Tc                   @  sN   e Zd ZU dZdZded< ddœdd„Zddœd	d
„Zedddœdd„ƒZ	dS )Ú	ValidatorzÆAbstract base class for validators.

    .. note::
        This class does not provide any validation behavior. It is only used to
        add a useful `__repr__` implementation for validators.
    Nú
str | NoneÚerrorÚstr©Úreturnc                 C  s8   |   ¡ }|r|› d�nd}d| jj› d|› d| j›d�S )Nú, Ú ú<ú(zerror=z)>)Ú
_repr_argsÚ	__class__Ú__name__r   )ÚselfÚargs© r   úS/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/marshmallow/validate.pyÚ__repr__   s    zValidator.__repr__c                 C  s   dS )zbA string representation of the args passed to this validator. Used by
        `__repr__`.
        r   r   ©r   r   r   r   r   %   s    zValidator._repr_argsú
typing.Any©Úvaluer   c                 C  s   d S ©Nr   ©r   r    r   r   r   Ú__call__+   s    zValidator.__call__)
r   Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r   r   r#   r   r   r   r   r      s   
r   c                   @  sH   e Zd ZdZdZddœdddœdd	„Zd
dœdd„Zdddœdd„ZdS )ÚAnda3  Compose multiple validators and combine their error messages.

    Example: ::

        from marshmallow import validate, ValidationError


        def is_even(value):
            if value % 2 != 0:
                raise ValidationError("Not an even value.")


        validator = validate.And(validate.Range(min=0), is_even)
        validator(-1)
        # ValidationError: ['Must be greater than or equal to 0.', 'Not an even value.']

    :param validators: Validators to combine.
    :param error: Error message to use when a validator returns ``False``.
    zInvalid value.N©r   ztypes.Validatorr   )Ú
validatorsr   c                G  s   t |ƒ| _|p| j| _d S r!   )Útupler*   Údefault_error_messager   )r   r   r*   r   r   r   Ú__init__F   s    
zAnd.__init__r   r   c                 C  s   d| j ›�S )Nzvalidators=)r*   r   r   r   r   r   J   s    zAnd._repr_argsr   r   c                 C  s¼   g }i }| j D ]”}z8||ƒ}t|tƒsH|du rHtjdtdd� t| jƒ‚W q ty  } z>| |j	¡ t|j
tƒr€| |j
¡ n| |j
¡ W Y d }~qd }~0 0 q|r¸t|fi |¤Ž‚|S )NFzTReturning `False` from a validator is deprecated. Raise a `ValidationError` instead.é   )Ú
stacklevel)r*   Ú
isinstancer   ÚwarningsÚwarnr   r   r   ÚupdateÚkwargsÚmessagesÚdictÚappendÚextend)r   r    Úerrorsr4   Z	validatorÚrÚerrr   r   r   r#   M   s(    
ü$zAnd.__call__)r   r$   r%   r&   r,   r-   r   r#   r   r   r   r   r(   /   s
   r(   c                   @  s€   e Zd ZdZG dd„ dƒZeƒ ZdZh d£Zdddddd	œd
d
dd
dd	œdd„Zddœdd„Z	ddœdd„Z
dddœdd„ZdS )ÚURLa   Validate a URL.

    :param relative: Whether to allow relative URLs.
    :param absolute: Whether to allow absolute URLs.
    :param error: Error message to raise in case of a validation error.
        Can be interpolated with `{input}`.
    :param schemes: Valid schemes. By default, ``http``, ``https``,
        ``ftp``, and ``ftps`` are allowed.
    :param require_tld: Whether to reject non-FQDN hostnames.
    c                   @  s<   e Zd Zdd„ Zdddddœdd„Zdddddœdd	„Zd
S )zURL.RegexMemoizerc                 C  s
   i | _ d S r!   )Ú	_memoizedr   r   r   r   r-   s   s    zURL.RegexMemoizer.__init__Úboolztyping.Pattern)ÚrelativeÚabsoluteÚrequire_tldr   c                C  st   g d¢}|s|  d¡ d dddd |¡dd	f¡}d
}|rV|rLd|d|f}q`d|f}n
d||f}t d |¡tj¡S )N)zM(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)Ú	localhostz"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}z\[[A-F0-9]*:[A-F0-9:]+\]z+(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.?)r   z(?:[a-z0-9\.\-\+]*)://z1(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?z(?:ú|ú)z	(?::\d+)?z(?:/?|[/?]\S+)\Zz^(z)?ú^)r7   ÚjoinÚreÚcompileÚ
IGNORECASE)r   r?   r@   rA   Zhostname_variantsZabsolute_partZrelative_partÚpartsr   r   r   Ú_regex_generatorv   s.    
ôÿü

z"URL.RegexMemoizer._regex_generatorc                C  s4   |||f}|| j vr*| j|||d�| j |< | j | S )N©r?   r@   rA   )r=   rK   )r   r?   r@   rA   Úkeyr   r   r   r#   ¬   s    

ÿzURL.RegexMemoizer.__call__N)r   r$   r%   r-   rK   r#   r   r   r   r   ÚRegexMemoizerr   s   6rN   zNot a valid URL.>   ÚhttpsÚftpÚhttpZftpsFTN)r?   r@   ÚschemesrA   r   r>   ztypes.StrSequenceOrSet | Noner   c                C  s>   |s|st dƒ‚|| _|| _|p$| j| _|p0| j| _|| _d S )Nz>URL validation cannot set both relative and absolute to False.)Ú
ValueErrorr?   r@   Údefault_messager   Údefault_schemesrR   rA   )r   r?   r@   rR   rA   r   r   r   r   r-   ¼   s    	ÿzURL.__init__r   r   c                 C  s   d| j ›d| j›�S )Nz	relative=z, absolute=)r?   r@   r   r   r   r   r   Ï   s    zURL._repr_argsc                 C  s   | j j|d�S ©N)Úinput©r   Úformatr"   r   r   r   Ú_format_errorÒ   s    zURL._format_errorr   c                 C  sž   |   |¡}|st|ƒ‚d }d|v rF| d¡d  ¡ }|| jvrFt|ƒ‚| j| j| j| jd�}|dkr„| 	d¡r„| 
| ddd¡¡}n
| 
|¡}|sšt|ƒ‚|S )Nz://r   rL   Úfilezfile:///zfile://localhost/é   )rZ   r   ÚsplitÚlowerrR   Ú_regexr?   r@   rA   Ú
startswithÚsearchÚreplace)r   r    ÚmessageÚschemeÚregexÚmatchedr   r   r   r#   Õ   s"    

ÿ
zURL.__call__)r   r$   r%   r&   rN   r_   rT   rU   r-   r   rZ   r#   r   r   r   r   r<   f   s   Eùr<   c                   @  st   e Zd ZdZe dejejB ¡Ze dejejB ¡Z	dZ
dZddœddœd	d
„Zdddœdd„Zdddœdd„ZdS )ÚEmailz”Validate an email address.

    :param error: Error message to raise in case of a validation error. Can be
        interpolated with `{input}`.
    zˆ(^[-!#$%&'*+/=?^`{}|~\w]+(\.[-!#$%&'*+/=?^`{}|~\w]+)*\Z|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)z”(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})\Z|^\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]\Z)rB   zNot a valid email address.Nr)   r   c                C  s   |p| j | _d S r!   )rT   r   )r   r   r   r   r   r-     s    zEmail.__init__r   r   c                 C  s   | j j|d�S rV   rX   r"   r   r   r   rZ     s    zEmail._format_errorc                 C  sœ   |   |¡}|rd|vrt|ƒ‚| dd¡\}}| j |¡sBt|ƒ‚|| jvr˜| j |¡s˜z| d¡ d¡}W n t	y~   Y n0 | j |¡r�|S t|ƒ‚|S )Nú@r\   ÚidnaÚascii)
rZ   r   ÚrsplitÚ
USER_REGEXÚmatchÚDOMAIN_WHITELISTÚDOMAIN_REGEXÚencodeÚdecodeÚUnicodeError)r   r    rc   Z	user_partZdomain_partr   r   r   r#     s     

zEmail.__call__)r   r$   r%   r&   rG   rH   rI   ÚUNICODErl   ro   rn   rT   r-   rZ   r#   r   r   r   r   rg   ò   s   
û
ù
rg   c                   @  sz   e Zd ZdZdZdZdZdZdZdZ	dZ
dd
d
d	dœddddœdd„Zddœdd„Zddddœdd„Zdddœdd„Zd	S )ÚRangea-  Validator which succeeds if the value passed to it is within the specified
    range. If ``min`` is not specified, or is specified as `None`,
    no lower bound exists. If ``max`` is not specified, or is specified as `None`,
    no upper bound exists. The inclusivity of the bounds (if they exist) is configurable.
    If ``min_inclusive`` is not specified, or is specified as `True`, then
    the ``min`` bound is included in the range. If ``max_inclusive`` is not specified,
    or is specified as `True`, then the ``max`` bound is included in the range.

    :param min: The minimum value (lower bound). If not provided, minimum
        value will not be checked.
    :param max: The maximum value (upper bound). If not provided, maximum
        value will not be checked.
    :param min_inclusive: Whether the `min` bound is included in the range.
    :param max_inclusive: Whether the `max` bound is included in the range.
    :param error: Error message to raise in case of a validation error.
        Can be interpolated with `{input}`, `{min}` and `{max}`.
    zMust be {min_op} {{min}}.zMust be {max_op} {{max}}.z.Must be {min_op} {{min}} and {max_op} {{max}}.zgreater than or equal tozgreater thanzless than or equal toz	less thanNT)Úmin_inclusiveÚmax_inclusiver   r>   r   c                C  sŒ   || _ || _|| _|| _|| _| jj| jr0| jn| jd�| _| j	j| jrN| j
n| jd�| _	| jj| jrl| jn| j| jr|| j
n| jd�| _d S )N)Úmin_op)Úmax_op)rw   rx   )ÚminÚmaxr   ru   rv   Úmessage_minrY   Úmessage_gteÚ
message_gtÚmessage_maxÚmessage_lteÚ
message_ltÚmessage_all)r   ry   rz   ru   rv   r   r   r   r   r-   J  s    	ÿÿþzRange.__init__r   r   c                 C  s$   d| j ›d| j›d| j›d| j›�S )Númin=ú, max=z, min_inclusive=z, max_inclusive=)ry   rz   ru   rv   r   r   r   r   r   e  s    zRange._repr_argsr
   ©r    rc   r   c                 C  s   | j p|j|| j| jd�S )N)rW   ry   rz   )r   rY   ry   rz   ©r   r    rc   r   r   r   rZ   h  s    zRange._format_errorr   c                 C  sœ   | j d urL| jr|| j k rLn
|| j krL| jd u r6| jn| j}t|  ||¡ƒ‚| jd ur˜| jrh|| jkr˜n
|| jkr˜| j d u r‚| jn| j}t|  ||¡ƒ‚|S r!   )	ry   ru   rz   r{   r�   r   rZ   rv   r~   r…   r   r   r   r#   k  s&    
ÿÿÿ
ÿÿÿzRange.__call__)NN)r   r$   r%   r&   r{   r~   r�   r|   r}   r   r€   r-   r   rZ   r#   r   r   r   r   rt   .  s$     ýùrt   Ú_SizedT)Úboundc                   @  sn   e Zd ZdZdZdZdZdZddddœdddd	d
œdd„Zddœdd„Z	ddddœdd„Z
dddœdd„ZdS )ÚLengthah  Validator which succeeds if the value passed to it has a
    length between a minimum and maximum. Uses len(), so it
    can work for strings, lists, or anything with length.

    :param min: The minimum length. If not provided, minimum length
        will not be checked.
    :param max: The maximum length. If not provided, maximum length
        will not be checked.
    :param equal: The exact length. If provided, maximum and minimum
        length will not be checked.
    :param error: Error message to raise in case of a validation error.
        Can be interpolated with `{input}`, `{min}` and `{max}`.
    z"Shorter than minimum length {min}.z!Longer than maximum length {max}.z'Length must be between {min} and {max}.zLength must be {equal}.N)Úequalr   z
int | Noner   )ry   rz   r‰   r   c                C  s8   |d urt ||gƒrtdƒ‚|| _|| _|| _|| _d S )NzVThe `equal` parameter was provided, maximum or minimum parameter must not be provided.)ÚanyrS   ry   rz   r   r‰   )r   ry   rz   r‰   r   r   r   r   r-   ’  s    ÿzLength.__init__r   r   c                 C  s   d| j ›d| j›d| j›�S )Nr‚   rƒ   z, equal=)ry   rz   r‰   r   r   r   r   r   ¥  s    zLength._repr_argsr†   r„   c                 C  s   | j p|j|| j| j| jd�S )N)rW   ry   rz   r‰   )r   rY   ry   rz   r‰   r…   r   r   r   rZ   ¨  s    
ÿzLength._format_errorr   c                 C  sª   t |ƒ}| jd ur2|| jkr.t|  || j¡ƒ‚|S | jd url|| jk rl| jd u rV| jn| j}t|  ||¡ƒ‚| jd ur¦|| jkr¦| jd u r�| j	n| j}t|  ||¡ƒ‚|S r!   )
Úlenr‰   r   rZ   Úmessage_equalry   rz   r{   r�   r~   )r   r    Úlengthrc   r   r   r   r#   ­  s    

zLength.__call__)NN)r   r$   r%   r&   r{   r~   r�   rŒ   r-   r   rZ   r#   r   r   r   r   rˆ   ~  s     ýúrˆ   c                   @  sV   e Zd ZdZdZddœddœdd„Zdd	œd
d„Zdddœdd„Zdddœdd„ZdS )ÚEquala  Validator which succeeds if the ``value`` passed to it is
    equal to ``comparable``.

    :param comparable: The object to compare to.
    :param error: Error message to raise in case of a validation error.
        Can be interpolated with `{input}` and `{other}`.
    zMust be equal to {other}.Nr)   r   c                C  s   || _ |p| j| _d S r!   )Ú
comparablerT   r   )r   r�   r   r   r   r   r-   Ë  s    zEqual.__init__r   r   c                 C  s   d| j ›�S )Nzcomparable=)r�   r   r   r   r   r   Ï  s    zEqual._repr_argsr
   r   c                 C  s   | j j|| jd�S )N)rW   Úother)r   rY   r�   r"   r   r   r   rZ   Ò  s    zEqual._format_errorc                 C  s   || j krt|  |¡ƒ‚|S r!   )r�   r   rZ   r"   r   r   r   r#   Õ  s    
zEqual.__call__©	r   r$   r%   r&   rT   r-   r   rZ   r#   r   r   r   r   rŽ   À  s   rŽ   c                   @  s€   e Zd ZdZdZdddœdddd	œd
d„Zddœdd„Zdddœdd„Zej	dddœdd„ƒZ
ej	dddœdd„ƒZ
dd„ Z
dS )ÚRegexpa  Validator which succeeds if the ``value`` matches ``regex``.

    .. note::

        Uses `re.match`, which searches for a match at the beginning of a string.

    :param regex: The regular expression string to use. Can also be a compiled
        regular expression pattern.
    :param flags: The regexp flags to use, for example re.IGNORECASE. Ignored
        if ``regex`` is not a string.
    :param error: Error message to raise in case of a validation error.
        Can be interpolated with `{input}` and `{regex}`.
    z'String does not match expected pattern.r   Nr)   zstr | bytes | typing.PatternÚintr   )re   Úflagsr   c                C  s0   t |ttfƒrt ||¡n|| _|p(| j| _d S r!   )r0   r   ÚbytesrG   rH   re   rT   r   )r   re   r”   r   r   r   r   r-   ì  s    ÿzRegexp.__init__r   r   c                 C  s   d| j ›�S )Nzregex=)re   r   r   r   r   r   ø  s    zRegexp._repr_argszstr | bytesr   c                 C  s   | j j|| jjd�S )N)rW   re   )r   rY   re   Úpatternr"   r   r   r   rZ   û  s    zRegexp._format_errorc                 C  s   d S r!   r   r"   r   r   r   r#   þ  s    zRegexp.__call__r•   c                 C  s   d S r!   r   r"   r   r   r   r#     s    c                 C  s"   | j  |¡d u rt|  |¡ƒ‚|S r!   )re   rm   r   rZ   r"   r   r   r   r#     s    )r   )r   r$   r%   r&   rT   r-   r   rZ   ÚtypingÚoverloadr#   r   r   r   r   r’   Û  s    ýûr’   c                   @  sX   e Zd ZdZdZddœdddœdd	„Zdd
œdd„Zdddœdd„Zdddœdd„ZdS )Ú	Predicateañ  Call the specified ``method`` of the ``value`` object. The
    validator succeeds if the invoked method returns an object that
    evaluates to True in a Boolean context. Any additional keyword
    argument will be passed to the method.

    :param method: The name of the method to invoke.
    :param error: Error message to raise in case of a validation error.
        Can be interpolated with `{input}` and `{method}`.
    :param kwargs: Additional keyword arguments to pass to the method.
    úInvalid input.Nr)   r   r   )Úmethodr   c                K  s   || _ |p| j| _|| _d S r!   )r›   rT   r   r4   )r   r›   r   r4   r   r   r   r-     s    zPredicate.__init__r   c                 C  s   d| j ›d| j›�S )Nzmethod=z	, kwargs=)r›   r4   r   r   r   r   r     s    zPredicate._repr_argsr   r   c                 C  s   | j j|| jd�S )N)rW   r›   )r   rY   r›   r"   r   r   r   rZ   !  s    zPredicate._format_errorr
   c                 C  s.   t || jƒ}|f i | j¤Žs*t|  |¡ƒ‚|S r!   )Úgetattrr›   r4   r   rZ   )r   r    r›   r   r   r   r#   $  s    zPredicate.__call__r‘   r   r   r   r   r™     s   r™   c                   @  sV   e Zd ZdZdZddœdddœdd	„Zd
dœdd„Zd
dœdd„Zdddœdd„ZdS )ÚNoneOfzüValidator which fails if ``value`` is a member of ``iterable``.

    :param iterable: A sequence of invalid values.
    :param error: Error message to raise in case of a validation error. Can be
        interpolated using `{input}` and `{values}`.
    rš   Nr)   útyping.Iterabler   )Úiterabler   c                C  s.   || _ d dd„ | j D ƒ¡| _|p&| j| _d S )Nr   c                 s  s   | ]}t |ƒV  qd S r!   ©r   )Ú.0Zeachr   r   r   Ú	<genexpr>9  ó    z"NoneOf.__init__.<locals>.<genexpr>)rŸ   rF   Úvalues_textrT   r   )r   rŸ   r   r   r   r   r-   7  s    zNoneOf.__init__r   r   c                 C  s   d| j ›�S )Nz	iterable=)rŸ   r   r   r   r   r   <  s    zNoneOf._repr_argsc                 C  s   | j j|| jd�S )N)rW   Úvalues)r   rY   r¤   r"   r   r   r   rZ   ?  s    zNoneOf._format_errorr   r   c                 C  s4   z|| j v rt|  |¡ƒ‚W n ty.   Y n0 |S r!   )rŸ   r   rZ   Ú	TypeErrorr"   r   r   r   r#   B  s    
zNoneOf.__call__r‘   r   r   r   r   r�   -  s   r�   c                   @  sn   e Zd ZdZdZdddœddddœd	d
„Zddœdd„Zddœdd„Zdddœdd„Ze	fdddœdd„Z
dS )ÚOneOfaP  Validator which succeeds if ``value`` is a member of ``choices``.

    :param choices: A sequence of valid values.
    :param labels: Optional sequence of labels to pair with the choices.
    :param error: Error message to raise in case of a validation error. Can be
        interpolated with `{input}`, `{choices}` and `{labels}`.
    zMust be one of: {choices}.Nr)   rž   ztyping.Iterable[str] | Noner   )ÚchoicesÚlabelsr   c                C  sX   || _ d dd„ | j D ƒ¡| _|d ur*|ng | _d dd„ | jD ƒ¡| _|pP| j| _d S )Nr   c                 s  s   | ]}t |ƒV  qd S r!   r    )r¡   Úchoicer   r   r   r¢   _  r£   z!OneOf.__init__.<locals>.<genexpr>c                 s  s   | ]}t |ƒV  qd S r!   r    )r¡   Úlabelr   r   r   r¢   a  r£   )r¨   rF   Úchoices_textr©   Úlabels_textrT   r   )r   r¨   r©   r   r   r   r   r-   W  s
    zOneOf.__init__r   r   c                 C  s   d| j ›d| j›�S )Nzchoices=z	, labels=)r¨   r©   r   r   r   r   r   d  s    zOneOf._repr_argsc                 C  s   | j j|| j| jd�S )N)rW   r¨   r©   )r   rY   r¬   r­   r"   r   r   r   rZ   g  s    
ÿzOneOf._format_errorr   r   c              
   C  sV   z|| j vrt|  |¡ƒ‚W n4 tyP } zt|  |¡ƒ|‚W Y d }~n
d }~0 0 |S r!   )r¨   r   rZ   r¦   )r   r    r   r   r   r   r#   l  s    
&zOneOf.__call__z/str | typing.Callable[[typing.Any], typing.Any]z'typing.Iterable[tuple[typing.Any, str]])Úvaluegetterr   c                   s8   t ˆ ƒrˆ ntˆ ƒ‰ t| j| jdd�}‡ fdd„|D ƒS )a  Return a generator over the (value, label) pairs, where value
        is a string associated with each choice. This convenience method
        is useful to populate, for instance, a form select field.

        :param valuegetter: Can be a callable or a string. In the former case, it must
            be a one-argument callable which returns the value of a
            choice. In the latter case, the string specifies the name
            of an attribute of the choice objects. Defaults to `str()`
            or `str()`.
        r   )Ú	fillvaluec                 3  s   | ]\}}ˆ |ƒ|fV  qd S r!   r   )r¡   rª   r«   ©r®   r   r   r¢   †  r£   z OneOf.options.<locals>.<genexpr>)Úcallabler   r   r¨   r©   )r   r®   Úpairsr   r°   r   Úoptionsu  s    zOneOf.options)N)r   r$   r%   r&   rT   r-   r   rZ   r#   r   r³   r   r   r   r   r§   L  s    ýûþr§   c                      s:   e Zd ZdZdZddœ‡ fdd„Zdddœd	d
„Z‡  ZS )ÚContainsOnlya1  Validator which succeeds if ``value`` is a sequence and each element
    in the sequence is also in the sequence passed as ``choices``. Empty input
    is considered valid.

    :param choices: Same as :class:`OneOf`.
    :param labels: Same as :class:`OneOf`.
    :param error: Same as :class:`OneOf`.

    .. versionchanged:: 3.0.0b2
        Duplicate values are considered valid.
    .. versionchanged:: 3.0.0b2
        Empty input is considered valid. Use `validate.Length(min=1) <marshmallow.validate.Length>`
        to validate against empty inputs.
    z:One or more of the choices you made was not in: {choices}.r   r   c                   s    d  dd„ |D ƒ¡}tƒ  |¡S )Nr   c                 s  s   | ]}t |ƒV  qd S r!   r    ©r¡   Úvalr   r   r   r¢   œ  r£   z-ContainsOnly._format_error.<locals>.<genexpr>©rF   ÚsuperrZ   ©r   r    Z
value_text©r   r   r   rZ   ›  s    zContainsOnly._format_errorútyping.Sequence[_T]r   c                 C  s&   |D ]}|| j vrt|  |¡ƒ‚q|S r!   )r¨   r   rZ   ©r   r    r¶   r   r   r   r#   Ÿ  s    
zContainsOnly.__call__©r   r$   r%   r&   rT   rZ   r#   Ú__classcell__r   r   rº   r   r´   ‰  s   r´   c                      s:   e Zd ZdZdZddœ‡ fdd„Zdddœd	d
„Z‡  ZS )ÚContainsNoneOfa)  Validator which fails if ``value`` is a sequence and any element
    in the sequence is a member of the sequence passed as ``iterable``. Empty input
    is considered valid.

    :param iterable: Same as :class:`NoneOf`.
    :param error: Same as :class:`NoneOf`.

    .. versionadded:: 3.6.0
    z5One or more of the choices you made was in: {values}.r   r   c                   s    d  dd„ |D ƒ¡}tƒ  |¡S )Nr   c                 s  s   | ]}t |ƒV  qd S r!   r    rµ   r   r   r   r¢   µ  r£   z/ContainsNoneOf._format_error.<locals>.<genexpr>r·   r¹   rº   r   r   rZ   ´  s    zContainsNoneOf._format_errorr»   r   c                 C  s&   |D ]}|| j v rt|  |¡ƒ‚q|S r!   )rŸ   r   rZ   r¼   r   r   r   r#   ¸  s    
zContainsNoneOf.__call__r½   r   r   rº   r   r¿   §  s   
r¿   )%r&   Ú
__future__r   rG   r—   r1   Úabcr   r   Ú	itertoolsr   Úoperatorr   Zmarshmallow.exceptionsr   Zmarshmallow.warningsr   ÚTYPE_CHECKINGZmarshmallowr	   ÚTypeVarr
   r   r(   r<   rg   rt   ÚSizedr†   rˆ   rŽ   r’   r™   r�   r§   r´   r¿   r   r   r   r   Ú<module>   s6   
7 <MB0"=