✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ beluga.o2switch.net ​🇻​♯➤ 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 185.154.139.77 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.84
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/alt/python27/lib/python2.7/site-packages/invoke//watchers.py
import re
import threading

from .exceptions import ResponseNotAccepted


class StreamWatcher(threading.local):
    """
    A class whose subclasses may act on seen stream data from subprocesses.

    Subclasses must exhibit the following API; see `Responder` for a concrete
    example.

    * ``__init__`` is completely up to each subclass, though as usual,
      subclasses *of* subclasses should be careful to make use of `super` where
      appropriate.
    * `submit` must accept the entire current contents of the stream being
      watched, as a Unicode string, and may optionally return an iterable of
      Unicode strings (or act as a generator iterator, i.e. multiple calls to
      ``yield <unicode string>``), which will each be written to the
      subprocess' standard input.

    .. note::
        `StreamWatcher` subclasses exist in part to enable state tracking, such
        as detecting when a submitted password didn't work & erroring (or
        prompting a user, or etc). Such bookkeeping isn't easily achievable
        with simple callback functions.

    .. note::
        `StreamWatcher` subclasses `threading.local` so that its instances can
        be used to 'watch' both subprocess stdout and stderr in separate
        threads.

    .. versionadded:: 1.0
    """

    def submit(self, stream):
        """
        Act on ``stream`` data, potentially returning responses.

        :param unicode stream:
            All data read on this stream since the beginning of the session.

        :returns:
            An iterable of Unicode strings (which may be empty).

        .. versionadded:: 1.0
        """
        raise NotImplementedError


class Responder(StreamWatcher):
    """
    A parameterizable object that submits responses to specific patterns.

    Commonly used to implement password auto-responds for things like ``sudo``.

    .. versionadded:: 1.0
    """

    def __init__(self, pattern, response):
        """
        Imprint this `Responder` with necessary parameters.

        :param pattern:
            A raw string (e.g. ``r"\[sudo\] password for .*:"``) which will be
            turned into a regular expression.

        :param response:
            The string to submit to the subprocess' stdin when ``pattern`` is
            detected.
        """
        # TODO: precompile the keys into regex objects
        self.pattern = pattern
        self.response = response
        self.index = 0

    def pattern_matches(self, stream, pattern, index_attr):
        """
        Generic "search for pattern in stream, using index" behavior.

        Used here and in some subclasses that want to track multiple patterns
        concurrently.

        :param unicode stream: The same data passed to ``submit``.
        :param unicode pattern: The pattern to search for.
        :param unicode index_attr: The name of the index attribute to use.
        :returns: An iterable of string matches.

        .. versionadded:: 1.0
        """
        # NOTE: generifies scanning so it can be used to scan for >1 pattern at
        # once, e.g. in FailingResponder.
        # Only look at stream contents we haven't seen yet, to avoid dupes.
        index = getattr(self, index_attr)
        new_ = stream[index:]
        # Search, across lines if necessary
        matches = re.findall(pattern, new_, re.S)
        # Update seek index if we've matched
        if matches:
            setattr(self, index_attr, index + len(new_))
        return matches

    def submit(self, stream):
        # Iterate over findall() response in case >1 match occurred.
        for _ in self.pattern_matches(stream, self.pattern, "index"):
            yield self.response


class FailingResponder(Responder):
    """
    Variant of `Responder` which is capable of detecting incorrect responses.

    This class adds a ``sentinel`` parameter to ``__init__``, and its
    ``submit`` will raise `.ResponseNotAccepted` if it detects that sentinel
    value in the stream.

    .. versionadded:: 1.0
    """

    def __init__(self, pattern, response, sentinel):
        super(FailingResponder, self).__init__(pattern, response)
        self.sentinel = sentinel
        self.failure_index = 0
        self.tried = False

    def submit(self, stream):
        # Behave like regular Responder initially
        response = super(FailingResponder, self).submit(stream)
        # Also check stream for our failure sentinel
        failed = self.pattern_matches(stream, self.sentinel, "failure_index")
        # Error out if we seem to have failed after a previous response.
        if self.tried and failed:
            err = 'Auto-response to r"{}" failed with {!r}!'.format(
                self.pattern, self.sentinel
            )
            raise ResponseNotAccepted(err)
        # Once we see that we had a response, take note
        if response:
            self.tried = True
        # Again, behave regularly by default.
        return response

Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]

Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
8 Jan 2025 10.42 AM
root / linksafe
0755
parser
--
25 Jul 2024 8.44 AM
root / linksafe
0755
__init__.py
1.385 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
__init__.pyc
2.091 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
__init__.pyo
2.091 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
__main__.py
0.046 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
__main__.pyc
0.225 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
__main__.pyo
0.225 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
_version.py
0.078 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
_version.pyc
0.27 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
_version.pyo
0.27 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
collection.py
20.879 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
collection.pyc
20.61 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
collection.pyo
20.61 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
complete.py
3.877 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
complete.pyc
2.554 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
complete.pyo
2.554 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
config.py
47.493 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
config.pyc
38.222 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
config.pyo
38.222 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
context.py
20.874 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
context.pyc
16.685 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
context.pyo
16.685 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
env.py
3.982 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
env.pyc
4.249 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
env.pyo
4.249 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
exceptions.py
9.646 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
exceptions.pyc
12.605 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
exceptions.pyo
12.605 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
executor.py
8.126 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
executor.pyc
6.621 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
executor.pyo
6.621 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
loader.py
4.688 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
loader.pyc
4.637 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
loader.pyo
4.637 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
main.py
0.18 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
main.pyc
0.401 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
main.pyo
0.401 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
program.py
31.392 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
program.pyc
25.531 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
program.pyo
25.531 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
runners.py
47.323 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
runners.pyc
38.188 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
runners.pyo
38.188 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
tasks.py
18.815 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
tasks.pyc
16.439 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
tasks.pyo
16.439 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
terminals.py
7.335 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
terminals.pyc
6.47 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
terminals.pyo
6.47 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
util.py
10.528 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
util.pyc
7.727 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
util.pyo
7.727 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
watchers.py
4.856 KB
1 Aug 2018 1.00 AM
root / linksafe
0644
watchers.pyc
5.387 KB
22 Oct 2019 3.11 AM
root / linksafe
0644
watchers.pyo
5.387 KB
22 Oct 2019 3.11 AM
root / linksafe
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF