GRAYBYTE WORDPRESS FILE MANAGER2602

Server IP : 198.54.121.189 / Your IP : 216.73.216.224
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/cloudlinux/venv/lib/python3.11/site-packages/pytest_subprocess/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/pytest_subprocess//process_recorder.py
from typing import Iterator
from typing import List
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union

from .types import COMMAND
from .utils import Command

if TYPE_CHECKING:
    from .fake_popen import FakePopen, AsyncFakePopen


class ProcessRecorder:
    """
    Recorder class that holds all FakePopen (or AsyncFakePopen) instances that were
    created by the subprocess. The class contains auxiliary
    """

    calls: List[Union["FakePopen", "AsyncFakePopen"]]

    def __init__(self) -> None:
        self.calls = []

    @property
    def first_call(self) -> Optional[Union["FakePopen", "AsyncFakePopen"]]:
        """Get the first process call"""
        if not self.calls:
            return None
        return self.calls[0]

    @property
    def last_call(self) -> Optional[Union["FakePopen", "AsyncFakePopen"]]:
        """Get the last (latest) process call"""
        if not self.calls:
            return None
        return self.calls[-1]

    def call_count(self, command: Optional[COMMAND] = None) -> int:
        """Get process call count - optionally match with arguments"""
        if not command:
            return len(self.calls)
        return len(tuple(self.get_matching_calls(command)))

    def was_called(self, command: Optional[COMMAND] = None) -> bool:
        """Check if process was called - optionally match with arguments"""
        if not self.calls:
            return False
        if not command:
            return True
        return any(self.get_matching_calls(command))

    def get_matching_calls(
        self, command: COMMAND
    ) -> Iterator[Union["FakePopen", "AsyncFakePopen"]]:
        """Get calls that match arguments"""
        if not isinstance(command, Command):
            command = Command(command)
        return (call for call in self.calls if self.calls if command == call.args)

    def clear(self) -> None:
        """Clear records"""
        self.calls.clear()

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 25 2025 08:31:36
root / root
0755
__pycache__
--
May 15 2025 08:30:34
root / root
0755
__init__.py
0.212 KB
April 17 2025 13:10:59
root / root
0644
asyncio_subprocess.py
0.266 KB
April 17 2025 13:10:59
root / root
0644
exceptions.py
0.419 KB
April 17 2025 13:10:59
root / root
0644
fake_popen.py
12.767 KB
April 17 2025 13:10:59
root / root
0644
fake_process.py
5.218 KB
April 17 2025 13:10:59
root / root
0644
fixtures.py
0.241 KB
April 17 2025 13:10:59
root / root
0644
process_dispatcher.py
8.228 KB
April 17 2025 13:10:59
root / root
0644
process_recorder.py
1.921 KB
April 17 2025 13:10:59
root / root
0644
py.typed
0 KB
April 17 2025 13:10:59
root / root
0644
types.py
0.422 KB
April 17 2025 13:10:59
root / root
0644
utils.py
5.057 KB
April 17 2025 13:10:59
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF