
    e                     |    d dl mZ d dlmZ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ee         Zy)    )shorten)OptionalTypeVar)Description)MatchertostringzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtTc                   |    e Zd ZdZdefdZdefdZdedefdZ	ddede
e   defd	Zdededdfd
ZdededdfdZy)BaseMatchera  Base class for all :py:class:`~hamcrest.core.matcher.Matcher`
    implementations.

    Most implementations can just implement :py:obj:`_matches`, leaving the
    handling of any mismatch description to the ``matches`` method. But if it
    makes more sense to generate the mismatch description during the matching,
    override :py:meth:`~hamcrest.core.matcher.Matcher.matches` instead.

    returnc                     t        |       S Nr   selfs    </usr/lib/python3/dist-packages/hamcrest/core/base_matcher.py__str__zBaseMatcher.__str__   s    ~    c                 x    dj                  | j                  j                  t        t	        |       dd            S )z&Returns matcher string representation.z
<{0}({1})><   z...)placeholder)format	__class____name__r   r	   r   s    r   __repr__zBaseMatcher.__repr__   s1    ""NN##WXd^RU%S
 	
r   itemc                     t        d      )N_matches)NotImplementedError)r   r   s     r   r   zBaseMatcher._matches#   s    !*--r   Nmismatch_descriptionc                 T    | j                  |      }|s|r| j                  ||       |S r   )r   describe_mismatch)r   r   r    match_results       r   matcheszBaseMatcher.matches&   s-    }}T* 4""4)=>r   c                 D    |j                  d      j                  |       y Nzwas append_textappend_description_of)r   r   r    s      r   r"   zBaseMatcher.describe_mismatch,   s    ((0FFtLr   match_descriptionc                 D    |j                  d      j                  |       y r&   r'   )r   r   r*   s      r   describe_matchzBaseMatcher.describe_match/   s    %%f-CCDIr   r   )r   
__module____qualname____doc__strr   r   r
   boolr   r   r   r$   r"   r,    r   r   r   r      s     
# 
.Q .4 .A Xk5J VZ Ma M{ Mt MJ1 J J Jr   r   N)textwrapr   typingr   r   hamcrest.core.descriptionr   hamcrest.core.matcherr    hamcrest.core.string_descriptionr	   
__author____copyright____license__r
   r   r2   r   r   <module>r;      s>     $ 1 ) 5
-$CL!J'!* !Jr   