o
    (]^h  ã                   @   sè   d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ dZdZd	Zed
ƒZG dd„ deee  ƒZG dd„ deee  ƒZdeee ef deee  fdd„Zdeee ef deee  fdd„ZdS )é    )ÚSequenceÚTypeVarÚUnionÚcast)ÚBaseMatcher)Úall_of)ÚDescription)Úwrap_matcher)ÚMatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtÚTc                   @   sJ   e Zd Zdee ddfdd„Zdee defdd„Zd	e	ddfd
d„Z
dS )ÚIsSequenceContainingÚelement_matcherÚreturnNc                 C   s
   || _ d S ©N)r   )Úselfr   © r   úS/usr/lib/python3/dist-packages/hamcrest/library/collection/issequence_containing.pyÚ__init__   s   
zIsSequenceContaining.__init__Úitemc                 C   s:   z|D ]}| j  |¡r W dS qW dS  ty   Y dS w )NTF)r   ÚmatchesÚ	TypeError)r   r   Úelementr   r   r   Ú_matches   s   ÿÿþþzIsSequenceContaining._matchesÚdescriptionc                 C   s   |  d¡ | j¡ d S )Nza sequence containing )Úappend_textÚappend_description_ofr   ©r   r   r   r   r   Údescribe_to   s   
ÿz IsSequenceContaining.describe_to)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   Úboolr   r   r   r   r   r   r   r      s    	r   c                   @   sd   e Zd Zdee ddfdd„Zdee defdd„Zdee d	e	ddfd
d„Z
de	ddfdd„ZdS )ÚIsSequenceContainingEveryÚelement_matchersr   Nc                 G   s   dd„ |D ƒ}t |Ž | _d S )Nc                 S   s"   g | ]}t ttt  t|ƒƒ‘qS r   )r   r
   r   r   Úhas_item)Ú.0Úer   r   r   Ú
<listcomp>)   s   " z6IsSequenceContainingEvery.__init__.<locals>.<listcomp>)r   Úmatcher)r   r#   Ú	delegatesr   r   r   r   (   s   z"IsSequenceContainingEvery.__init__r   c                 C   s(   z	| j  t|ƒ¡W S  ty   Y dS w )NF)r(   r   Úlistr   )r   r   r   r   r   r   ,   s
   ÿz"IsSequenceContainingEvery._matchesÚmismatch_descriptionc                 C   s   | j  ||¡ d S r   )r(   Údescribe_mismatch)r   r   r+   r   r   r   r,   2   s   z+IsSequenceContainingEvery.describe_mismatchr   c                 C   s   | j  |¡ d S r   )r(   r   r   r   r   r   r   5   s   z%IsSequenceContainingEvery.describe_to)r   r   r    r
   r   r   r   r!   r   r   r,   r   r   r   r   r   r"   '   s
    r"   Úmatchr   c                 C   s   t t| ƒƒS )a   Matches if any element of sequence satisfies a given matcher.

    :param match: The matcher to satisfy, or an expected value for
        :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    This matcher iterates the evaluated sequence, searching for any element
    that satisfies a given matcher. If a matching element is found,
    ``has_item`` is satisfied.

    If the ``match`` argument is not a matcher, it is implicitly wrapped in an
    :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
    equality.

    )r   r	   )r-   r   r   r   r$   9   s   r$   Úitemsc                  G   s$   g }| D ]	}|  t|ƒ¡ qt|Ž S )aò  Matches if all of the given matchers are satisfied by any elements of
    the sequence.

    :param match1,...: A comma-separated list of matchers.

    This matcher iterates the given matchers, searching for any elements in the
    evaluated sequence that satisfy them. If each matcher is satisfied, then
    ``has_items`` is satisfied.

    Any argument that is not a matcher is implicitly wrapped in an
    :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
    equality.

    )Úappendr	   r"   )r.   Úmatchersr   r   r   r   Ú	has_itemsK   s   r1   N)Útypingr   r   r   r   Úhamcrest.core.base_matcherr   Úhamcrest.core.core.allofr   Úhamcrest.core.descriptionr   Ú"hamcrest.core.helpers.wrap_matcherr	   Úhamcrest.core.matcherr
   Ú
__author__Ú__copyright__Ú__license__r   r   r"   r$   r1   r   r   r   r   Ú<module>   s    &*