a
    P^N`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eee ef eee  dœdd„Zeee ef eee  dœ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                   @   sD   e Zd Zee ddœdd„Zee edœdd„Ze	ddœd	d
„Z
dS )ÚIsSequenceContainingN)Úelement_matcherÚreturnc                 C   s
   || _ d S ©N)r   )Úselfr   © r   úPlib/python3.9/site-packages/hamcrest/library/collection/issequence_containing.pyÚ__init__   s    zIsSequenceContaining.__init__©Úitemr   c                 C   s:   z"|D ]}| j  |¡r W dS qW n ty4   Y n0 dS )NTF)r   ÚmatchesÚ	TypeError)r   r   Úelementr   r   r   Ú_matches   s    zIsSequenceContaining._matches©Údescriptionr   c                 C   s   |  d¡ | j¡ d S )Nza sequence containing )Zappend_textZ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                   @   sZ   e Zd Zee ddœdd„Zee edœdd„Zee e	ddœd	d
„Z
e	ddœdd„ZdS )ÚIsSequenceContainingEveryN)Úelement_matchersr   c                 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>)   ó    z6IsSequenceContainingEvery.__init__.<locals>.<listcomp>)r   Úmatcher)r   r#   Z	delegatesr   r   r   r   (   s    z"IsSequenceContainingEvery.__init__r   c                 C   s,   z| j  t|ƒ¡W S  ty&   Y dS 0 d S )NF)r)   r   Úlistr   )r   r   r   r   r   r   ,   s    z"IsSequenceContainingEvery._matches)r   Úmismatch_descriptionr   c                 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$   )Úitemsr   c                  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.   Zmatchersr   r   r   r   Ú	has_itemsK   s    r0   N)Útypingr   r   r   r   Zhamcrest.core.base_matcherr   Zhamcrest.core.core.allofr   Zhamcrest.core.descriptionr   Z"hamcrest.core.helpers.wrap_matcherr	   Zhamcrest.core.matcherr
   Ú
__author__Z__copyright__Z__license__r   r   r"   r$   r0   r   r   r   r   Ú<module>   s   $