Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down Expand Up @@ -40,7 +40,7 @@ repos:
args: [--notice=COPYRIGHT]
files: python
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
rev: v2.3.1
hooks:
- id: autoflake
args:
Expand All @@ -54,15 +54,15 @@ repos:
language: python
types: [python]
- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
# exclude: *fixtures
language: python
types: [python]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (black profile, in place fixes)
Expand Down Expand Up @@ -97,13 +97,13 @@ repos:
language: python
types: [python]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
language: python
types: [python]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.10.0
hooks:
- id: black
name: black (in place fixes)
Expand All @@ -116,7 +116,7 @@ repos:
language: python
types: [python]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.10
hooks:
- id: bandit
name: bandit (btclib)
Expand All @@ -125,7 +125,7 @@ repos:
language: python
types: [python]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.10
hooks:
- id: bandit
name: bandit (tests)
Expand All @@ -138,7 +138,7 @@ repos:
language: python
types: [python]
- repo: https://github.com/PyCQA/pylint
rev: v3.0.0a6
rev: v3.3.1
hooks:
- id: pylint
args: [
Expand All @@ -147,7 +147,7 @@ repos:
language: python
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.11.2
hooks:
- id: mypy
language: python
Expand Down
33 changes: 19 additions & 14 deletions btclib/psbt/psbt_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ def __init__(
taproot_key_spend_signature: Octets = b"",
taproot_script_spend_signatures: Mapping[Octets, Octets] | None = None,
taproot_leaf_scripts: Mapping[Octets, tuple[Octets, int]] | None = None,
taproot_hd_key_paths: Mapping[Octets, tuple[list[Octets], BIP32KeyOrigin]]
| None = None,
taproot_hd_key_paths: (
Mapping[Octets, tuple[list[Octets], BIP32KeyOrigin]] | None
) = None,
taproot_internal_key: Octets = b"",
taproot_merkle_root: Octets = b"",
unknown: Mapping[Octets, Octets] | None = None,
Expand Down Expand Up @@ -283,12 +284,12 @@ def to_dict(self, check_validity: bool = True) -> dict[str, Any]:
self.assert_valid()

return {
"non_witness_utxo": self.non_witness_utxo.to_dict(False)
if self.non_witness_utxo
else None,
"witness_utxo": self.witness_utxo.to_dict(False)
if self.witness_utxo
else None,
"non_witness_utxo": (
self.non_witness_utxo.to_dict(False) if self.non_witness_utxo else None
),
"witness_utxo": (
self.witness_utxo.to_dict(False) if self.witness_utxo else None
),
"partial_signatures": encode_dict_bytes_bytes(self.partial_sigs),
"sig_hash": self.sig_hash_type,
# TODO make it { "asm": "", "hex": "" }
Expand Down Expand Up @@ -327,12 +328,16 @@ def from_dict(
decode_from_bip32_derivs(dict_["taproot_hd_key_paths"]),
)
return cls(
Tx.from_dict(dict_["non_witness_utxo"], False)
if dict_["non_witness_utxo"]
else None,
TxOut.from_dict(dict_["witness_utxo"], False)
if dict_["witness_utxo"]
else None,
(
Tx.from_dict(dict_["non_witness_utxo"], False)
if dict_["non_witness_utxo"]
else None
),
(
TxOut.from_dict(dict_["witness_utxo"], False)
if dict_["witness_utxo"]
else None
),
dict_["partial_signatures"],
dict_["sig_hash"],
dict_["redeem_script"],
Expand Down
5 changes: 3 additions & 2 deletions btclib/psbt/psbt_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ def __init__(
hd_key_paths: Mapping[Octets, BIP32KeyOrigin] | None = None,
taproot_internal_key: Octets = b"",
taproot_tree: Sequence[tuple[int, int, Octets]] | None = None,
taproot_hd_key_paths: Mapping[Octets, tuple[list[bytes], BIP32KeyOrigin]]
| None = None,
taproot_hd_key_paths: (
Mapping[Octets, tuple[list[bytes], BIP32KeyOrigin]] | None
) = None,
unknown: Mapping[Octets, Octets] | None = None,
check_validity: bool = True,
) -> None:
Expand Down
13 changes: 8 additions & 5 deletions btclib/tx/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,14 @@ def serialize(self, include_witness: bool, check_validity: bool = True) -> bytes
b"".join(tx_in.serialize(check_validity) for tx_in in self.vin),
var_int.serialize(len(self.vout)),
b"".join(tx_out.serialize(check_validity) for tx_out in self.vout),
b"".join(
tx_in.script_witness.serialize(check_validity) for tx_in in self.vin
)
if segwit
else b"",
(
b"".join(
tx_in.script_witness.serialize(check_validity)
for tx_in in self.vin
)
if segwit
else b""
),
self.lock_time.to_bytes(4, byteorder="little", signed=False),
]
)
Expand Down
Loading