GRAYBYTE WORDPRESS FILE MANAGER7446

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/astroid/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/astroid//util.py
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt


from __future__ import annotations

import importlib
import sys
import warnings
from typing import Any

import lazy_object_proxy

if sys.version_info >= (3, 8):
    from typing import Final, Literal
else:
    from typing_extensions import Final, Literal


def lazy_descriptor(obj):
    class DescriptorProxy(lazy_object_proxy.Proxy):
        def __get__(self, instance, owner=None):
            return self.__class__.__get__(self, instance)

    return DescriptorProxy(obj)


def lazy_import(module_name: str) -> lazy_object_proxy.Proxy:
    return lazy_object_proxy.Proxy(
        lambda: importlib.import_module("." + module_name, "astroid")
    )


class UninferableBase:
    """Special inference object, which is returned when inference fails.

    This is meant to be used as a singleton. Use astroid.util.Uninferable to access it.
    """

    def __repr__(self) -> Literal["Uninferable"]:
        return "Uninferable"

    __str__ = __repr__

    def __getattribute__(self, name: str) -> Any:
        if name == "next":
            raise AttributeError("next method should not be called")
        if name.startswith("__") and name.endswith("__"):
            return object.__getattribute__(self, name)
        if name == "accept":
            return object.__getattribute__(self, name)
        return self

    def __call__(self, *args: Any, **kwargs: Any) -> UninferableBase:
        return self

    def __bool__(self) -> Literal[False]:
        return False

    __nonzero__ = __bool__

    def accept(self, visitor):
        return visitor.visit_uninferable(self)


Uninferable: Final = UninferableBase()


class BadOperationMessage:
    """Object which describes a TypeError occurred somewhere in the inference chain.

    This is not an exception, but a container object which holds the types and
    the error which occurred.
    """


class BadUnaryOperationMessage(BadOperationMessage):
    """Object which describes operational failures on UnaryOps."""

    def __init__(self, operand, op, error):
        self.operand = operand
        self.op = op
        self.error = error

    @property
    def _object_type_helper(self):
        helpers = lazy_import("helpers")
        return helpers.object_type

    def _object_type(self, obj):
        objtype = self._object_type_helper(obj)
        if isinstance(objtype, UninferableBase):
            return None

        return objtype

    def __str__(self) -> str:
        if hasattr(self.operand, "name"):
            operand_type = self.operand.name
        else:
            object_type = self._object_type(self.operand)
            if hasattr(object_type, "name"):
                operand_type = object_type.name
            else:
                # Just fallback to as_string
                operand_type = object_type.as_string()

        msg = "bad operand type for unary {}: {}"
        return msg.format(self.op, operand_type)


class BadBinaryOperationMessage(BadOperationMessage):
    """Object which describes type errors for BinOps."""

    def __init__(self, left_type, op, right_type):
        self.left_type = left_type
        self.right_type = right_type
        self.op = op

    def __str__(self) -> str:
        msg = "unsupported operand type(s) for {}: {!r} and {!r}"
        return msg.format(self.op, self.left_type.name, self.right_type.name)


def _instancecheck(cls, other) -> bool:
    wrapped = cls.__wrapped__
    other_cls = other.__class__
    is_instance_of = wrapped is other_cls or issubclass(other_cls, wrapped)
    warnings.warn(
        "%r is deprecated and slated for removal in astroid "
        "2.0, use %r instead" % (cls.__class__.__name__, wrapped.__name__),
        PendingDeprecationWarning,
        stacklevel=2,
    )
    return is_instance_of


def proxy_alias(alias_name, node_type):
    """Get a Proxy from the given name to the given node type."""
    proxy = type(
        alias_name,
        (lazy_object_proxy.Proxy,),
        {
            "__class__": object.__dict__["__class__"],
            "__instancecheck__": _instancecheck,
        },
    )
    return proxy(lambda: node_type)


def check_warnings_filter() -> bool:
    """Return True if any other than the default DeprecationWarning filter is enabled.

    https://docs.python.org/3/library/warnings.html#default-warning-filter
    """
    return any(
        issubclass(DeprecationWarning, filter[2])
        and filter[0] != "ignore"
        and filter[3] != "__main__"
        for filter in warnings.filters
    )

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 25 2025 08:31:36
root / root
0755
__pycache__
--
May 15 2025 08:30:33
root / root
0755
brain
--
May 15 2025 08:30:33
root / root
0755
interpreter
--
May 15 2025 08:30:33
root / root
0755
nodes
--
May 15 2025 08:30:33
root / root
0755
__init__.py
4.984 KB
April 17 2025 13:10:59
root / root
0644
__pkginfo__.py
0.268 KB
April 17 2025 13:10:59
root / root
0644
_ast.py
4.049 KB
April 17 2025 13:10:59
root / root
0644
_backport_stdlib_names.py
6.852 KB
April 17 2025 13:10:59
root / root
0644
_cache.py
0.768 KB
April 17 2025 13:10:59
root / root
0644
arguments.py
12.654 KB
April 17 2025 13:10:59
root / root
0644
astroid_manager.py
0.559 KB
April 17 2025 13:10:59
root / root
0644
bases.py
24.994 KB
April 17 2025 13:10:59
root / root
0644
builder.py
18.348 KB
April 17 2025 13:10:59
root / root
0644
const.py
1.069 KB
April 17 2025 13:10:59
root / root
0644
constraint.py
4.925 KB
April 17 2025 13:10:59
root / root
0644
context.py
5.854 KB
April 17 2025 13:10:59
root / root
0644
decorators.py
9.854 KB
April 17 2025 13:10:59
root / root
0644
exceptions.py
12.782 KB
April 17 2025 13:10:59
root / root
0644
filter_statements.py
9.417 KB
April 17 2025 13:10:59
root / root
0644
helpers.py
11.07 KB
April 17 2025 13:10:59
root / root
0644
inference.py
44.063 KB
April 17 2025 13:10:59
root / root
0644
inference_tip.py
2.82 KB
April 17 2025 13:10:59
root / root
0644
manager.py
17.539 KB
April 17 2025 13:10:59
root / root
0644
mixins.py
1.154 KB
April 17 2025 13:10:59
root / root
0644
modutils.py
22.957 KB
April 17 2025 13:10:59
root / root
0644
node_classes.py
1.797 KB
April 17 2025 13:10:59
root / root
0644
objects.py
12.458 KB
April 17 2025 13:10:59
root / root
0644
protocols.py
32.203 KB
April 17 2025 13:10:59
root / root
0644
raw_building.py
22.339 KB
April 17 2025 13:10:59
root / root
0644
rebuilder.py
77.862 KB
April 17 2025 13:10:59
root / root
0644
scoped_nodes.py
0.936 KB
April 17 2025 13:10:59
root / root
0644
test_utils.py
2.377 KB
April 17 2025 13:10:59
root / root
0644
transforms.py
3.194 KB
April 17 2025 13:10:59
root / root
0644
typing.py
1.937 KB
April 17 2025 13:10:59
root / root
0644
util.py
4.618 KB
April 17 2025 13:10:59
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF