Fix docstring rst errors in the backend modules

This commit is contained in:
Brett Sun 2016-12-08 16:46:07 +01:00 committed by Sylvain Bellemare
parent 448ee87944
commit 5f9c0f7b1b
4 changed files with 23 additions and 22 deletions

View File

@ -9,7 +9,7 @@ BACKENDS = {
def connect(backend=None, host=None, port=None, name=None):
'''Create a connection to a database.
"""Create a connection to the database backend.
Args:
backend (str): the name of the backend to use.
@ -19,7 +19,7 @@ def connect(backend=None, host=None, port=None, name=None):
Returns:
An instance of :class:`~bigchaindb.backend.connection.Connection`.
'''
"""
backend = backend or bigchaindb.config['database']['backend']
host = host or bigchaindb.config['database']['host']

View File

@ -94,7 +94,7 @@ def get_transaction_from_backlog(connection, transaction_id):
@singledispatch
def get_blocks_status_from_transaction(connection, transaction_id):
"""Retrieve block election information given a secondary index and value
"""Retrieve block election information given a secondary index and value.
Args:
value: a value to search (e.g. transaction id string, payload hash string)
@ -120,7 +120,7 @@ def get_txids_by_asset_id(connection, asset_id):
Returns:
A list of transactions ids related to the asset. If no transaction
exists for that asset it returns an empty list `[]`
exists for that asset it returns an empty list ``[]``
"""
raise NotImplementedError
@ -218,7 +218,7 @@ def write_block(connection, block):
@singledispatch
def get_block(connection, block_id):
"""Get a block from the bigchain table
"""Get a block from the bigchain table.
Args:
block_id (str): block id of the block to get
@ -282,7 +282,7 @@ def write_vote(connection, vote):
@singledispatch
def get_genesis_block(connection):
"""Get the genesis block
"""Get the genesis block.
Returns:
The genesis block

View File

@ -9,11 +9,12 @@ logger = logging.getLogger(__name__)
class RethinkDBConnection(Connection):
"""This class is a proxy to run queries against the database,
it is:
- lazy, since it creates a connection only when needed
- resilient, because before raising exceptions it tries
more times to run the query or open a connection.
"""
This class is a proxy to run queries against the database, it is:
- lazy, since it creates a connection only when needed
- resilient, because before raising exceptions it tries
more times to run the query or open a connection.
"""
def __init__(self, host, port, dbname, max_tries=3):
@ -34,7 +35,7 @@ class RethinkDBConnection(Connection):
self.conn = None
def run(self, query):
"""Run a query.
"""Run a RethinkDB query.
Args:
query: the RethinkDB query.

View File

@ -8,14 +8,14 @@ from bigchaindb.backend.connection import connect
@singledispatch
def create_database(connection, dbname):
"""Create database to be used by BigchainDB
"""Create database to be used by BigchainDB.
Args:
dbname (str): the name of the database to create.
Raises:
:exc:`~bigchaindb.common.exceptions.DatabaseAlreadyExists`: If the
given :attr:`dbname` already exists as a database.
:exc:`~DatabaseAlreadyExists`: If the given :attr:`dbname` already
exists as a database.
"""
raise NotImplementedError
@ -23,7 +23,7 @@ def create_database(connection, dbname):
@singledispatch
def create_tables(connection, dbname):
"""Create the tables to be used by BigchainDB
"""Create the tables to be used by BigchainDB.
Args:
dbname (str): the name of the database to create tables for.
@ -34,7 +34,7 @@ def create_tables(connection, dbname):
@singledispatch
def create_indexes(connection, dbname):
"""Create the indexes to be used by BigchainDB
"""Create the indexes to be used by BigchainDB.
Args:
dbname (str): the name of the database to create indexes for.
@ -45,14 +45,14 @@ def create_indexes(connection, dbname):
@singledispatch
def drop_database(connection, dbname):
"""Drop the database used by BigchainDB
"""Drop the database used by BigchainDB.
Args:
dbname (str): the name of the database to drop.
Raises:
:exc:`~bigchaindb.common.exceptions.DatabaseDoesNotExist`: If the
given :attr:`dbname` does not exist as a database.
:exc:`~DatabaseDoesNotExist`: If the given :attr:`dbname` does not
exist as a database.
"""
raise NotImplementedError
@ -73,8 +73,8 @@ def init_database(connection=None, dbname=None):
configuration.
Raises:
:exc:`~bigchaindb.common.exceptions.DatabaseAlreadyExists`: If the
given :attr:`dbname` already exists as a database.
:exc:`~DatabaseAlreadyExists`: If the given :attr:`dbname` already
exists as a database.
"""
connection = connection or connect()