Revert "chore: code format"

This reverts commit 619e0f05e2.
This commit is contained in:
Vlad Stan 2023-03-23 10:57:29 +02:00
parent 619e0f05e2
commit f369e2fdac
20 changed files with 77 additions and 117 deletions

View file

@ -1,9 +1,7 @@
import time
from .event import Event
from .key import PrivateKey
def zero_bits(b: int) -> int:
n = 0
@ -16,11 +14,10 @@ def zero_bits(b: int) -> int:
return 7 - n
def count_leading_zero_bits(hex_str: str) -> int:
total = 0
for i in range(0, len(hex_str) - 2, 2):
bits = zero_bits(int(hex_str[i : i + 2], 16))
bits = zero_bits(int(hex_str[i:i+2], 16))
total += bits
if bits != 8:
@ -28,10 +25,7 @@ def count_leading_zero_bits(hex_str: str) -> int:
return total
def mine_event(
content: str, difficulty: int, public_key: str, kind: int, tags: list = []
) -> Event:
def mine_event(content: str, difficulty: int, public_key: str, kind: int, tags: list=[]) -> Event:
all_tags = [["nonce", "1", str(difficulty)]]
all_tags.extend(tags)
@ -49,7 +43,6 @@ def mine_event(
return Event(public_key, content, created_at, kind, all_tags, event_id)
def mine_key(difficulty: int) -> PrivateKey:
sk = PrivateKey()
num_leading_zero_bits = count_leading_zero_bits(sk.public_key.hex())