diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-01-11 10:12:12 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-01-13 10:57:41 -0500 |
commit | fa6dd376bb24845724287d980a98ea50eb1cfab1 (patch) | |
tree | 91e536c76f4b76b8997b02f5cd5a41de29dc90ef /lib/sqlalchemy/ext | |
parent | c703b9ce89483b6f44b97d1fbf56f8df8b14305a (diff) | |
download | sqlalchemy-fa6dd376bb24845724287d980a98ea50eb1cfab1.tar.gz |
Support python3.6
Corrects some warnings and adds tox config. Adds DeprecationWarning
to the error category. Large sweep for string literals w/ backslashes
as this is common in docstrings
Co-authored-by: Andrii Soldatenko
Fixes: #3886
Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r-- | lib/sqlalchemy/ext/associationproxy.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/automap.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/compiler.py | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/declarative/api.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/hybrid.py | 20 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/mutable.py | 6 |
6 files changed, 20 insertions, 20 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index 4ffd2b647..6f570a1fa 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -22,7 +22,7 @@ from ..sql import not_, or_ def association_proxy(target_collection, attr, **kw): - """Return a Python property implementing a view of a target + r"""Return a Python property implementing a view of a target attribute which references an attribute on members of the target. diff --git a/lib/sqlalchemy/ext/automap.py b/lib/sqlalchemy/ext/automap.py index c3a40ada8..57a3a2592 100644 --- a/lib/sqlalchemy/ext/automap.py +++ b/lib/sqlalchemy/ext/automap.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -"""Define an extension to the :mod:`sqlalchemy.ext.declarative` system +r"""Define an extension to the :mod:`sqlalchemy.ext.declarative` system which automatically generates mapped classes and relationships from a database schema, typically though not necessarily one which is reflected. @@ -187,7 +187,7 @@ scheme for class names and a "pluralizer" for collection names using the "Produce a 'camelized' class name, e.g. " "'words_and_underscores' -> 'WordsAndUnderscores'" - return str(tablename[0].upper() + \\ + return str(tablename[0].upper() + \ re.sub(r'_([a-z])', lambda m: m.group(1).upper(), tablename[1:])) _pluralizer = inflect.engine() diff --git a/lib/sqlalchemy/ext/compiler.py b/lib/sqlalchemy/ext/compiler.py index c3f60fd9d..8b2bc95ce 100644 --- a/lib/sqlalchemy/ext/compiler.py +++ b/lib/sqlalchemy/ext/compiler.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -"""Provides an API for creation of custom ClauseElements and compilers. +r"""Provides an API for creation of custom ClauseElements and compilers. Synopsis ======== @@ -159,7 +159,7 @@ is a "frozen" dictionary which supplies a generative ``union()`` method):: from sqlalchemy.sql.expression import Executable, ClauseElement class MyInsertThing(Executable, ClauseElement): - _execution_options = \\ + _execution_options = \ Executable._execution_options.union({'autocommit': True}) More succinctly, if the construct is truly similar to an INSERT, UPDATE, or @@ -362,7 +362,7 @@ accommodates two arguments:: Example usage:: - Session.query(Account).\\ + Session.query(Account).\ filter( greatest( Account.checking_balance, diff --git a/lib/sqlalchemy/ext/declarative/api.py b/lib/sqlalchemy/ext/declarative/api.py index eb8935a4a..7c503d471 100644 --- a/lib/sqlalchemy/ext/declarative/api.py +++ b/lib/sqlalchemy/ext/declarative/api.py @@ -250,7 +250,7 @@ def declarative_base(bind=None, metadata=None, mapper=None, cls=object, name='Base', constructor=_declarative_constructor, class_registry=None, metaclass=DeclarativeMeta): - """Construct a base class for declarative class definitions. + r"""Construct a base class for declarative class definitions. The new base class will be given a metaclass that produces appropriate :class:`~sqlalchemy.schema.Table` objects and makes diff --git a/lib/sqlalchemy/ext/hybrid.py b/lib/sqlalchemy/ext/hybrid.py index 192e28501..509dd560a 100644 --- a/lib/sqlalchemy/ext/hybrid.py +++ b/lib/sqlalchemy/ext/hybrid.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -"""Define attributes on ORM-mapped classes that have "hybrid" behavior. +r"""Define attributes on ORM-mapped classes that have "hybrid" behavior. "hybrid" means the attribute has distinct behaviors defined at the class level and at the instance level. @@ -245,7 +245,7 @@ However, at the expression level, it's expected that the ``User`` class will be used in an appropriate context such that an appropriate join to ``SavingsAccount`` will be present:: - >>> print Session().query(User, User.balance).\\ + >>> print Session().query(User, User.balance).\ ... join(User.accounts).filter(User.balance > 5000) SELECT "user".id AS user_id, "user".name AS user_name, account.balance AS account_balance @@ -303,8 +303,8 @@ we can adjust our ``SavingsAccount`` example to aggregate the balances for @balance.expression def balance(cls): - return select([func.sum(SavingsAccount.balance)]).\\ - where(SavingsAccount.user_id==cls.id).\\ + return select([func.sum(SavingsAccount.balance)]).\ + where(SavingsAccount.user_id==cls.id).\ label('total_balance') The above recipe will give us the ``balance`` column which renders @@ -448,7 +448,7 @@ SQL expression versus SQL expression:: >>> sw2 = aliased(SearchWord) >>> print Session().query( ... sw1.word_insensitive, - ... sw2.word_insensitive).\\ + ... sw2.word_insensitive).\ ... filter( ... sw1.word_insensitive > sw2.word_insensitive ... ) @@ -537,7 +537,7 @@ filtered based on the given criterion:: def transform(q): cls = self.__clause_element__() parent_alias = aliased(cls) - return q.join(parent_alias, cls.parent).\\ + return q.join(parent_alias, cls.parent).\ filter(op(parent_alias.parent, other)) return transform @@ -573,8 +573,8 @@ into :class:`.Query.filter`: >>> from sqlalchemy.orm import Session >>> session = Session() - {sql}>>> session.query(Node).\\ - ... with_transformation(Node.grandparent==Node(id=5)).\\ + {sql}>>> session.query(Node).\ + ... with_transformation(Node.grandparent==Node(id=5)).\ ... all() SELECT node.id AS node_id, node.parent_id AS node_parent_id FROM node JOIN node AS node_1 ON node_1.id = node.parent_id @@ -616,8 +616,8 @@ with each class:: .. sourcecode:: pycon+sql - {sql}>>> session.query(Node).\\ - ... with_transformation(Node.grandparent.join).\\ + {sql}>>> session.query(Node).\ + ... with_transformation(Node.grandparent.join).\ ... filter(Node.grandparent==Node(id=5)) SELECT node.id AS node_id, node.parent_id AS node_parent_id FROM node JOIN node AS node_1 ON node_1.id = node.parent_id diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index b0e2acdf5..3361c4475 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -"""Provide support for tracking of in-place changes to scalar values, +r"""Provide support for tracking of in-place changes to scalar values, which are propagated into ORM change events on owning parent objects. .. versionadded:: 0.7 :mod:`sqlalchemy.ext.mutable` replaces SQLAlchemy's @@ -252,8 +252,8 @@ and to also route attribute set events via ``__setattr__`` to the return self.x, self.y def __eq__(self, other): - return isinstance(other, Point) and \\ - other.x == self.x and \\ + return isinstance(other, Point) and \ + other.x == self.x and \ other.y == self.y def __ne__(self, other): |