Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Nov 1, 2024
1 parent c78d039 commit 714edf8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
6 changes: 3 additions & 3 deletions cashu/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cashu/nostr/bech32.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

"""Reference implementation for Bech32/Bech32m and segwit addresses."""


from enum import Enum


Expand Down
22 changes: 12 additions & 10 deletions cashu/nostr/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
26 changes: 14 additions & 12 deletions cashu/nostr/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 714edf8

Please sign in to comment.