o
    (]^%  ã                   @   sº   d dl mZ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
ed�ZG dd„ deeeef  ƒZdeeee f deeeef  fdd„ZdS )é    )ÚAnyÚHashableÚMappingÚTypeVarÚUnion)ÚBaseMatcher)ÚDescription)Ú	hasmethod)Úwrap_matcher)ÚMatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtÚK)Úboundc                   @   sN   e Zd Zdee ddfdd„Zdeeef defdd„Z	d	e
ddfd
d„ZdS )ÚIsDictContainingKeyÚkey_matcherÚreturnNc                 C   s
   || _ d S )N)r   )Úselfr   © r   úR/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containingkey.pyÚ__init__   s   
zIsDictContainingKey.__init__Úitemc                 C   s.   t |dƒr| ¡ D ]}| j |¡r dS q	dS )NÚkeysTF)r	   r   r   Úmatches)r   r   Úkeyr   r   r   Ú_matches   s   
ÿzIsDictContainingKey._matchesÚdescriptionc                 C   s   |  d¡ | j¡ d S )Nza dictionary containing key )Úappend_textÚappend_description_ofr   )r   r   r   r   r   Údescribe_to   s   
ÿzIsDictContainingKey.describe_to)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   Úboolr   r   r   r   r   r   r   r      s    r   Ú	key_matchr   c                 C   s   t t| ƒƒS )aŽ  Matches if dictionary contains an entry whose key satisfies a given
    matcher.

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

    This matcher iterates the evaluated dictionary, searching for any key-value
    entry whose key satisfies the given matcher. If a matching entry is found,
    ``has_key`` 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.

    Examples::

        has_key(equal_to('foo'))
        has_key('foo')

    )r   r
   )r"   r   r   r   Úhas_key!   s   r#   N)Útypingr   r   r   r   r   Úhamcrest.core.base_matcherr   Úhamcrest.core.descriptionr   Úhamcrest.core.helpers.hasmethodr	   Ú"hamcrest.core.helpers.wrap_matcherr
   Úhamcrest.core.matcherr   Ú
__author__Ú__copyright__Ú__license__r   r   r#   r   r   r   r   Ú<module>   s    .