diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98d3e71..74d1fb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: sudo apt-get install -y firefox fi python -m pip install --upgrade pip - pip install flake8 codespell pytest selenium + pip install -e .[dev] pip install -r requirements.txt --require-hashes - name: Install run: | @@ -52,6 +52,9 @@ jobs: - name: Run codespell run: | codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=tests/lint/spelling.ignore-words.txt -S .git,.eggs,.tox,pgp,*.pyc,*basicswap/contrib,*basicswap/interface/contrib,*mnemonics.py,bin/install_certifi.py,*basicswap/static + - name: Run black + run: | + black --check --diff --exclude="contrib" . - name: Run test_other run: | pytest tests/basicswap/test_other.py diff --git a/basicswap/js_server.py b/basicswap/js_server.py index b763132..35f89fc 100644 --- a/basicswap/js_server.py +++ b/basicswap/js_server.py @@ -327,9 +327,7 @@ def formatBids(swap_client, bids, filters) -> bytes: amount_to = None if ci_to: - amount_to = ci_to.format_amount( - (b[4] * b[10]) // ci_from.COIN() - ) + amount_to = ci_to.format_amount((b[4] * b[10]) // ci_from.COIN()) bid_data = { "bid_id": b[2].hex(), @@ -343,14 +341,13 @@ def formatBids(swap_client, bids, filters) -> bytes: "bid_rate": swap_client.ci(b[14]).format_amount(b[10]), "bid_state": strBidState(b[5]), "addr_from": b[11], - "addr_to": offer.addr_to if offer else None + "addr_to": offer.addr_to if offer else None, } if with_extra_info: - bid_data.update({ - "tx_state_a": strTxState(b[7]), - "tx_state_b": strTxState(b[8]) - }) + bid_data.update( + {"tx_state_a": strTxState(b[7]), "tx_state_b": strTxState(b[8])} + ) rv.append(bid_data) return bytes(json.dumps(rv), "UTF-8") diff --git a/basicswap/network.py b/basicswap/network.py index 0208c6d..7e424a3 100644 --- a/basicswap/network.py +++ b/basicswap/network.py @@ -6,17 +6,17 @@ # file LICENSE or http://www.opensource.org/licenses/mit-license.php. """ - Message 2 bytes msg_class, 4 bytes length, [ 2 bytes msg_type, payload ] +Message 2 bytes msg_class, 4 bytes length, [ 2 bytes msg_type, payload ] - Handshake procedure: - node0 connecting to node1 - node0 send_handshake - node1 process_handshake - node1 send_ping - With a version field - node0 recv_ping - Both nodes are initialised +Handshake procedure: + node0 connecting to node1 + node0 send_handshake + node1 process_handshake + node1 send_ping - With a version field + node0 recv_ping + Both nodes are initialised - XChaCha20_Poly1305 mac is 16bytes +XChaCha20_Poly1305 mac is 16bytes """ import time diff --git a/basicswap/ui/page_bids.py b/basicswap/ui/page_bids.py index d2de338..fb1dea8 100644 --- a/basicswap/ui/page_bids.py +++ b/basicswap/ui/page_bids.py @@ -151,7 +151,9 @@ def page_bid(self, url_split, post_string): ) -def page_bids(self, url_split, post_string, sent=False, available=False, received=False): +def page_bids( + self, url_split, post_string, sent=False, available=False, received=False +): server = self.server swap_client = server.swap_client swap_client.checkSystemStatus() diff --git a/basicswap/ui/util.py b/basicswap/ui/util.py index e4c36ac..96e3b13 100644 --- a/basicswap/ui/util.py +++ b/basicswap/ui/util.py @@ -145,7 +145,7 @@ def get_data_with_pagination(data, filters): offset = filters.get("offset", 0) limit = filters.get("limit", PAGE_LIMIT) - return data[offset:offset + limit] + return data[offset : offset + limit] def getTxIdHex(bid, tx_type, suffix): diff --git a/pyproject.toml b/pyproject.toml index d21c9e1..dbcc09f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ dev = [ "pip-tools", "pytest", "ruff", - "black", + "black==24.10.0", "selenium", ]