mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Fixes typos according to the review
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -99,7 +99,7 @@ class Builder:
|
||||
def update_states(watcher, missed_blocks_watcher, missed_blocks_responder):
|
||||
"""
|
||||
Updates the states of both the :mod:`Watcher <teos.watcher.Watcher>` and the
|
||||
:mod:`Responder <teos.responder.Responder>`. If both have pending blocks to process they need to be updates at
|
||||
:mod:`Responder <teos.responder.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.
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user