Add missing 'versionadded' directives, minor cleanup

This commit is contained in:
Tyler Hobbs
2014-05-28 14:32:05 -05:00
parent d1ae7c6f1d
commit 3e28e270d7
5 changed files with 36 additions and 11 deletions

View File

@@ -1002,7 +1002,7 @@ class Session(object):
:meth:`.ResponseFuture.add_errback`; even if a query exceeds this default
timeout, neither the registered callback or errback will be called.
.. versionadded:: 2.0.0b1
.. versionadded:: 2.0.0
"""
default_consistency_level = ConsistencyLevel.ONE
@@ -1032,7 +1032,7 @@ class Session(object):
This only takes effect when protocol version 2 or higher is used.
See :attr:`.Cluster.protocol_version` for details.
.. versionadded:: 2.0.0b1
.. versionadded:: 2.0.0
"""
_lock = None
@@ -2152,6 +2152,8 @@ class ResponseFuture(object):
Returns :const:`True` if there are more pages left in the
query results, :const:`False` otherwise. This should only
be checked after the first page has been returned.
.. versionadded:: 2.0.0
"""
return self._paging_state is not None
@@ -2162,6 +2164,8 @@ class ResponseFuture(object):
is raised. Also see :attr:`.has_more_pages`.
This should only be called after the first page has been returned.
.. versionadded:: 2.0.0
"""
if not self._paging_state:
raise QueryExhausted()
@@ -2582,6 +2586,8 @@ class QueryExhausted(Exception):
Raised when :meth:`.ResponseFuture.start_fetching_next_page()` is called and
there are no more pages. You can check :attr:`.ResponseFuture.has_more_pages`
before calling to avoid this.
.. versionadded:: 2.0.0
"""
pass
@@ -2605,7 +2611,7 @@ class PagedResult(object):
an :class:`Exception` to be raised while fetching the next page, just
like you might see on a normal call to ``session.execute()``.
.. versionadded: 2.0.0b1
.. versionadded: 2.0.0
"""
def __init__(self, response_future, initial_response):

View File

@@ -63,6 +63,9 @@ def tuple_factory(colnames, rows):
>>> rows = session.execute("SELECT name, age FROM users LIMIT 1")
>>> print rows[0]
('Bob', 42)
.. versionchanged:: 2.0.0
moved from ``cassandra.decoder`` to ``cassandra.query``
"""
return rows
@@ -92,6 +95,9 @@ def named_tuple_factory(colnames, rows):
>>> age = user[1]
>>> print "name: %s, age: %d" % (name, age)
name: Bob, age: 42
.. versionchanged:: 2.0.0
moved from ``cassandra.decoder`` to ``cassandra.query``
"""
Row = namedtuple('Row', map(_clean_column_name, colnames))
return [Row(*row) for row in rows]
@@ -110,6 +116,8 @@ def dict_factory(colnames, rows):
>>> print rows[0]
{'age': 42, 'name': 'Bob'}
.. versionchanged:: 2.0.0
moved from ``cassandra.decoder`` to ``cassandra.query``
"""
return [dict(zip(colnames, row)) for row in rows]
@@ -118,6 +126,9 @@ def ordered_dict_factory(colnames, rows):
"""
Like :meth:`~cassandra.query.dict_factory`, but returns each row as an OrderedDict,
so the order of the columns is preserved.
.. versionchanged:: 2.0.0
moved from ``cassandra.decoder`` to ``cassandra.query``
"""
return [OrderedDict(zip(colnames, row)) for row in rows]
@@ -156,6 +167,8 @@ class Statement(object):
This only takes effect when protocol version 2 or higher is used.
See :attr:`.Cluster.protocol_version` for details.
.. versionadded:: 2.0.0
"""
_serial_consistency_level = None
@@ -242,6 +255,8 @@ class Statement(object):
Serial consistency levels may only be used against Cassandra 2.0+
and the :attr:`~.Cluster.protocol_version` must be set to 2 or higher.
.. versionadded:: 2.0.0
""")
@property
@@ -494,6 +509,8 @@ class BatchType(object):
"""
A BatchType is used with :class:`.BatchStatement` instances to control
the atomicity of the batch operation.
.. versionadded:: 2.0.0
"""
LOGGED = None
@@ -531,6 +548,8 @@ class BatchStatement(Statement):
"""
A protocol-level batch of operations which are applied atomically
by default.
.. versionadded:: 2.0.0
"""
batch_type = None
@@ -574,7 +593,7 @@ class BatchStatement(Statement):
batch.add(SimpleStatement("DELETE FROM pending_users WHERE name=%s", (name,))
session.execute(batch)
.. versionadded:: 2.0.0b1
.. versionadded:: 2.0.0
"""
self.batch_type = batch_type
self._statements_and_parameters = []

View File

@@ -5,16 +5,16 @@
.. function:: tuple_factory
**Deprecated** Use :meth:`cassandra.query.tuple_factory`
**Deprecated in 2.0.0.** Use :meth:`cassandra.query.tuple_factory`
.. function:: named_tuple_factory
**Deprecated** Use :meth:`cassandra.query.named_tuple_factory`
**Deprecated in 2.0.0.** Use :meth:`cassandra.query.named_tuple_factory`
.. function:: dict_factory
**Deprecated** Use :meth:`cassandra.query.dict_factory`
**Deprecated in 2.0.0.** Use :meth:`cassandra.query.dict_factory`
.. function:: ordered_dict_factory
**Deprecated** Use :meth:`cassandra.query.ordered_dict_factory`
**Deprecated in 2.0.0.** Use :meth:`cassandra.query.ordered_dict_factory`

View File

@@ -1,5 +1,5 @@
``cassandra.query`` - Prepared Statements and Query Policies
============================================================
``cassandra.query`` - Prepared Statements, Batch Statements, Tracing, and Row Factories
=======================================================================================
.. module:: cassandra.query

View File

@@ -58,7 +58,7 @@ now:
* :attr:`cassandra.decoder.tuple_factory` has moved to
:attr:`cassandra.query.tuple_factory`
* :attr:`cassandra.decoder.named_tuple_factory` has moved to
:attr:`cassandra.query.named_tuple_factory
:attr:`cassandra.query.named_tuple_factory`
* :attr:`cassandra.decoder.dict_factory` has moved to
:attr:`cassandra.query.dict_factory`
* :attr:`cassandra.decoder.ordered_dict_factory` has moved to