summaryrefslogtreecommitdiff
path: root/doc/build/orm
diff options
context:
space:
mode:
authorJeffrey Finkelstein <jeffrey.finkelstein@gmail.com>2016-05-03 21:02:29 -0400
committerJeffrey Finkelstein <jeffrey.finkelstein@gmail.com>2016-05-03 21:02:29 -0400
commitc31833e9973ef3b9fd4528e19eec0458bc8d51ee (patch)
tree01f751348e4f7fcf7c73877e2cad324e102024da /doc/build/orm
parent9a3c9ba7beb18dfd6232deb895528ea8593a12b0 (diff)
downloadsqlalchemy-pr/268.tar.gz
Adds parentheses around print statements in docs.pr/268
Diffstat (limited to 'doc/build/orm')
-rw-r--r--doc/build/orm/backref.rst6
-rw-r--r--doc/build/orm/basic_relationships.rst4
-rw-r--r--doc/build/orm/collections.rst2
-rw-r--r--doc/build/orm/composites.rst2
-rw-r--r--doc/build/orm/contextual.rst4
-rw-r--r--doc/build/orm/extensions/declarative/mixins.rst2
-rw-r--r--doc/build/orm/loading_columns.rst4
-rw-r--r--doc/build/orm/mapped_attributes.rst4
-rw-r--r--doc/build/orm/mapped_sql_expr.rst2
-rw-r--r--doc/build/orm/session_state_management.rst4
-rw-r--r--doc/build/orm/session_transaction.rst2
11 files changed, 18 insertions, 18 deletions
diff --git a/doc/build/orm/backref.rst b/doc/build/orm/backref.rst
index 16cfe5606..1165d7fa9 100644
--- a/doc/build/orm/backref.rst
+++ b/doc/build/orm/backref.rst
@@ -71,7 +71,7 @@ is ``None``::
>>> a1 = Address()
>>> u1.addresses
[]
- >>> print a1.user
+ >>> print(a1.user)
None
However, once the ``Address`` is appended to the ``u1.addresses`` collection,
@@ -144,10 +144,10 @@ as if we limited the list of ``Address`` objects to those which start with "tony
We can observe, by inspecting the resulting property, that both sides
of the relationship have this join condition applied::
- >>> print User.addresses.property.primaryjoin
+ >>> print(User.addresses.property.primaryjoin)
"user".id = address.user_id AND address.email LIKE :email_1 || '%%'
>>>
- >>> print Address.user.property.primaryjoin
+ >>> print(Address.user.property.primaryjoin)
"user".id = address.user_id AND address.email LIKE :email_1 || '%%'
>>>
diff --git a/doc/build/orm/basic_relationships.rst b/doc/build/orm/basic_relationships.rst
index de156c265..069f8e73f 100644
--- a/doc/build/orm/basic_relationships.rst
+++ b/doc/build/orm/basic_relationships.rst
@@ -359,8 +359,8 @@ association object::
# iterate through child objects via association, including association
# attributes
for assoc in p.children:
- print assoc.extra_data
- print assoc.child
+ print(assoc.extra_data)
+ print(assoc.child)
To enhance the association object pattern such that direct
access to the ``Association`` object is optional, SQLAlchemy
diff --git a/doc/build/orm/collections.rst b/doc/build/orm/collections.rst
index f37a36b40..d79f71b2a 100644
--- a/doc/build/orm/collections.rst
+++ b/doc/build/orm/collections.rst
@@ -198,7 +198,7 @@ this collection is a ``list``::
parent = Parent()
parent.children.append(Child())
- print parent.children[0]
+ print(parent.children[0])
Collections are not limited to lists. Sets, mutable sequences and almost any
other Python object that can act as a container can be used in place of the
diff --git a/doc/build/orm/composites.rst b/doc/build/orm/composites.rst
index 1c42564b1..ef4ea8954 100644
--- a/doc/build/orm/composites.rst
+++ b/doc/build/orm/composites.rst
@@ -87,7 +87,7 @@ using the ``.start`` and ``.end`` attributes against ad-hoc ``Point`` instances:
>>> v = Vertex(start=Point(3, 4), end=Point(5, 6))
>>> session.add(v)
>>> q = session.query(Vertex).filter(Vertex.start == Point(3, 4))
- {sql}>>> print q.first().start
+ {sql}>>> print(q.first().start)
BEGIN (implicit)
INSERT INTO vertice (x1, y1, x2, y2) VALUES (?, ?, ?, ?)
(3, 4, 5, 6)
diff --git a/doc/build/orm/contextual.rst b/doc/build/orm/contextual.rst
index cc7016f80..fe5e30571 100644
--- a/doc/build/orm/contextual.rst
+++ b/doc/build/orm/contextual.rst
@@ -96,9 +96,9 @@ underlying :class:`.Session` being maintained by the registry::
# equivalent to:
#
# session = Session()
- # print session.query(MyClass).all()
+ # print(session.query(MyClass).all())
#
- print Session.query(MyClass).all()
+ print(Session.query(MyClass).all())
The above code accomplishes the same task as that of acquiring the current
:class:`.Session` by calling upon the registry, then using that :class:`.Session`.
diff --git a/doc/build/orm/extensions/declarative/mixins.rst b/doc/build/orm/extensions/declarative/mixins.rst
index 917c55f88..e4acc8750 100644
--- a/doc/build/orm/extensions/declarative/mixins.rst
+++ b/doc/build/orm/extensions/declarative/mixins.rst
@@ -357,7 +357,7 @@ This list will generate a collection
of ``StringAttribute`` objects, which are persisted into a table that's
local to either the ``type_a_strings`` or ``type_b_strings`` table::
- >>> print ta._strings
+ >>> print(ta._strings)
[<__main__.StringAttribute object at 0x10151cd90>,
<__main__.StringAttribute object at 0x10151ce10>]
diff --git a/doc/build/orm/loading_columns.rst b/doc/build/orm/loading_columns.rst
index 2d0f02ed5..0537108a6 100644
--- a/doc/build/orm/loading_columns.rst
+++ b/doc/build/orm/loading_columns.rst
@@ -156,7 +156,7 @@ The bundle allows columns to be grouped together::
bn = Bundle('mybundle', MyClass.data1, MyClass.data2)
for row in session.query(bn).filter(bn.c.data1 == 'd1'):
- print row.mybundle.data1, row.mybundle.data2
+ print(row.mybundle.data1, row.mybundle.data2)
The bundle can be subclassed to provide custom behaviors when results
are fetched. The method :meth:`.Bundle.create_row_processor` is given
@@ -187,7 +187,7 @@ A result from the above bundle will return dictionary values::
bn = DictBundle('mybundle', MyClass.data1, MyClass.data2)
for row in session.query(bn).filter(bn.c.data1 == 'd1'):
- print row.mybundle['data1'], row.mybundle['data2']
+ print(row.mybundle['data1'], row.mybundle['data2'])
The :class:`.Bundle` construct is also integrated into the behavior
of :func:`.composite`, where it is used to return composite attributes as objects
diff --git a/doc/build/orm/mapped_attributes.rst b/doc/build/orm/mapped_attributes.rst
index 2e7e9b3eb..fe98adc97 100644
--- a/doc/build/orm/mapped_attributes.rst
+++ b/doc/build/orm/mapped_attributes.rst
@@ -254,10 +254,10 @@ The above class ``MyClass`` has two attributes, ``.job_status`` and
``.status`` that will behave as one attribute, both at the expression
level::
- >>> print MyClass.job_status == 'some_status'
+ >>> print(MyClass.job_status == 'some_status')
my_table.job_status = :job_status_1
- >>> print MyClass.status == 'some_status'
+ >>> print(MyClass.status == 'some_status')
my_table.job_status = :job_status_1
and at the instance level::
diff --git a/doc/build/orm/mapped_sql_expr.rst b/doc/build/orm/mapped_sql_expr.rst
index e091e33a6..bc9e7a9f7 100644
--- a/doc/build/orm/mapped_sql_expr.rst
+++ b/doc/build/orm/mapped_sql_expr.rst
@@ -35,7 +35,7 @@ Above, the ``fullname`` attribute is interpreted at both the instance and
class level, so that it is available from an instance::
some_user = session.query(User).first()
- print some_user.fullname
+ print(some_user.fullname)
as well as usable within queries::
diff --git a/doc/build/orm/session_state_management.rst b/doc/build/orm/session_state_management.rst
index 090bf7674..40d6295df 100644
--- a/doc/build/orm/session_state_management.rst
+++ b/doc/build/orm/session_state_management.rst
@@ -79,12 +79,12 @@ set-like collection. All items present may be accessed using the iterator
interface::
for obj in session:
- print obj
+ print(obj)
And presence may be tested for using regular "contains" semantics::
if obj in session:
- print "Object is present"
+ print("Object is present")
The session is also keeping track of all newly created (i.e. pending) objects,
all objects which have had changes since they were last loaded or saved (i.e.
diff --git a/doc/build/orm/session_transaction.rst b/doc/build/orm/session_transaction.rst
index e27c15118..332f1c5f4 100644
--- a/doc/build/orm/session_transaction.rst
+++ b/doc/build/orm/session_transaction.rst
@@ -124,7 +124,7 @@ things like unique constraint exceptions::
with session.begin_nested():
session.merge(record)
except:
- print "Skipped record %s" % record
+ print("Skipped record %s" % record)
session.commit()
.. _session_autocommit: