GRAYBYTE WORDPRESS FILE MANAGER2038

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
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/hc_python/lib/python3.12/site-packages/sqlalchemy/orm/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/lib/python3.12/site-packages/sqlalchemy/orm//sync.py
# orm/sync.py
# Copyright (C) 2005-2025 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
# mypy: allow-untyped-defs, allow-untyped-calls


"""private module containing functions used for copying data
between instances based on join conditions.

"""

from __future__ import annotations

from . import exc
from . import util as orm_util
from .base import PassiveFlag


def populate(
    source,
    source_mapper,
    dest,
    dest_mapper,
    synchronize_pairs,
    uowcommit,
    flag_cascaded_pks,
):
    source_dict = source.dict
    dest_dict = dest.dict

    for l, r in synchronize_pairs:
        try:
            # inline of source_mapper._get_state_attr_by_column
            prop = source_mapper._columntoproperty[l]
            value = source.manager[prop.key].impl.get(
                source, source_dict, PassiveFlag.PASSIVE_OFF
            )
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(False, source_mapper, l, dest_mapper, r, err)

        try:
            # inline of dest_mapper._set_state_attr_by_column
            prop = dest_mapper._columntoproperty[r]
            dest.manager[prop.key].impl.set(dest, dest_dict, value, None)
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(True, source_mapper, l, dest_mapper, r, err)

        # technically the "r.primary_key" check isn't
        # needed here, but we check for this condition to limit
        # how often this logic is invoked for memory/performance
        # reasons, since we only need this info for a primary key
        # destination.
        if (
            flag_cascaded_pks
            and l.primary_key
            and r.primary_key
            and r.references(l)
        ):
            uowcommit.attributes[("pk_cascaded", dest, r)] = True


def bulk_populate_inherit_keys(source_dict, source_mapper, synchronize_pairs):
    # a simplified version of populate() used by bulk insert mode
    for l, r in synchronize_pairs:
        try:
            prop = source_mapper._columntoproperty[l]
            value = source_dict[prop.key]
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(False, source_mapper, l, source_mapper, r, err)

        try:
            prop = source_mapper._columntoproperty[r]
            source_dict[prop.key] = value
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(True, source_mapper, l, source_mapper, r, err)


def clear(dest, dest_mapper, synchronize_pairs):
    for l, r in synchronize_pairs:
        if (
            r.primary_key
            and dest_mapper._get_state_attr_by_column(dest, dest.dict, r)
            not in orm_util._none_set
        ):
            raise AssertionError(
                f"Dependency rule on column '{l}' "
                "tried to blank-out primary key "
                f"column '{r}' on instance '{orm_util.state_str(dest)}'"
            )
        try:
            dest_mapper._set_state_attr_by_column(dest, dest.dict, r, None)
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(True, None, l, dest_mapper, r, err)


def update(source, source_mapper, dest, old_prefix, synchronize_pairs):
    for l, r in synchronize_pairs:
        try:
            oldvalue = source_mapper._get_committed_attr_by_column(
                source.obj(), l
            )
            value = source_mapper._get_state_attr_by_column(
                source, source.dict, l, passive=PassiveFlag.PASSIVE_OFF
            )
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(False, source_mapper, l, None, r, err)
        dest[r.key] = value
        dest[old_prefix + r.key] = oldvalue


def populate_dict(source, source_mapper, dict_, synchronize_pairs):
    for l, r in synchronize_pairs:
        try:
            value = source_mapper._get_state_attr_by_column(
                source, source.dict, l, passive=PassiveFlag.PASSIVE_OFF
            )
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(False, source_mapper, l, None, r, err)

        dict_[r.key] = value


def source_modified(uowcommit, source, source_mapper, synchronize_pairs):
    """return true if the source object has changes from an old to a
    new value on the given synchronize pairs

    """
    for l, r in synchronize_pairs:
        try:
            prop = source_mapper._columntoproperty[l]
        except exc.UnmappedColumnError as err:
            _raise_col_to_prop(False, source_mapper, l, None, r, err)
        history = uowcommit.get_attribute_history(
            source, prop.key, PassiveFlag.PASSIVE_NO_INITIALIZE
        )
        if bool(history.deleted):
            return True
    else:
        return False


def _raise_col_to_prop(
    isdest, source_mapper, source_column, dest_mapper, dest_column, err
):
    if isdest:
        raise exc.UnmappedColumnError(
            "Can't execute sync rule for "
            "destination column '%s'; mapper '%s' does not map "
            "this column.  Try using an explicit `foreign_keys` "
            "collection which does not include this column (or use "
            "a viewonly=True relation)." % (dest_column, dest_mapper)
        ) from err
    else:
        raise exc.UnmappedColumnError(
            "Can't execute sync rule for "
            "source column '%s'; mapper '%s' does not map this "
            "column.  Try using an explicit `foreign_keys` "
            "collection which does not include destination column "
            "'%s' (or use a viewonly=True relation)."
            % (source_column, source_mapper, dest_column)
        ) from err

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 04 2025 08:00:23
root / root
0755
__pycache__
--
April 04 2025 08:00:24
root / root
0755
__init__.py
8.265 KB
April 04 2025 08:00:23
root / root
0644
_orm_constructors.py
101.197 KB
April 04 2025 08:00:23
root / root
0644
_typing.py
4.856 KB
April 04 2025 08:00:23
root / root
0644
attributes.py
90.365 KB
April 04 2025 08:00:23
root / root
0644
base.py
26.856 KB
April 04 2025 08:00:23
root / root
0644
bulk_persistence.py
70.96 KB
April 04 2025 08:00:23
root / root
0644
clsregistry.py
17.553 KB
April 04 2025 08:00:23
root / root
0644
collections.py
51.027 KB
April 04 2025 08:00:23
root / root
0644
context.py
112.415 KB
April 04 2025 08:00:23
root / root
0644
decl_api.py
63.446 KB
April 04 2025 08:00:23
root / root
0644
decl_base.py
81.336 KB
April 04 2025 08:00:23
root / root
0644
dependency.py
46.515 KB
April 04 2025 08:00:23
root / root
0644
descriptor_props.py
36.358 KB
April 04 2025 08:00:23
root / root
0644
dynamic.py
9.586 KB
April 04 2025 08:00:23
root / root
0644
evaluator.py
12.063 KB
April 04 2025 08:00:23
root / root
0644
events.py
124.786 KB
April 04 2025 08:00:23
root / root
0644
exc.py
7.239 KB
April 04 2025 08:00:23
root / root
0644
identity.py
9.032 KB
April 04 2025 08:00:23
root / root
0644
instrumentation.py
23.751 KB
April 04 2025 08:00:23
root / root
0644
interfaces.py
47.653 KB
April 04 2025 08:00:23
root / root
0644
loading.py
56.911 KB
April 04 2025 08:00:23
root / root
0644
mapped_collection.py
19.221 KB
April 04 2025 08:00:23
root / root
0644
mapper.py
167.632 KB
April 04 2025 08:00:23
root / root
0644
path_registry.py
25.309 KB
April 04 2025 08:00:23
root / root
0644
persistence.py
60.255 KB
April 04 2025 08:00:23
root / root
0644
properties.py
28.384 KB
April 04 2025 08:00:23
root / root
0644
query.py
115.954 KB
April 04 2025 08:00:23
root / root
0644
relationships.py
125.878 KB
April 04 2025 08:00:23
root / root
0644
scoping.py
76.774 KB
April 04 2025 08:00:23
root / root
0644
session.py
191.518 KB
April 04 2025 08:00:23
root / root
0644
state.py
36.787 KB
April 04 2025 08:00:23
root / root
0644
state_changes.py
6.655 KB
April 04 2025 08:00:23
root / root
0644
strategies.py
117.057 KB
April 04 2025 08:00:23
root / root
0644
strategy_options.py
83.05 KB
April 04 2025 08:00:23
root / root
0644
sync.py
5.644 KB
April 04 2025 08:00:23
root / root
0644
unitofwork.py
26.399 KB
April 04 2025 08:00:23
root / root
0644
util.py
78.937 KB
April 04 2025 08:00:23
root / root
0644
writeonly.py
21.782 KB
April 04 2025 08:00:23
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF