diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2781ab7..c3c1280 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ In additon, we use [flake8](https://flake8.pycqa.org/en/latest/) to detect style flake8 --max-line-length=120 {source_file_or_directory} ``` - Not all outputs from flake8 are mandatory. For instance, splitting **bullet points in docstrings (E501)** will cause issues when generating the docuementation, so we will leave that longer than the line lenght limit . Another example are **whitespaces before colons in inline fors (E203)**. `black` places them in that way, so we'll leave them like that. + Not all outputs from flake8 are mandatory. For instance, splitting **bullet points in docstrings (E501)** will cause issues when generating the documentation, so we will leave that longer than the line length limit . Another example are **whitespaces before colons in inline fors (E203)**. `black` places them in that way, so we'll leave them like that. On top of that, there are a few rules to also have in mind. diff --git a/common/cryptographer.py b/common/cryptographer.py index e4fa7f8..c5e4af5 100644 --- a/common/cryptographer.py +++ b/common/cryptographer.py @@ -13,7 +13,7 @@ LN_MESSAGE_PREFIX = b"Lightning Signed Message:" def sha256d(message): """ - Compute the sha256 (double sha256) of a given by message. + Computes the double sha256 of a given by message. Args: message(:obj:`bytes`): the message to be used as input to the hash function. diff --git a/teos/appointments_dbm.py b/teos/appointments_dbm.py index ebd027a..cc1fcd0 100644 --- a/teos/appointments_dbm.py +++ b/teos/appointments_dbm.py @@ -33,7 +33,7 @@ class AppointmentsDBM(DBManager): Args: db_path (:obj:`str`): the path (relative or absolute) to the system folder containing the database. A fresh - database will be create if the specified path does not contain one. + database will be created if the specified path does not contain one. Raises: :obj:`ValueError`: If the provided ``db_path`` is not a string. @@ -148,7 +148,7 @@ class AppointmentsDBM(DBManager): by default. Returns: - :obj:`dict`: A dictionary with all the appointments stored in the database. An empty dictionary is there + :obj:`dict`: A dictionary with all the appointments stored in the database. An empty dictionary if there are none. """ @@ -453,7 +453,7 @@ class AppointmentsDBM(DBManager): Creates a flag that signals that an appointment has been triggered for every appointment in the given list Args: - uuids (:obj:`list`): a list of identifier for the appointments to flag. + uuids (:obj:`list`): a list of identifiers for the appointments to flag. """ with self.db.write_batch() as b: diff --git a/teos/builder.py b/teos/builder.py index 6d087fa..831236f 100644 --- a/teos/builder.py +++ b/teos/builder.py @@ -99,7 +99,7 @@ class Builder: def update_states(watcher, missed_blocks_watcher, missed_blocks_responder): """ Updates the states of both the :mod:`Watcher ` and the - :mod:`Responder `. If both have pending blocks to process they need to be updates at + :mod:`Responder `. If both have pending blocks to process they need to be updated at the same time, block by block. If only one instance has to be updated, ``populate_block_queue`` should be used. diff --git a/teos/gatekeeper.py b/teos/gatekeeper.py index a4a65fb..79b5efc 100644 --- a/teos/gatekeeper.py +++ b/teos/gatekeeper.py @@ -3,7 +3,7 @@ from common.cryptographer import Cryptographer class NotEnoughSlots(ValueError): - """Raise this when trying to subtract more slots than a user has available""" + """Raised when trying to subtract more slots than a user has available""" def __init__(self, user_pk, requested_slots): self.user_pk = user_pk @@ -12,7 +12,7 @@ class NotEnoughSlots(ValueError): class IdentificationFailure(Exception): """ - Raise this when a user can not be identified. Either the user public key cannot be recovered or the user is + Raised when a user can not be identified. Either the user public key cannot be recovered or the user is not found within the registered ones. """ @@ -45,7 +45,7 @@ class Gatekeeper: """ if not is_compressed_pk(user_pk): - raise ValueError("provided public key does not match expected format (33-byte hex string)") + raise ValueError("Provided public key does not match expected format (33-byte hex string)") if user_pk not in self.registered_users: self.registered_users[user_pk] = {"available_slots": self.default_slots} diff --git a/teos/users_dbm.py b/teos/users_dbm.py index b9f3b21..c71ee5a 100644 --- a/teos/users_dbm.py +++ b/teos/users_dbm.py @@ -17,7 +17,7 @@ class UsersDBM(DBManager): Args: db_path (:obj:`str`): the path (relative or absolute) to the system folder containing the database. A fresh - database will be create if the specified path does not contain one. + database will be created if the specified path does not contain one. Raises: :obj:`ValueError`: If the provided ``db_path`` is not a string. @@ -75,7 +75,7 @@ class UsersDBM(DBManager): user_pk (:obj:`str`): a 33-byte hex-encoded string identifying the user. Returns: - :obj:`dict`: A dictionary containing the appointment data if they ``key`` is found. + :obj:`dict`: A dictionary containing the appointment data if the ``key`` is found. Returns ``None`` otherwise. """ diff --git a/test/teos/e2e/test_basic_e2e.py b/test/teos/e2e/test_basic_e2e.py index 5e23cee..ab47c49 100644 --- a/test/teos/e2e/test_basic_e2e.py +++ b/test/teos/e2e/test_basic_e2e.py @@ -54,7 +54,7 @@ def add_appointment(appointment_data, sk=cli_sk): def test_commands_non_registered(bitcoin_cli, create_txs): - # All commands should failed if the user is not registered + # All commands should fail if the user is not registered # Add appointment commitment_tx, penalty_tx = create_txs diff --git a/test/teos/unit/test_api.py b/test/teos/unit/test_api.py index f19fbc2..210240f 100644 --- a/test/teos/unit/test_api.py +++ b/test/teos/unit/test_api.py @@ -388,7 +388,7 @@ def test_request_appointment_not_registered_user(client): tmp_sk, tmp_pk = generate_keypair() # The tower is designed so a not found appointment and a request from a non-registered user return the same error to - # prevent proving. + # prevent probing. test_request_random_appointment_registered_user(client, tmp_sk)