CasperSecurity

Current Path : /lib/python3/dist-packages/hamcrest/library/object/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/hamcrest/library/object/__pycache__/hasproperty.cpython-310.pyc

o

(]^��@sHddlmZmZmZmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZddlmZdd	lmZd
ZdZdZed
�ZGdd�dee�Zddededeeefdeefdd�Zedeeeefdeefdd��Zedeeeeeeffdeefdd��Zededeefdd��Zdd�ZdS)�)�Any�Mapping�TypeVar�Union�overload)�described_as)�anything)�BaseMatcher)�AllOf)�Description)�wrap_matcher)�Matcher)�StringDescriptionz
Chris RosezCopyright 2011 hamcrest.orgzBSD, see License.txt�Vc@sheZdZdedeeddfdd�Zdedefdd	�Z	d
e
ddfdd�Zded
e
ddfdd�Zdd�Z
dS)�IsObjectWithProperty�
property_name�
value_matcher�returnNcCs||_||_dS�N)rr)�selfrr�r�E/usr/lib/python3/dist-packages/hamcrest/library/object/hasproperty.py�__init__s
zIsObjectWithProperty.__init__�itemcCs4|durdSt||j�sdSt||j�}|j�|�S)NF)�hasattrr�getattrr�matches)rr�valuerrr�_matchesszIsObjectWithProperty._matches�descriptioncCs$|�d��|j��d��|j�dS)Nzan object with a property 'z' matching )�append_textr�append_description_ofr)rrrrr�describe_to"s
�z IsObjectWithProperty.describe_to�mismatch_descriptioncCsz|dur|�d�dSt||j�s"|�|��d��|j��d�dS|�d��|j��d�t||j�}|j�||�dS)Nzwas Nonez did not have the z	 propertyz	property � )r rrr!rr�describe_mismatch)rrr#rrrrr%'s

�
�z&IsObjectWithProperty.describe_mismatchcCst�}|�|�t|�Sr)rr"�str)r�drrr�__str__8s
zIsObjectWithProperty.__str__)�__name__�
__module__�__qualname__r&r
rr�object�boolrrr"r%r(rrrrrs
rN�name�matchrcCs|durt�}t|t|��S)a�Matches if object has a property with a given name whose value satisfies
    a given matcher.

    :param name: The name of the property.
    :param match: Optional matcher to satisfy.

    This matcher determines if the evaluated object has a property with a given
    name. If no such property is found, ``has_property`` is not satisfied.

    If the property is found, its value is passed to a given matcher for
    evaluation. 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.

    If the ``match`` argument is not provided, the
    :py:func:`~hamcrest.core.core.isanything.anything` matcher is used so that
    ``has_property`` is satisfied if a matching property is found.

    Examples::

        has_property('name', starts_with('J'))
        has_property('name', 'Jon')
        has_property('name')

    N)rr�
wrap_shortcut)r.r/rrr�has_property>sr1�keys_valuematcherscK�dSrr�r2rrr�has_properties`�r5cCr3rrr4rrrr5fr6cGr3rrr4rrrr5lr6c
Osft|�dkr'z|d��}|D]
}t||�||<qWn4ty&td��wt|�dr1td��i}ttt|�d��D]}t|d|d�||d|<q=|��D]
\}}t|�||<qTt|�dkr�t��	d�}t
t|����D]\}\}}	|�|��	d��|	�|t|�dkr�|�	d�qst
t|�td	d
�t|���D�ddd
���S|��\}}	t||	�S)aXMatches if an object has properties satisfying all of a dictionary
    of string property names and corresponding value matchers.

    :param matcher_dict: A dictionary mapping keys to associated value matchers,
        or to expected values for
        :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    Note that the keys must be actual keys, not matchers. Any value 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_properties({'foo':equal_to(1), 'bar':equal_to(2)})
        has_properties({'foo':1, 'bar':2})

    ``has_properties`` also accepts a list of keyword arguments:

    .. function:: has_properties(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]])

    :param keyword1: A keyword to look up.
    :param valueMatcher1: The matcher to satisfy for the value, or an expected
        value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    Examples::

        has_properties(foo=equal_to(1), bar=equal_to(2))
        has_properties(foo=1, bar=2)

    Finally, ``has_properties`` also accepts a list of alternating keys and their
    value matchers:

    .. function:: has_properties(key1, value_matcher1[, ...])

    :param key1: A key (not a matcher) to look up.
    :param valueMatcher1: The matcher to satisfy for the value, or an expected
        value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    Examples::

        has_properties('foo', equal_to(1), 'bar', equal_to(2))
        has_properties('foo', 1, 'bar', 2)

    �rzHsingle-argument calls to has_properties must pass a dict as the argument�z'has_properties requires key-value pairszan object with properties z
 matching z and cSsg|]	\}}t||��qSr)r1)�.0r�property_value_matcherrrr�
<listcomp>�s��z"has_properties.<locals>.<listcomp>TF)�describe_all_mismatches�describe_matcher_in_mismatch)�len�copyr0�AttributeError�
ValueError�range�int�itemsrr �	enumerate�sortedr!rr&r
�popitemr1)
r2�kv_args�	base_dict�key�indexrr�irr:rrrr5qsT.����
�
�
���
r) �typingrrrrr�hamcrestr�
hamcrest.corer�hamcrest.core.base_matcherr	�hamcrest.core.core.allofr
�hamcrest.core.descriptionr�"hamcrest.core.helpers.wrap_matcherrr0�hamcrest.core.matcherr
� hamcrest.core.string_descriptionr�
__author__�
__copyright__�__license__rr,rr&r1r5rrrr�<module>s,*+"$,
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY