update windows build to Python 3.7

This commit is contained in:
j 2019-01-20 16:05:31 +05:30
commit ddc59ab92d
5761 changed files with 750298 additions and 213405 deletions

View file

@ -1,5 +1,5 @@
# orm/__init__.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/attributes.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/base.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/collections.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/dependency.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/deprecated_interfaces.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/descriptor_props.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/dynamic.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/evaluator.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/events.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/exc.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/identity.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/instrumentation.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/interfaces.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/loading.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/mapper.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/path_registry.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/persistence.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/properties.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/query.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/relationships.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/scoping.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@ -21,6 +21,12 @@ class scoped_session(object):
"""
session_factory = None
"""The `session_factory` provided to `__init__` is stored in this
attribute and may be accessed at a later time. This can be useful when
a new non-scoped :class:`.Session` or :class:`.Connection` to the
database is needed."""
def __init__(self, session_factory, scopefunc=None):
"""Construct a new :class:`.scoped_session`.
@ -38,6 +44,7 @@ class scoped_session(object):
"""
self.session_factory = session_factory
if scopefunc:
self.registry = ScopedRegistry(session_factory, scopefunc)
else:
@ -45,12 +52,12 @@ class scoped_session(object):
def __call__(self, **kw):
"""Return the current :class:`.Session`, creating it
using the session factory if not present.
using the :attr:`.scoped_session.session_factory` if not present.
:param \**kw: Keyword arguments will be passed to the
session factory callable, if an existing :class:`.Session`
is not present. If the :class:`.Session` is present and
keyword arguments have been passed,
:attr:`.scoped_session.session_factory` callable, if an existing
:class:`.Session` is not present. If the :class:`.Session` is present
and keyword arguments have been passed,
:exc:`~sqlalchemy.exc.InvalidRequestError` is raised.
"""

View file

@ -1,5 +1,5 @@
# orm/session.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@ -412,23 +412,11 @@ class SessionTransaction(object):
for subtransaction in stx._iterate_parents(upto=self):
subtransaction.close()
if _capture_exception:
captured_exception = sys.exc_info()[1]
boundary = self
if self._state in (ACTIVE, PREPARED):
for transaction in self._iterate_parents():
if transaction._parent is None or transaction.nested:
try:
transaction._rollback_impl()
except Exception:
if _capture_exception:
util.warn(
"An exception raised during a Session "
"persistence operation cannot be raised "
"due to an additional ROLLBACK exception; "
"the exception is: %s" % captured_exception)
raise
transaction._rollback_impl()
transaction._state = DEACTIVE
boundary = transaction
break
@ -450,7 +438,7 @@ class SessionTransaction(object):
self.close()
if self._parent and _capture_exception:
self._parent._rollback_exception = captured_exception
self._parent._rollback_exception = sys.exc_info()[1]
sess.dispatch.after_soft_rollback(sess, self)
@ -1738,6 +1726,9 @@ class Session(_SessionClassMethods):
"all changes on mapped instances before merging with "
"load=False.")
key = mapper._identity_key_from_state(state)
key_is_persistent = attributes.NEVER_SET not in key[1]
else:
key_is_persistent = True
if key in self.identity_map:
merged = self.identity_map[key]
@ -1754,9 +1745,10 @@ class Session(_SessionClassMethods):
self._update_impl(merged_state)
new_instance = True
elif not _none_set.intersection(key[1]) or \
elif key_is_persistent and (
not _none_set.intersection(key[1]) or
(mapper.allow_partial_pks and
not _none_set.issuperset(key[1])):
not _none_set.issuperset(key[1]))):
merged = self.query(mapper.class_).get(key[1])
else:
merged = None
@ -2706,18 +2698,49 @@ class sessionmaker(_SessionClassMethods):
def make_transient(instance):
"""Make the given instance 'transient'.
"""Alter the state of the given instance so that it is :term:`transient`.
This will remove its association with any
session and additionally will remove its "identity key",
such that it's as though the object were newly constructed,
except retaining its values. It also resets the
"deleted" flag on the state if this object
had been explicitly deleted by its session.
.. note::
Attributes which were "expired" or deferred at the
instance level are reverted to undefined, and
will not trigger any loads.
:func:`.make_transient` is a special-case function for
advanced use cases only.
The given mapped instance is assumed to be in the :term:`persistent` or
:term:`detached` state. The function will remove its association with any
:class:`.Session` as well as its :attr:`.InstanceState.identity`. The
effect is that the object will behave as though it were newly constructed,
except retaining any attribute / collection values that were loaded at the
time of the call. The :attr:`.InstanceState.deleted` flag is also reset
if this object had been deleted as a result of using
:meth:`.Session.delete`.
.. warning::
:func:`.make_transient` does **not** "unexpire" or otherwise eagerly
load ORM-mapped attributes that are not currently loaded at the time
the function is called. This includes attributes which:
* were expired via :meth:`.Session.expire`
* were expired as the natural effect of committing a session
transaction, e.g. :meth:`.Session.commit`
* are normally :term:`lazy loaded` but are not currently loaded
* are "deferred" via :ref:`deferred` and are not yet loaded
* were not present in the query which loaded this object, such as that
which is common in joined table inheritance and other scenarios.
After :func:`.make_transient` is called, unloaded attributes such
as those above will normally resolve to the value ``None`` when
accessed, or an empty collection for a collection-oriented attribute.
As the object is transient and un-associated with any database
identity, it will no longer retrieve these values.
.. seealso::
:func:`.make_transient_to_detached`
"""
state = attributes.instance_state(instance)
@ -2739,7 +2762,12 @@ def make_transient(instance):
def make_transient_to_detached(instance):
"""Make the given transient instance 'detached'.
"""Make the given transient instance :term:`detached`.
.. note::
:func:`.make_transient_to_detached` is a special-case function for
advanced use cases only.
All attribute history on the given instance
will be reset as though the instance were freshly loaded

View file

@ -1,5 +1,5 @@
# orm/state.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@ -194,7 +194,7 @@ class InstanceState(interfaces.InspectionAttr):
Returns ``None`` if the object has no primary key identity.
.. note::
An object which is transient or pending
An object which is :term:`transient` or :term:`pending`
does **not** have a mapped identity until it is flushed,
even if its attributes include primary key values.

View file

@ -1,5 +1,5 @@
# orm/strategies.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@ -238,7 +238,7 @@ class DeferredColumnLoader(LoaderStrategy):
(
loadopt and
self.group and
loadopt.local_opts.get('undefer_group', False) == self.group
loadopt.local_opts.get('undefer_group_%s' % self.group, False)
)
or
(

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@ -88,6 +88,7 @@ class Load(Generative, MapperOption):
cloned.local_opts = {}
return cloned
_merge_into_path = False
strategy = None
propagate_to_loaders = False
@ -214,7 +215,15 @@ class Load(Generative, MapperOption):
cloned._set_path_strategy()
def _set_path_strategy(self):
if self.path.has_entity:
if self._merge_into_path:
# special helper for undefer_group
existing = self.path.get(self.context, "loader")
if existing:
existing.local_opts.update(self.local_opts)
else:
self.path.set(self.context, "loader", self)
elif self.path.has_entity:
self.path.parent.set(self.context, "loader", self)
else:
self.path.set(self.context, "loader", self)
@ -411,11 +420,20 @@ class _UnboundLoad(Load):
if effective_path.is_token:
for path in effective_path.generate_for_superclasses():
if self._is_chain_link:
if self._merge_into_path:
# special helper for undefer_group
existing = path.get(context, "loader")
if existing:
existing.local_opts.update(self.local_opts)
else:
path.set(context, "loader", loader)
elif self._is_chain_link:
path.setdefault(context, "loader", loader)
else:
path.set(context, "loader", loader)
else:
# only supported for the undefer_group() wildcard opt
assert not self._merge_into_path
if self._is_chain_link:
effective_path.setdefault(context, "loader", loader)
else:
@ -1025,10 +1043,11 @@ def undefer_group(loadopt, name):
:func:`.orm.undefer`
"""
loadopt._merge_into_path = True
return loadopt.set_column_strategy(
"*",
None,
{"undefer_group": name}
{"undefer_group_%s" % name: True}
)

View file

@ -1,5 +1,5 @@
# orm/sync.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/unitofwork.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under

View file

@ -1,5 +1,5 @@
# orm/util.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under