Fixes returns

This commit is contained in:
Sergi Delgado Segura
2019-12-10 12:00:40 +01:00
parent 899b60c083
commit f287bdf073
4 changed files with 20 additions and 20 deletions

View File

@@ -26,7 +26,7 @@ def add_appointment():
encoded and contain an ``appointment`` field and optionally a ``signature`` and ``public_key`` fields.
Returns:
tuple: A tuple containing the response (``json``) and response code (``int``). For accepted appointments, the
``tuple``: A tuple containing the response (``json``) and response code (``int``). For accepted appointments, the
``rcode`` is always 0 and the response contains the signed receipt. For rejected appointments, the ``rcode`` is
a negative value and the response contains the error message. Error messages can be found at
:mod:`Errors <pisa.errors>`.
@@ -90,7 +90,7 @@ def get_appointment():
The information is requested by ``locator``.
Returns:
dict: A json formatted dictionary containing information about the requested appointment.
``dict``: A json formatted dictionary containing information about the requested appointment.
A ``status`` flag is added to the data provided by either the :mod:`Watcher <pisa.watcher>` or the
:mod:`Responder <pisa.responder>` that signals the status of the appointment.
@@ -143,7 +143,7 @@ def get_all_appointments():
This endpoint should only be accessible by the administrator. Requests are only allowed from localhost.
Returns:
dict: A json formatted dictionary containing all the appointments hold by the :mod:`Watcher <pisa.watcher>`
``dict``: A json formatted dictionary containing all the appointments hold by the :mod:`Watcher <pisa.watcher>`
(``watcher_appointments``) and by the :mod:`Responder <pisa.responder>` (``responder_jobs``).
"""
@@ -172,7 +172,7 @@ def get_block_count():
testers about the current block so they can define a dummy appointment without having to run a bitcoin node.
Returns:
dict: A json encoded dictionary containing the block height.
``dict``: A json encoded dictionary containing the block height.
"""

View File

@@ -39,7 +39,7 @@ class Appointment:
``{locator, start_time, end_time, dispute_delta, encrypted_blob}``
Returns:
Appointment: An appointment initialized using the provided data.
``Appointment``: An appointment initialized using the provided data.
Raises:
ValueError: If one of the mandatory keys is missing in ``appointment_data``.
@@ -64,7 +64,7 @@ class Appointment:
Exports an appointment as a dictionary.
Returns:
appointment (dict): A dictionary containing the appointment attributes.
``dict``: A dictionary containing the appointment attributes.
"""
@@ -93,7 +93,7 @@ class Appointment:
reorgs in the future.
Returns:
appointment (str): A json-encoded str representing the appointment.
``str``: A json-encoded str representing the appointment.
"""
appointment = self.to_dict()

View File

@@ -20,7 +20,7 @@ class BlockProcessor:
block_hash (str): The block hash to be queried.
Returns:
block (dict): A dictionary containing the requested block data if the block is found.
``dict`` or ``None``: A dictionary containing the requested block data if the block is found.
Returns ``None`` otherwise.
"""
@@ -40,7 +40,7 @@ class BlockProcessor:
Returns the hash of the current best chain tip.
Returns:
block_hash (str): The hash of the block if it can be found.
``str`` or ``None``: The hash of the block if it can be found.
Returns ``None`` otherwise (not even sure this can actually happen).
"""
@@ -60,7 +60,7 @@ class BlockProcessor:
Returns the block height of the best chain.
Returns:
block_count (int): The block height if it can be computed.
``int`` or ``None``: The block height if it can be computed.
Returns ``None`` otherwise (not even sure this can actually happen).
"""
@@ -84,7 +84,7 @@ class BlockProcessor:
raw_tx (str): The hex representation of the transaction.
Returns:
tx (dict): The decoding of the given ``raw_tx`` if the transaction is well formaed.
``dict`` or ``None``: The decoding of the given ``raw_tx`` if the transaction is well formatted.
Returns ``None`` otherwise.
"""
@@ -111,8 +111,8 @@ class BlockProcessor:
last_know_block_hash (hex): the hash of the last known block.
Returns:
missed_blocks (list): A list of blocks between the last given block and the current best chain tip, starting
from the child of ``last_know_block_hash``.
``list``: A list of blocks between the last given block and the current best chain tip, starting from the
child of ``last_know_block_hash``.
"""
current_block_hash = self.get_best_block_hash()
@@ -134,8 +134,8 @@ class BlockProcessor:
target_block_hash (str): the hash of the target block (the one to compute the distance form the tip).
Returns:
distance (int): The distance between the target and the best chain tip is the target block can be found on
the blockchain.
``int`` or ``None``: The distance between the target and the best chain tip is the target block can be found
on the blockchain.
Returns ``None`` otherwise.
"""

View File

@@ -23,9 +23,9 @@ class Builder:
``{uuid: {locator: str, start_time: int, ...}, uuid: {locator:...}}``
Returns:
appointments, locator_uuid_map (tuple): A tuple with two dictionaries. ``appointments`` containing the
appointment information in :mod:`Appointment <pisa.appointment>` objects and ``locator_uuid_map``
containing a map of appointment (``uuid:locator``).
``tuple``: A tuple with two dictionaries. ``appointments`` containing the appointment information in
:mod:`Appointment <pisa.appointment>` objects and ``locator_uuid_map`` containing a map of appointment
(``uuid:locator``).
"""
appointments = {}
@@ -56,7 +56,7 @@ class Builder:
``{uuid: {locator: str, dispute_txid: str, ...}, uuid: {locator:...}}``
Returns:
jobs, tx_job_map (tuple): A tuple with two dictionaries. ``jobs`` containing the jobs information in
``tuple``: A tuple with two dictionaries. ``jobs`` containing the jobs information in
:class:`Job <pisa.responder>` objects and a ``tx_job_map`` containing the map of jobs
(``penalty_txid: uuid``).
@@ -87,7 +87,7 @@ class Builder:
missed_blocks (list): list of block hashes missed by the Watchtower (do to a crash or shutdown).
Returns:
block_queue (Queue): A `Queue` containing all the missed blocks hashes.
``Queue``: A `Queue` containing all the missed blocks hashes.
"""
block_queue = Queue()