$55 GRAYBYTE WORDPRESS FILE MANAGER $21

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.6
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest/__pycache__/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest/__pycache__//monkeypatch.cpython-311.pyc
�

�|oi	:����dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZejd��Zed��Zed��Zede	dfd���Zdedefd�Zdedededefd�Z dede!deeeffd�Z"Gd�d ��Z#e#��Z$eGd!�d"����Z%dS)#z)Monkeypatching and mocking functionality.�N)�contextmanager)�Any)�	Generator)�List)�Mapping)�MutableMapping)�Optional)�overload)�Tuple)�TypeVar)�Union)�final)�fixture)�
PytestWarningz^No module named (.*)$�K�V�return��MonkeyPatchNNc#�VK�t��}|V�|���dS)a
A convenient fixture for monkey-patching.

    The fixture provides these methods to modify objects, dictionaries, or
    :data:`os.environ`:

    * :meth:`monkeypatch.setattr(obj, name, value, raising=True) <pytest.MonkeyPatch.setattr>`
    * :meth:`monkeypatch.delattr(obj, name, raising=True) <pytest.MonkeyPatch.delattr>`
    * :meth:`monkeypatch.setitem(mapping, name, value) <pytest.MonkeyPatch.setitem>`
    * :meth:`monkeypatch.delitem(obj, name, raising=True) <pytest.MonkeyPatch.delitem>`
    * :meth:`monkeypatch.setenv(name, value, prepend=None) <pytest.MonkeyPatch.setenv>`
    * :meth:`monkeypatch.delenv(name, raising=True) <pytest.MonkeyPatch.delenv>`
    * :meth:`monkeypatch.syspath_prepend(path) <pytest.MonkeyPatch.syspath_prepend>`
    * :meth:`monkeypatch.chdir(path) <pytest.MonkeyPatch.chdir>`
    * :meth:`monkeypatch.context() <pytest.MonkeyPatch.context>`

    All modifications will be undone after the requesting test function or
    fixture has finished. The ``raising`` parameter determines if a :class:`KeyError`
    or :class:`AttributeError` will be raised if the set/deletion operation does not have the
    specified target.

    To undo modifications done by the fixture in a contained scope,
    use :meth:`context() <pytest.MonkeyPatch.context>`.
    N)r�undo)�mpatchs �e/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/_pytest/monkeypatch.py�monkeypatchrs+����2�]�]�F�
�L�L�L�
�K�K�M�M�M�M�M��namec���|�d��}|�d��}t|��}|D]�}|d|zz
}	t||��}�#t$rYnwxYw	t|��nV#t
$rI}t
|�����d}||kr�td|�d|����|�d}~wwxYwt|||��}��|S)N�.r���zimport error in z: )�split�pop�
__import__�getattr�AttributeError�ImportError�str�annotated_getattr)r�parts�used�found�part�ex�expecteds       r�resolver.;s ���J�J�s�O�O�E��9�9�Q�<�<�D��t�$�$�E��5�5����d�
���	��E�4�(�(�E�
���	�	�	��D�	����	K��t�������	K�	K�	K��2�w�w�}�}���r�*�H��4����!�"A�T�"A�"A�R�"A�"A�B�B��J�����	K����"�%��t�4�4����Ls+�A�
A%�$A%�)A9�9
C�AC�C�obj�annc��	t||��}nI#t$r<}td�t|��j||����|�d}~wwxYw|S)Nz'{!r} object at {} has no attribute {!r})r#r$�format�type�__name__)r/rr0�es    rr'r'Wsx����c�4� � ���������5�<�<��S�	�	�"�C��
�
�
�
��		����������Js��
A�7A�A�import_path�raisingc���t|t��rd|vrtd|�����|�dd��\}}t	|��}|rt|||���||fS)Nrz)must be absolute import path string, not �)r0)�
isinstancer&�	TypeError�rsplitr.r')r6r7�module�attr�targets     r�derive_importpathr@cs����k�3�'�'�U�3�k�+A�+A��S�K�S�S�T�T�T��%�%�c�1�-�-�L�F�D�
�V�_�_�F��4��&�$�F�3�3�3�3���<�rc��eZdZdefd�ZdS)�Notsetrc��dS)Nz<notset>���selfs r�__repr__zNotset.__repr__ns���zrN)r4�
__module__�__qualname__r&rGrDrrrBrBms/�������#������rrBc���eZdZdZdd�Zeededfd�����Ze			dde
d	ed
ede
ddf
d���Ze		dded	e
d
ede
ddf
d
���Zedfdee
efd	eee
fd
ede
ddf
d�Zedfdeee
fd	ee
efde
ddfd�Zdeeefd	ed
eddfd�Zddeeefd	ede
ddfd�Zd d	e
d
e
dee
ddfd�Zdd	e
de
ddfd�Zdd�Zdee
dfddfd�Zdd�ZdS)!ra�Helper to conveniently monkeypatch attributes/items/environment
    variables/syspath.

    Returned by the :fixture:`monkeypatch` fixture.

    .. versionchanged:: 6.2
        Can now also be used directly as `pytest.MonkeyPatch()`, for when
        the fixture is not available. In this case, use
        :meth:`with MonkeyPatch.context() as mp: <context>` or remember to call
        :meth:`undo` explicitly.
    rNc�>�g|_g|_d|_d|_dS�N)�_setattr�_setitem�_cwd�_savesyspathrEs r�__init__zMonkeyPatch.__init__�s%��:<��
�HJ��
�#'��	�15����rrc#�K�|��}	|V�|���dS#|���wxYw)a]Context manager that returns a new :class:`MonkeyPatch` object
        which undoes any patching done inside the ``with`` block upon exit.

        Example:

        .. code-block:: python

            import functools


            def test_partial(monkeypatch):
                with monkeypatch.context() as m:
                    m.setattr(functools, "partial", 3)

        Useful in situations where it is desired to undo some patches before the test ends,
        such as mocking ``stdlib`` functions that might break pytest itself if mocked (for examples
        of this see :issue:`3290`).
        N)r)�cls�ms  r�contextzMonkeyPatch.context�sD����*
�C�E�E��	��G�G�G�
�F�F�H�H�H�H�H��A�F�F�H�H�H�H���s�(�>.r?r�valuer7c��dSrLrD�rFr?rrVr7s     r�setattrzMonkeyPatch.setattr��	��	�rc��dSrLrDrXs     rrYzMonkeyPatch.setattr�rZrTc�(�d}ddl}t|t��r:t|t��st	d���|}t||��\}}n$t|t��st	d���t
||t��}|r|turt|�d|�����|�	|��r |j
�|t��}|j�
|||f��t|||��dS)a�
        Set attribute value on target, memorizing the old value.

        For example:

        .. code-block:: python

            import os

            monkeypatch.setattr(os, "getcwd", lambda: "/")

        The code above replaces the :func:`os.getcwd` function by a ``lambda`` which
        always returns ``"/"``.

        For convenience, you can specify a string as ``target`` which
        will be interpreted as a dotted import path, with the last part
        being the attribute name:

        .. code-block:: python

            monkeypatch.setattr("os.getcwd", lambda: "/")

        Raises :class:`AttributeError` if the attribute does not exist, unless
        ``raising`` is set to False.

        **Where to patch**

        ``monkeypatch.setattr`` works by (temporarily) changing the object that a name points to with another one.
        There can be many names pointing to any individual object, so for patching to work you must ensure
        that you patch the name used by the system under test.

        See the section :ref:`Where to patch <python:where-to-patch>` in the :mod:`unittest.mock`
        docs for a complete explanation, which is meant for :func:`unittest.mock.patch` but
        applies to ``monkeypatch.setattr`` as well.
        TrNzcuse setattr(target, name, value) or setattr(target, value) with target being a dotted import stringz|use setattr(target, name, value) with name being a string or setattr(target, value) with target being a dotted import stringz has no attribute )�inspectr:rBr&r;r@r#�notsetr$�isclass�__dict__�getrM�appendrY)rFr?rrVr7�__tracebackhide__r]�oldvals        rrYzMonkeyPatch.setattr�s8��T!�������e�V�$�$�	��f�c�*�*�
��$����
�E�,�V�W�=�=�L�D�&�&��d�C�(�(�
��$�������v�.�.���	J�v��'�'� �F�!H�!H��!H�!H�I�I�I��?�?�6�"�"�	7��_�(�(��v�6�6�F��
���f�d�F�3�4�4�4����e�$�$�$�$�$rc���d}ddl}t|t��r7t|t��st	d���t||��\}}t
||��s|rt|���dSt||t��}|�
|��r |j�|t��}|j
�|||f��t||��dS)aKDelete attribute ``name`` from ``target``.

        If no ``name`` is specified and ``target`` is a string
        it will be interpreted as a dotted import path with the
        last part being the attribute name.

        Raises AttributeError it the attribute does not exist, unless
        ``raising`` is set to False.
        TrNzUuse delattr(target, name) or delattr(target) with target being a dotted import string)r]r:rBr&r;r@�hasattrr$r#r^r_r`rarMrb�delattr)rFr?rr7rcr]rds       rrgzMonkeyPatch.delattrs��!�������d�F�#�#�	>��f�c�*�*�
��$����
-�V�W�=�=�L�D�&��v�t�$�$�		"��
+�$�T�*�*�*�
+�
+��V�T�6�2�2�F����v�&�&�
;���,�,�T�6�:�:���M� � �&�$��!7�8�8�8��F�D�!�!�!�!�!r�dicc�|�|j�|||�|t��f��|||<dS)z'Set dictionary entry ``name`` to value.N)rNrbrar^)rFrhrrVs    r�setitemzMonkeyPatch.setitem&s:���
���c�4�����v�)>�)>�?�@�@�@���D�	�	�	rc��||vr|rt|���dS|j�|||�|t��f��||=dS)z�Delete ``name`` from dict.

        Raises ``KeyError`` if it doesn't exist, unless ``raising`` is set to
        False.
        N)�KeyErrorrNrbrar^)rFrhrr7s    r�delitemzMonkeyPatch.delitem,sc���s�?�?��
%��t�n�n�$�
%�
%�
�M� � �#�t�S�W�W�T�6�-B�-B�!C�D�D�D��D�	�	�	r�prependc�v�t|t��sZtjt	d�||t
|��j�����d���t|��}|r&|tj	vr||ztj	|z}|�
tj	||��dS)z�Set environment variable ``name`` to ``value``.

        If ``prepend`` is a character, read the current environment variable
        value and prepend the ``value`` adjoined with the ``prepend``
        character.
        zvValue of environment variable {name} type should be str, but got {value!r} (type: {type}); converted to str implicitly)rrVr3�)�
stacklevelN)r:r&�warnings�warnrr2r3r4�os�environrj)rFrrVrns    r�setenvzMonkeyPatch.setenv:s����%��%�%�
	��M��L�LR�F�!��T�%�[�[�5I�MS�M�M����
�
�
�
���J�J�E��	7�t�r�z�)�)��G�O�b�j��&6�6�E����R�Z��u�-�-�-�-�-rc�N�tj}|�|||���dS)z�Delete ``name`` from the environment.

        Raises ``KeyError`` if it does not exist, unless ``raising`` is set to
        False.
        )r7N)rtrurm)rFrr7rus    r�delenvzMonkeyPatch.delenvPs)��-/�J�����W�d�G��4�4�4�4�4rc��|j�tjdd�|_tj�dt	|����dtjvrddlm}|t	|����ddlm	}|��dS)z:Prepend ``path`` to ``sys.path`` list of import locations.Nr�
pkg_resources)�fixup_namespace_packages)�invalidate_caches)
rP�sys�path�insertr&�modulesrzr{�	importlibr|)rFr~r{r|s    r�syspath_prependzMonkeyPatch.syspath_prependYs�����$� #������D�������3�t�9�9�%�%�%��c�k�)�)�>�>�>�>�>�>�$�$�S��Y�Y�/�/�/�	0�/�/�/�/�/�������rr~zos.PathLike[str]c�l�|j�tj��|_tj|��dS)zChange the current working directory to the specified path.

        :param path:
            The path to change into.
        N)rOrt�getcwd�chdir)rFr~s  rr�zMonkeyPatch.chdirrs*���9���	���D�I�
�������rc���t|j��D]1\}}}|turt|||���!t	||���2g|jdd�<t|j��D])\}}}|tur	||=�#t$rY� wxYw|||<�*g|jdd�<|j�|jtj	dd�<d|_|j
�"tj|j
��d|_
dSdS)a�Undo previous changes.

        This call consumes the undo stack. Calling it a second time has no
        effect unless you do more monkeypatching after the undo call.

        There is generally no need to call `undo()`, since it is
        called automatically during tear-down.

        .. note::
            The same `monkeypatch` fixture is used across a
            single test function invocation. If `monkeypatch` is used both by
            the test function itself and one of the test fixtures,
            calling `undo()` will undo all of the changes made in
            both functions.

            Prefer to use :meth:`context() <pytest.MonkeyPatch.context>` instead.
        N)
�reversedrMr^rYrgrNrlrPr}r~rOrtr�)rFr/rrV�
dictionary�keys      rrzMonkeyPatch.undo|s+��$!)��� 7� 7�	#�	#��C��u��F�"�"���T�5�)�)�)�)���T�"�"�"�"���
�a�a�a��&.�t�}�&=�&=�		(�		(�"�J��U������"�3���������D�����#(�
�3�����
�a�a�a����(��+�C�H�Q�Q�Q�K� $�D���9� ��H�T�Y�����D�I�I�I�!� s�7A;�;
B�B)rN)..).)TrL)r4rHrI�__doc__rQ�classmethodrrrUr
r&�objectrB�boolrYr^r
rgrrrrjrmr	rvrxr�r�rrDrrrrus������
�
�6�6�6�6����	�";�<�����^��[��2�
���������	�
��
�
����X�����������	�
��
�
����X����F%�F%��c�6�k�"�F%��F�C�K� �F%��	F%�
�F%�
�
F%�F%�F%�F%�V$*��	$"�$"��f�c�k�"�$"��C��K� �$"��	$"�

�$"�$"�$"�$"�L�7�1�a�4�=����!���������7�1�a�4�=����D��D�����.�.�3�.�s�.�X�c�]�.�d�.�.�.�.�,5�5�3�5��5��5�5�5�5�����2�%��%7� 7�8��T�����)�)�)�)�)�)rr)&r�rt�rer}rr�
contextlibr�typingrrrrrr	r
rrr
�_pytest.compatr�_pytest.fixturesr�_pytest.warning_typesr�compile�RE_IMPORT_ERROR_NAMErrrr&r�r.r'r�r@rBr^rrDrr�<module>r�s���/�/�	�	�	�	�	�	�	�	�
�
�
�
�����%�%�%�%�%�%�������������������������!�!�!�!�!�!������������������������������� � � � � � �$�$�$�$�$�$�/�/�/�/�/�/�!�r�z�";�<�<���G�C�L�L���G�C�L�L��	��Y�8�9����	���:�#��&�����8	�6�	��	�3�	�6�	�	�	�	��3����%��V��:L�������������

������o�o�o�o�o�o�o���o�o�or


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
11 Feb 2026 9.30 AM
root / root
0755
__init__.cpython-311.pyc
0.465 KB
20 Jan 2026 1.01 PM
root / root
0644
_argcomplete.cpython-311.pyc
5.241 KB
20 Jan 2026 1.01 PM
root / root
0644
_version.cpython-311.pyc
0.31 KB
20 Jan 2026 1.01 PM
root / root
0644
cacheprovider.cpython-311.pyc
32.439 KB
20 Jan 2026 1.01 PM
root / root
0644
capture.cpython-311.pyc
57.893 KB
20 Jan 2026 1.01 PM
root / root
0644
compat.cpython-311.pyc
16.574 KB
20 Jan 2026 1.01 PM
root / root
0644
debugging.cpython-311.pyc
19.638 KB
20 Jan 2026 1.01 PM
root / root
0644
deprecated.cpython-311.pyc
4.948 KB
20 Jan 2026 1.01 PM
root / root
0644
doctest.cpython-311.pyc
36.359 KB
20 Jan 2026 1.01 PM
root / root
0644
faulthandler.cpython-311.pyc
4.807 KB
20 Jan 2026 1.01 PM
root / root
0644
fixtures.cpython-311.pyc
75.725 KB
20 Jan 2026 1.01 PM
root / root
0644
freeze_support.cpython-311.pyc
2.028 KB
20 Jan 2026 1.01 PM
root / root
0644
helpconfig.cpython-311.pyc
12.782 KB
20 Jan 2026 1.01 PM
root / root
0644
hookspec.cpython-311.pyc
36.463 KB
20 Jan 2026 1.01 PM
root / root
0644
junitxml.cpython-311.pyc
36.438 KB
20 Jan 2026 1.01 PM
root / root
0644
legacypath.cpython-311.pyc
26.702 KB
20 Jan 2026 1.01 PM
root / root
0644
logging.cpython-311.pyc
48.889 KB
20 Jan 2026 1.01 PM
root / root
0644
main.cpython-311.pyc
41.493 KB
20 Jan 2026 1.01 PM
root / root
0644
monkeypatch.cpython-311.pyc
18.079 KB
20 Jan 2026 1.01 PM
root / root
0644
nodes.cpython-311.pyc
34.053 KB
20 Jan 2026 1.01 PM
root / root
0644
nose.cpython-311.pyc
2.285 KB
20 Jan 2026 1.01 PM
root / root
0644
outcomes.cpython-311.pyc
13.476 KB
20 Jan 2026 1.01 PM
root / root
0644
pastebin.cpython-311.pyc
6.155 KB
20 Jan 2026 1.01 PM
root / root
0644
pathlib.cpython-311.pyc
36.268 KB
20 Jan 2026 1.01 PM
root / root
0644
pytester.cpython-311.pyc
93.958 KB
20 Jan 2026 1.01 PM
root / root
0644
pytester_assertions.cpython-311.pyc
2.814 KB
20 Jan 2026 1.01 PM
root / root
0644
python.cpython-311.pyc
87.498 KB
20 Jan 2026 1.01 PM
root / root
0644
python_api.cpython-311.pyc
46.724 KB
20 Jan 2026 1.01 PM
root / root
0644
python_path.cpython-311.pyc
1.754 KB
20 Jan 2026 1.01 PM
root / root
0644
recwarn.cpython-311.pyc
15.683 KB
20 Jan 2026 1.01 PM
root / root
0644
reports.cpython-311.pyc
27.831 KB
20 Jan 2026 1.01 PM
root / root
0644
runner.cpython-311.pyc
24.716 KB
20 Jan 2026 1.01 PM
root / root
0644
scope.cpython-311.pyc
4.317 KB
20 Jan 2026 1.01 PM
root / root
0644
setuponly.cpython-311.pyc
5.339 KB
20 Jan 2026 1.01 PM
root / root
0644
setupplan.cpython-311.pyc
2.075 KB
20 Jan 2026 1.01 PM
root / root
0644
skipping.cpython-311.pyc
14.247 KB
20 Jan 2026 1.01 PM
root / root
0644
stash.cpython-311.pyc
4.792 KB
20 Jan 2026 1.01 PM
root / root
0644
stepwise.cpython-311.pyc
5.984 KB
20 Jan 2026 1.01 PM
root / root
0644
terminal.cpython-311.pyc
76.276 KB
20 Jan 2026 1.01 PM
root / root
0644
threadexception.cpython-311.pyc
4.777 KB
20 Jan 2026 1.01 PM
root / root
0644
timing.cpython-311.pyc
0.644 KB
20 Jan 2026 1.01 PM
root / root
0644
tmpdir.cpython-311.pyc
14.166 KB
20 Jan 2026 1.01 PM
root / root
0644
unittest.cpython-311.pyc
19.835 KB
20 Jan 2026 1.01 PM
root / root
0644
unraisableexception.cpython-311.pyc
4.791 KB
20 Jan 2026 1.01 PM
root / root
0644
warning_types.cpython-311.pyc
7.772 KB
20 Jan 2026 1.01 PM
root / root
0644
warnings.cpython-311.pyc
7.378 KB
20 Jan 2026 1.01 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF