From 714edf874a7123f71f26dcf21a42e6c0d41b8f08 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:53:34 +0100 Subject: [PATCH] ruff format --- cashu/core/models.py | 6 +++--- cashu/nostr/bech32.py | 1 - cashu/nostr/client/client.py | 22 ++++++++++++---------- cashu/nostr/event.py | 26 ++++++++++++++------------ 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/cashu/core/models.py b/cashu/core/models.py index 0c6b65bd..4565f5b3 100644 --- a/cashu/core/models.py +++ b/cashu/core/models.py @@ -211,9 +211,9 @@ class PostMeltQuoteResponse(BaseModel): quote: str # quote id amount: int # input amount fee_reserve: int # input fee reserve - paid: Optional[ - bool - ] = None # whether the request has been paid # DEPRECATED as per NUT PR #136 + paid: Optional[bool] = ( + None # whether the request has been paid # DEPRECATED as per NUT PR #136 + ) state: Optional[str] # state of the quote expiry: Optional[int] # expiry of the quote payment_preimage: Optional[str] = None # payment preimage diff --git a/cashu/nostr/bech32.py b/cashu/nostr/bech32.py index 8556d5ba..158e574f 100644 --- a/cashu/nostr/bech32.py +++ b/cashu/nostr/bech32.py @@ -20,7 +20,6 @@ """Reference implementation for Bech32/Bech32m and segwit addresses.""" - from enum import Enum diff --git a/cashu/nostr/client/client.py b/cashu/nostr/client/client.py index 3cb77662..3af7303b 100644 --- a/cashu/nostr/client/client.py +++ b/cashu/nostr/client/client.py @@ -45,9 +45,9 @@ def __init__(self, private_key: str = "", relays: List[str] = [], connect=True): def connect(self): for relay in self.relays: self.relay_manager.add_relay(relay) - self.relay_manager.open_connections({ - "cert_reqs": ssl.CERT_NONE - }) # NOTE: This disables ssl certificate verification + self.relay_manager.open_connections( + {"cert_reqs": ssl.CERT_NONE} + ) # NOTE: This disables ssl certificate verification def close(self): self.relay_manager.close_connections() @@ -105,13 +105,15 @@ def dm(self, message: str, to_pubkey: PublicKey): self.relay_manager.publish_event(dm) def get_dm(self, sender_publickey: PublicKey, callback_func=None, filter_kwargs={}): - filters = Filters([ - Filter( - kinds=[EventKind.ENCRYPTED_DIRECT_MESSAGE], - pubkey_refs=[sender_publickey.hex()], - **filter_kwargs, - ) - ]) + filters = Filters( + [ + Filter( + kinds=[EventKind.ENCRYPTED_DIRECT_MESSAGE], + pubkey_refs=[sender_publickey.hex()], + **filter_kwargs, + ) + ] + ) subscription_id = os.urandom(4).hex() self.relay_manager.add_subscription(subscription_id, filters) diff --git a/cashu/nostr/event.py b/cashu/nostr/event.py index 06f495b2..f6332284 100644 --- a/cashu/nostr/event.py +++ b/cashu/nostr/event.py @@ -77,18 +77,20 @@ def verify(self) -> bool: ) def to_message(self) -> str: - return json.dumps([ - ClientMessageType.EVENT, - { - "id": self.id, - "pubkey": self.public_key, - "created_at": self.created_at, - "kind": self.kind, - "tags": self.tags, - "content": self.content, - "sig": self.signature, - }, - ]) + return json.dumps( + [ + ClientMessageType.EVENT, + { + "id": self.id, + "pubkey": self.public_key, + "created_at": self.created_at, + "kind": self.kind, + "tags": self.tags, + "content": self.content, + "sig": self.signature, + }, + ] + ) @dataclass