SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > > site-packages > testfixtures


Operation   : Linux premium131.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
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11//site-packages/testfixtures

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
tests Directory - -
__init__.py File 1223 bytes April 17 2025 13:10:58.
comparison.py File 40081 bytes April 17 2025 13:10:58.
compat.py File 224 bytes April 17 2025 13:10:58.
components.py File 1337 bytes April 17 2025 13:10:58.
datetime.py File 25009 bytes April 17 2025 13:10:58.
django.py File 2954 bytes April 17 2025 13:10:58.
logcapture.py File 11013 bytes April 17 2025 13:10:58.
mock.py File 1234 bytes April 17 2025 13:10:58.
outputcapture.py File 4801 bytes April 17 2025 13:10:58.
popen.py File 10124 bytes April 17 2025 13:10:58.
replace.py File 12441 bytes April 17 2025 13:10:58.
resolve.py File 2103 bytes April 17 2025 13:10:58.
rmtree.py File 2584 bytes April 17 2025 13:10:58.
shouldraise.py File 3664 bytes April 17 2025 13:10:58.
shouldwarn.py File 2266 bytes April 17 2025 13:10:58.
sybil.py File 2334 bytes April 17 2025 13:10:58.
tempdirectory.py File 13196 bytes April 17 2025 13:10:58.
twisted.py File 4915 bytes April 17 2025 13:10:58.
utils.py File 2803 bytes April 17 2025 13:10:58.
version.txt File 6 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11//site-packages/testfixtures/resolve.py

from operator import setitem
from typing import Any, Callable, Optional

from testfixtures import not_there


# Should be Literal[setattr, getattr] but Python 3.8 only.
Setter = Callable[[Any, str, Any], None]


class Resolved:

    def __init__(self, container: Any, setter: Setter, name: str, found: Any):
        self.container: Any = container
        self.setter: Setter = setter
        self.name: str = name
        self.found: Any = found

    def __repr__(self):
        return f'<Resolved: {self.found}>'


def resolve(dotted_name: str, container: Optional[Any] = None) -> Resolved:
    names = dotted_name.split('.')
    used = names.pop(0)
    if container is None:
        found = __import__(used)
        container = found
    else:
        assert not used, 'Absolute traversal not allowed when container supplied'
        used = ''
        found = container
    setter = None
    name = None
    for name in names:
        container = found
        used += '.' + name
        try:
            found = getattr(found, name)
            setter = setattr
        except AttributeError:
            try:
                __import__(used)
            except ImportError:
                setter = setitem
                try:
                    found = found[name]  # pragma: no branch
                except KeyError:
                    found = not_there  # pragma: no branch
                except TypeError:
                    try:
                        name = int(name)
                    except ValueError:
                        setter = setattr
                        found = not_there
                    else:
                        found = found[name]  # pragma: no branch
            else:
                found = getattr(found, name)
                setter = getattr
    return Resolved(container, setter, name, found)


class _Reference:

    @classmethod
    def classmethod(cls):  # pragma: no cover
        pass

    @staticmethod
    def staticmethod(cls):  # pragma: no cover
        pass


class_type = type(_Reference)
classmethod_type = type(_Reference.classmethod)

SILENT KILLER Tool