Skip to content

Commit 50041d9

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent aa13636 commit 50041d9

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

btclib/psbt/psbt_in.py

+19-14
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ def __init__(
200200
taproot_key_spend_signature: Octets = b"",
201201
taproot_script_spend_signatures: Mapping[Octets, Octets] | None = None,
202202
taproot_leaf_scripts: Mapping[Octets, tuple[Octets, int]] | None = None,
203-
taproot_hd_key_paths: Mapping[Octets, tuple[list[Octets], BIP32KeyOrigin]]
204-
| None = None,
203+
taproot_hd_key_paths: (
204+
Mapping[Octets, tuple[list[Octets], BIP32KeyOrigin]] | None
205+
) = None,
205206
taproot_internal_key: Octets = b"",
206207
taproot_merkle_root: Octets = b"",
207208
unknown: Mapping[Octets, Octets] | None = None,
@@ -283,12 +284,12 @@ def to_dict(self, check_validity: bool = True) -> dict[str, Any]:
283284
self.assert_valid()
284285

285286
return {
286-
"non_witness_utxo": self.non_witness_utxo.to_dict(False)
287-
if self.non_witness_utxo
288-
else None,
289-
"witness_utxo": self.witness_utxo.to_dict(False)
290-
if self.witness_utxo
291-
else None,
287+
"non_witness_utxo": (
288+
self.non_witness_utxo.to_dict(False) if self.non_witness_utxo else None
289+
),
290+
"witness_utxo": (
291+
self.witness_utxo.to_dict(False) if self.witness_utxo else None
292+
),
292293
"partial_signatures": encode_dict_bytes_bytes(self.partial_sigs),
293294
"sig_hash": self.sig_hash_type,
294295
# TODO make it { "asm": "", "hex": "" }
@@ -327,12 +328,16 @@ def from_dict(
327328
decode_from_bip32_derivs(dict_["taproot_hd_key_paths"]),
328329
)
329330
return cls(
330-
Tx.from_dict(dict_["non_witness_utxo"], False)
331-
if dict_["non_witness_utxo"]
332-
else None,
333-
TxOut.from_dict(dict_["witness_utxo"], False)
334-
if dict_["witness_utxo"]
335-
else None,
331+
(
332+
Tx.from_dict(dict_["non_witness_utxo"], False)
333+
if dict_["non_witness_utxo"]
334+
else None
335+
),
336+
(
337+
TxOut.from_dict(dict_["witness_utxo"], False)
338+
if dict_["witness_utxo"]
339+
else None
340+
),
336341
dict_["partial_signatures"],
337342
dict_["sig_hash"],
338343
dict_["redeem_script"],

btclib/psbt/psbt_out.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def __init__(
8080
hd_key_paths: Mapping[Octets, BIP32KeyOrigin] | None = None,
8181
taproot_internal_key: Octets = b"",
8282
taproot_tree: Sequence[tuple[int, int, Octets]] | None = None,
83-
taproot_hd_key_paths: Mapping[Octets, tuple[list[bytes], BIP32KeyOrigin]]
84-
| None = None,
83+
taproot_hd_key_paths: (
84+
Mapping[Octets, tuple[list[bytes], BIP32KeyOrigin]] | None
85+
) = None,
8586
unknown: Mapping[Octets, Octets] | None = None,
8687
check_validity: bool = True,
8788
) -> None:

btclib/tx/tx.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,14 @@ def serialize(self, include_witness: bool, check_validity: bool = True) -> bytes
224224
b"".join(tx_in.serialize(check_validity) for tx_in in self.vin),
225225
var_int.serialize(len(self.vout)),
226226
b"".join(tx_out.serialize(check_validity) for tx_out in self.vout),
227-
b"".join(
228-
tx_in.script_witness.serialize(check_validity) for tx_in in self.vin
229-
)
230-
if segwit
231-
else b"",
227+
(
228+
b"".join(
229+
tx_in.script_witness.serialize(check_validity)
230+
for tx_in in self.vin
231+
)
232+
if segwit
233+
else b""
234+
),
232235
self.lock_time.to_bytes(4, byteorder="little", signed=False),
233236
]
234237
)

0 commit comments

Comments
 (0)