$15 GRAYBYTE WORDPRESS FILE MANAGER $27

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib64/python2.7/site-packages/sqlalchemy/orm/

HOME
Current File : /lib64/python2.7/site-packages/sqlalchemy/orm//exc.py
# orm/exc.py
# Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php

"""SQLAlchemy ORM exceptions."""
from .. import exc as sa_exc
from .. import util
from ..exc import MultipleResultsFound  # noqa
from ..exc import NoResultFound  # noqa


NO_STATE = (AttributeError, KeyError)
"""Exception types that may be raised by instrumentation implementations."""


class StaleDataError(sa_exc.SQLAlchemyError):
    """An operation encountered database state that is unaccounted for.

    Conditions which cause this to happen include:

    * A flush may have attempted to update or delete rows
      and an unexpected number of rows were matched during
      the UPDATE or DELETE statement.   Note that when
      version_id_col is used, rows in UPDATE or DELETE statements
      are also matched against the current known version
      identifier.

    * A mapped object with version_id_col was refreshed,
      and the version number coming back from the database does
      not match that of the object itself.

    * A object is detached from its parent object, however
      the object was previously attached to a different parent
      identity which was garbage collected, and a decision
      cannot be made if the new parent was really the most
      recent "parent".

    """


ConcurrentModificationError = StaleDataError


class FlushError(sa_exc.SQLAlchemyError):
    """A invalid condition was detected during flush()."""


class UnmappedError(sa_exc.InvalidRequestError):
    """Base for exceptions that involve expected mappings not present."""


class ObjectDereferencedError(sa_exc.SQLAlchemyError):
    """An operation cannot complete due to an object being garbage
    collected.

    """


class DetachedInstanceError(sa_exc.SQLAlchemyError):
    """An attempt to access unloaded attributes on a
    mapped instance that is detached."""

    code = "bhk3"


class UnmappedInstanceError(UnmappedError):
    """An mapping operation was requested for an unknown instance."""

    @util.preload_module("sqlalchemy.orm.base")
    def __init__(self, obj, msg=None):
        base = util.preloaded.orm_base

        if not msg:
            try:
                base.class_mapper(type(obj))
                name = _safe_cls_name(type(obj))
                msg = (
                    "Class %r is mapped, but this instance lacks "
                    "instrumentation.  This occurs when the instance "
                    "is created before sqlalchemy.orm.mapper(%s) "
                    "was called." % (name, name)
                )
            except UnmappedClassError:
                msg = _default_unmapped(type(obj))
                if isinstance(obj, type):
                    msg += (
                        "; was a class (%s) supplied where an instance was "
                        "required?" % _safe_cls_name(obj)
                    )
        UnmappedError.__init__(self, msg)

    def __reduce__(self):
        return self.__class__, (None, self.args[0])


class UnmappedClassError(UnmappedError):
    """An mapping operation was requested for an unknown class."""

    def __init__(self, cls, msg=None):
        if not msg:
            msg = _default_unmapped(cls)
        UnmappedError.__init__(self, msg)

    def __reduce__(self):
        return self.__class__, (None, self.args[0])


class ObjectDeletedError(sa_exc.InvalidRequestError):
    """A refresh operation failed to retrieve the database
    row corresponding to an object's known primary key identity.

    A refresh operation proceeds when an expired attribute is
    accessed on an object, or when :meth:`_query.Query.get` is
    used to retrieve an object which is, upon retrieval, detected
    as expired.   A SELECT is emitted for the target row
    based on primary key; if no row is returned, this
    exception is raised.

    The true meaning of this exception is simply that
    no row exists for the primary key identifier associated
    with a persistent object.   The row may have been
    deleted, or in some cases the primary key updated
    to a new value, outside of the ORM's management of the target
    object.

    """

    @util.preload_module("sqlalchemy.orm.base")
    def __init__(self, state, msg=None):
        base = util.preloaded.orm_base

        if not msg:
            msg = (
                "Instance '%s' has been deleted, or its "
                "row is otherwise not present." % base.state_str(state)
            )

        sa_exc.InvalidRequestError.__init__(self, msg)

    def __reduce__(self):
        return self.__class__, (None, self.args[0])


class UnmappedColumnError(sa_exc.InvalidRequestError):
    """Mapping operation was requested on an unknown column."""


class LoaderStrategyException(sa_exc.InvalidRequestError):
    """A loader strategy for an attribute does not exist."""

    def __init__(
        self,
        applied_to_property_type,
        requesting_property,
        applies_to,
        actual_strategy_type,
        strategy_key,
    ):
        if actual_strategy_type is None:
            sa_exc.InvalidRequestError.__init__(
                self,
                "Can't find strategy %s for %s"
                % (strategy_key, requesting_property),
            )
        else:
            sa_exc.InvalidRequestError.__init__(
                self,
                'Can\'t apply "%s" strategy to property "%s", '
                'which is a "%s"; this loader strategy is intended '
                'to be used with a "%s".'
                % (
                    util.clsname_as_plain_name(actual_strategy_type),
                    requesting_property,
                    util.clsname_as_plain_name(applied_to_property_type),
                    util.clsname_as_plain_name(applies_to),
                ),
            )


def _safe_cls_name(cls):
    try:
        cls_name = ".".join((cls.__module__, cls.__name__))
    except AttributeError:
        cls_name = getattr(cls, "__name__", None)
        if cls_name is None:
            cls_name = repr(cls)
    return cls_name


@util.preload_module("sqlalchemy.orm.base")
def _default_unmapped(cls):
    base = util.preloaded.orm_base

    try:
        mappers = base.manager_of_class(cls).mappers
    except (TypeError,) + NO_STATE:
        mappers = {}
    name = _safe_cls_name(cls)

    if not mappers:
        return "Class '%s' is not mapped" % name

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
23 Sep 2024 10.41 AM
root / root
0755
__init__.py
10.707 KB
5 Sep 2024 10.50 PM
root / root
0644
__init__.pyc
12.471 KB
23 Sep 2024 10.41 AM
root / root
0644
attributes.py
75.885 KB
5 Sep 2024 10.50 PM
root / root
0644
attributes.pyc
68.515 KB
23 Sep 2024 10.41 AM
root / root
0644
base.py
14.881 KB
5 Sep 2024 10.50 PM
root / root
0644
base.pyc
14.961 KB
23 Sep 2024 10.41 AM
root / root
0644
clsregistry.py
12.987 KB
5 Sep 2024 10.50 PM
root / root
0644
clsregistry.pyc
14.702 KB
23 Sep 2024 10.41 AM
root / root
0644
collections.py
53.44 KB
5 Sep 2024 10.50 PM
root / root
0644
collections.pyc
61.913 KB
23 Sep 2024 10.41 AM
root / root
0644
context.py
108.652 KB
5 Sep 2024 10.50 PM
root / root
0644
context.pyc
61.606 KB
23 Sep 2024 10.41 AM
root / root
0644
decl_api.py
34.724 KB
5 Sep 2024 10.50 PM
root / root
0644
decl_api.pyc
37.08 KB
23 Sep 2024 10.41 AM
root / root
0644
decl_base.py
43.69 KB
5 Sep 2024 10.50 PM
root / root
0644
decl_base.pyc
30.072 KB
23 Sep 2024 10.41 AM
root / root
0644
dependency.py
45.886 KB
5 Sep 2024 10.50 PM
root / root
0644
dependency.pyc
28.217 KB
23 Sep 2024 10.41 AM
root / root
0644
descriptor_props.py
25.378 KB
5 Sep 2024 10.50 PM
root / root
0644
descriptor_props.pyc
27.322 KB
23 Sep 2024 10.41 AM
root / root
0644
dynamic.py
15.638 KB
5 Sep 2024 10.50 PM
root / root
0644
dynamic.pyc
16.155 KB
23 Sep 2024 10.41 AM
root / root
0644
evaluator.py
7.756 KB
5 Sep 2024 10.50 PM
root / root
0644
evaluator.pyc
10.283 KB
23 Sep 2024 10.41 AM
root / root
0644
events.py
109.648 KB
5 Sep 2024 10.50 PM
root / root
0644
events.pyc
116.313 KB
23 Sep 2024 10.41 AM
root / root
0644
exc.py
6.379 KB
5 Sep 2024 10.50 PM
root / root
0644
exc.pyc
8.012 KB
23 Sep 2024 10.41 AM
root / root
0644
identity.py
7.063 KB
5 Sep 2024 10.50 PM
root / root
0644
identity.pyc
9.846 KB
23 Sep 2024 10.41 AM
root / root
0644
instrumentation.py
19.914 KB
5 Sep 2024 10.50 PM
root / root
0644
instrumentation.pyc
21.94 KB
23 Sep 2024 10.41 AM
root / root
0644
interfaces.py
31.586 KB
5 Sep 2024 10.50 PM
root / root
0644
interfaces.pyc
36.536 KB
23 Sep 2024 10.41 AM
root / root
0644
loading.py
48.161 KB
5 Sep 2024 10.50 PM
root / root
0644
loading.pyc
28.739 KB
23 Sep 2024 10.41 AM
root / root
0644
mapper.py
140.959 KB
5 Sep 2024 10.50 PM
root / root
0644
mapper.pyc
106.941 KB
23 Sep 2024 10.41 AM
root / root
0644
path_registry.py
16.008 KB
5 Sep 2024 10.50 PM
root / root
0644
path_registry.pyc
17.739 KB
23 Sep 2024 10.41 AM
root / root
0644
persistence.py
82.275 KB
5 Sep 2024 10.50 PM
root / root
0644
persistence.pyc
48.377 KB
23 Sep 2024 10.41 AM
root / root
0644
properties.py
14.438 KB
5 Sep 2024 10.50 PM
root / root
0644
properties.pyc
14.746 KB
23 Sep 2024 10.41 AM
root / root
0644
query.py
122.999 KB
5 Sep 2024 10.50 PM
root / root
0644
query.pyc
119.512 KB
23 Sep 2024 10.41 AM
root / root
0644
relationships.py
140.622 KB
5 Sep 2024 10.50 PM
root / root
0644
relationships.pyc
114.873 KB
23 Sep 2024 10.41 AM
root / root
0644
scoping.py
7.087 KB
5 Sep 2024 10.50 PM
root / root
0644
scoping.pyc
7.317 KB
23 Sep 2024 10.41 AM
root / root
0644
session.py
158.795 KB
5 Sep 2024 10.50 PM
root / root
0644
session.pyc
142.412 KB
23 Sep 2024 10.41 AM
root / root
0644
state.py
32.738 KB
5 Sep 2024 10.50 PM
root / root
0644
state.pyc
32.091 KB
23 Sep 2024 10.41 AM
root / root
0644
strategies.py
105.8 KB
5 Sep 2024 10.50 PM
root / root
0644
strategies.pyc
65.906 KB
23 Sep 2024 10.41 AM
root / root
0644
strategy_options.py
66.687 KB
5 Sep 2024 10.50 PM
root / root
0644
strategy_options.pyc
58.673 KB
23 Sep 2024 10.41 AM
root / root
0644
sync.py
5.688 KB
5 Sep 2024 10.50 PM
root / root
0644
sync.pyc
4.58 KB
23 Sep 2024 10.41 AM
root / root
0644
unitofwork.py
26.455 KB
5 Sep 2024 10.50 PM
root / root
0644
unitofwork.pyc
24.882 KB
23 Sep 2024 10.41 AM
root / root
0644
util.py
74.473 KB
5 Sep 2024 10.50 PM
root / root
0644
util.pyc
69.456 KB
23 Sep 2024 10.41 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF