SILENT KILLERPanel

Current Path: > > opt > alt > python37 > lib64 > python3.7 > > > site-packages > pyrsistent


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/alt/python37/lib64/python3.7///site-packages/pyrsistent

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 1479 bytes July 07 2018 13:53:48.
__init__.pyi File 5046 bytes December 19 2018 21:07:14.
_checked_types.py File 18312 bytes October 14 2018 10:06:35.
_compat.py File 521 bytes October 14 2018 10:06:35.
_field_common.py File 10804 bytes October 14 2018 10:06:35.
_helpers.py File 2475 bytes July 07 2018 13:53:48.
_immutable.py File 3559 bytes July 08 2018 07:16:39.
_pbag.py File 6754 bytes October 14 2018 10:06:35.
_pclass.py File 9398 bytes November 17 2018 05:52:33.
_pdeque.py File 12184 bytes October 14 2018 10:06:35.
_plist.py File 8282 bytes October 14 2018 10:06:35.
_pmap.py File 14643 bytes October 14 2018 10:06:35.
_precord.py File 6574 bytes November 17 2018 05:52:33.
_pset.py File 5718 bytes October 14 2018 10:06:35.
_pvector.py File 22731 bytes October 14 2018 10:06:35.
_toolz.py File 3427 bytes July 07 2018 13:53:48.
_transformations.py File 3583 bytes July 07 2018 13:53:48.
py.typed File 0 bytes November 20 2018 21:52:04.
typing.py File 1415 bytes November 17 2018 05:52:33.
typing.pyi File 7030 bytes November 20 2018 21:52:04.

Reading File: //opt/alt/python37/lib64/python3.7///site-packages/pyrsistent/_helpers.py

from functools import wraps
import six
from pyrsistent._pmap import PMap, pmap
from pyrsistent._pset import PSet, pset
from pyrsistent._pvector import PVector, pvector


def freeze(o):
    """
    Recursively convert simple Python containers into pyrsistent versions
    of those containers.

    - list is converted to pvector, recursively
    - dict is converted to pmap, recursively on values (but not keys)
    - set is converted to pset, but not recursively
    - tuple is converted to tuple, recursively.

    Sets and dict keys are not recursively frozen because they do not contain
    mutable data by convention. The main exception to this rule is that
    dict keys and set elements are often instances of mutable objects that
    support hash-by-id, which this function can't convert anyway.

    >>> freeze(set([1, 2]))
    pset([1, 2])
    >>> freeze([1, {'a': 3}])
    pvector([1, pmap({'a': 3})])
    >>> freeze((1, []))
    (1, pvector([]))
    """
    typ = type(o)
    if typ is dict:
        return pmap(dict((k, freeze(v)) for k, v in six.iteritems(o)))
    if typ is list:
        return pvector(map(freeze, o))
    if typ is tuple:
        return tuple(map(freeze, o))
    if typ is set:
        return pset(o)
    return o


def thaw(o):
    """
    Recursively convert pyrsistent containers into simple Python containers.

    - pvector is converted to list, recursively
    - pmap is converted to dict, recursively on values (but not keys)
    - pset is converted to set, but not recursively
    - tuple is converted to tuple, recursively.

    >>> from pyrsistent import s, m, v
    >>> thaw(s(1, 2))
    set([1, 2])
    >>> thaw(v(1, m(a=3)))
    [1, {'a': 3}]
    >>> thaw((1, v()))
    (1, [])
    """
    if isinstance(o, PVector):
        return list(map(thaw, o))
    if isinstance(o, PMap):
        return dict((k, thaw(v)) for k, v in o.iteritems())
    if isinstance(o, PSet):
        return set(o)
    if type(o) is tuple:
        return tuple(map(thaw, o))
    return o


def mutant(fn):
    """
    Convenience decorator to isolate mutation to within the decorated function (with respect
    to the input arguments).

    All arguments to the decorated function will be frozen so that they are guaranteed not to change.
    The return value is also frozen.
    """
    @wraps(fn)
    def inner_f(*args, **kwargs):
        return freeze(fn(*[freeze(e) for e in args], **dict(freeze(item) for item in kwargs.items())))

    return inner_f

SILENT KILLER Tool