diff --git a/ar/__init__.py b/ar/__init__.py index c81dc12..dc9d345 100644 --- a/ar/__init__.py +++ b/ar/__init__.py @@ -277,13 +277,10 @@ class ArweaveNetworkException(ArweaveException): ArweaveTransactionException = ArweaveException +from .arweave_lib import arql +from .block import Block +from .bundle import ANS104BundleHeader, ANS104DataItemHeader, Bundle, DataItem from .peer import Peer -from .wallet import Wallet from .transaction import Transaction -from .block import Block -from .chunk import Chunk -from .stream import PeerStream, GatewayStream -from .arweave_lib import arql -from .manifest import Manifest -from .bundle import Bundle, DataItem, ANS104BundleHeader, ANS104DataItemHeader +from .wallet import Wallet diff --git a/ar/arweave_lib.py b/ar/arweave_lib.py index da73eac..3786515 100644 --- a/ar/arweave_lib.py +++ b/ar/arweave_lib.py @@ -12,10 +12,9 @@ # You should have received a copy of the GNU General Public License along with # PyArweave. If not, see . -import json -from .peer import Peer - from . import DEFAULT_API_URL +from .peer import Peer +from .transaction import Transaction TRANSACTION_DATA_LIMIT_IN_BYTES = 2000000 diff --git a/ar/block.py b/ar/block.py index b143421..1e0c6f3 100644 --- a/ar/block.py +++ b/ar/block.py @@ -1,12 +1,11 @@ import fractions import io -from ar.utils import ( - arbinenc, arintenc, arbindec, arintdec, b64enc_if_not_str, b64enc, b64dec -) + +from ar.utils import arbindec, arbinenc, arintdec, arintenc, b64dec, b64enc_if_not_str from ar.utils.deep_hash import deep_hash -from .chunk import Chunk + +from . import FORK_2_4, FORK_2_5 from .transaction import Transaction -from . import FORK_2_4 # note: there are actually three different block formats in chain history, # according to https://docs.arweave.org/developers/server/http-api#block-format diff --git a/ar/bundle.py b/ar/bundle.py index faa0ef2..2a669f6 100644 --- a/ar/bundle.py +++ b/ar/bundle.py @@ -105,7 +105,7 @@ def fromjson(cls, json): @classmethod def frombytes(cls, data): stream = io.BytesIO(data) - return self.fromstream(stream) + return cls.fromstream(stream) @classmethod def fromstream(cls, stream): @@ -161,7 +161,7 @@ def raw_public_key(self): return self.raw_owner @property - def public_key(Self): + def public_key(self): return self.owner @property diff --git a/ar/chunk.py b/ar/chunk.py index a264408..1623a26 100644 --- a/ar/chunk.py +++ b/ar/chunk.py @@ -1,8 +1,9 @@ import io -from .utils import arbinenc, arbindec, b64enc, b64dec +from .utils import arbindec, arbinenc, b64dec, b64enc from .utils.merkle import Node as MerkleNode + class Chunk: def __init__(self, data = None, data_path = None, tx_path = None, packing = 'unpacked'): self.data = data diff --git a/ar/stream.py b/ar/stream.py index 306b7f4..dbb04f9 100644 --- a/ar/stream.py +++ b/ar/stream.py @@ -1,4 +1,7 @@ -import io, ar +import io + +import ar + class PeerStream(io.RawIOBase): @classmethod diff --git a/ar/utils/ans104_signers.py b/ar/utils/ans104_signers.py index f298fbf..5e2da7a 100644 --- a/ar/utils/ans104_signers.py +++ b/ar/utils/ans104_signers.py @@ -1,7 +1,8 @@ -from Crypto.Util.number import bytes_to_long, long_to_bytes from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA from Crypto.Signature import pss +from Crypto.Util.number import bytes_to_long, long_to_bytes + class Signer: owner_length = None @@ -14,7 +15,7 @@ def sign(cls, private_key, raw_data): raise NotImplementedError(cls.__name__ + '.sign') @classmethod - def verify(public_key, raw_data, raw_signature): + def verify(cls, public_key, raw_data, raw_signature): raise NotImplementedError(cls.__name__ + '.verify') @classmethod diff --git a/ar/wallet.py b/ar/wallet.py index c07c38d..29eb842 100644 --- a/ar/wallet.py +++ b/ar/wallet.py @@ -1,15 +1,17 @@ import json -from jose import jwk -from jose.utils import base64url_decode + +from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_PSS -from Crypto.Hash import SHA256 +from jose import jwk +from jose.utils import base64url_decode + +from . import DEFAULT_API_URL +from .peer import Peer from .utils import ( - winston_to_ar, owner_to_address, + winston_to_ar, ) -from . import DEFAULT_API_URL -from .peer import Peer class Wallet(object):