Skip to content

Commit

Permalink
Update and modify files for the project
Browse files Browse the repository at this point in the history
- Updated files:
  - src/bee_py/bee.py
  - src/bee_py/chunk/soc.py
  - src/bee_py/feed/feed.py
  - src/bee_py/feed/retrievable.py
  - src/bee_py/modules/debug/connectivity.py
  - src/bee_py/modules/debug/stamps.py
  - src/bee_py/modules/debug/states.py
  - src/bee_py/types/type.py
  - src/bee_py/utils/pss.py
  - tests/integration/modules/test_chunk.py
  • Loading branch information
Aviksaikat committed Dec 9, 2023
1 parent 55a4142 commit b640b99
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 37 deletions.
10 changes: 5 additions & 5 deletions src/bee_py/bee.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(self, url: str, options: Optional[BeeOptions] = None):
def __get_request_options_for_call(
self,
options: Optional[BeeRequestOptions] = None,
) -> dict:
) -> BeeRequestOptions:
"""
Returns the request options for a call, merging the default options with the provided options.
Expand Down Expand Up @@ -266,7 +266,7 @@ def download_data(
assert_request_options(options)
assert_reference(reference)

return bytes_api.downalod(self.__get_request_options_for_call(options), reference)
return bytes_api.download(self.__get_request_options_for_call(options), reference)

def download_readable_data(self, reference: ReferenceOrENS, options: Optional[BeeRequestOptions] = None) -> bytes:
"""
Expand Down Expand Up @@ -1254,10 +1254,10 @@ def make_soc_reader(
assert_request_options(options)
canonical_owner = make_eth_address(owner_address)

def downalod():
def download():
return download_single_owner_chunk(self.__get_request_options_for_call(options), canonical_owner, None)

return SOCReader(owner=make_hex_eth_address(canonical_owner), downalod=downalod)
return SOCReader(owner=make_hex_eth_address(canonical_owner), download=download)

def make_soc_writer(
self, signer: Optional[Union[Signer, bytes, str]], options: Optional[BeeRequestOptions] = None
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def upload():
return upload_single_owner_chunk_data(self.__get_request_options_for_call(options), canonical_signer)

# TODO: Look into it
return SOCWriter(owner=reader.owner, downalod=reader.downalod, upload=upload)
return SOCWriter(owner=reader.owner, download=reader.download, upload=upload)

def check_connection(self, options: Optional[BeeRequestOptions] = None) -> bool:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/bee_py/chunk/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from bee_py.chunk.span import SPAN_SIZE
from bee_py.modules.chunk import download
from bee_py.modules.soc import upload
from bee_py.types.type import BatchId, BeeRequestOptions, Reference, UploadOptions, assert_address
from bee_py.types.type import BatchId, BeeRequestOptions, Reference, Signer, UploadOptions, assert_address
from bee_py.utils.bytes import bytes_at_offset, bytes_equal, flex_bytes_at_offset
from bee_py.utils.error import BeeError
from bee_py.utils.hash import keccak256_hash
Expand Down Expand Up @@ -222,7 +222,7 @@ def upload_single_owner_chunk(

def upload_single_owner_chunk_data(
request_options: BeeRequestOptions,
signer: dict,
signer: Signer,
postage_batch_id: BatchId,
identifier: Identifier,
data: bytes,
Expand Down
2 changes: 1 addition & 1 deletion src/bee_py/feed/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def __download(
owner=owner,
topic=topic,
options=options,
downalod=download_partial,
download=download_partial,
)


Expand Down
1 change: 0 additions & 1 deletion src/bee_py/feed/retrievable.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from ape.types import AddressType

from bee_py.feed.feed import get_feed_update_chunk_reference

# from bee_py.bee import Bee
from bee_py.modules.bytes import read_big_endian
from bee_py.types.type import BeeRequestOptions, Index, Reference, Topic
Expand Down
9 changes: 1 addition & 8 deletions src/bee_py/modules/debug/connectivity.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
from bee_py.types.type import (
BeeRequestOptions,
NodeAddresses,
Peers,
PingResponse,
RemovePeerResponse,
Topology,
)
from bee_py.types.type import BeeRequestOptions, NodeAddresses, Peers, PingResponse, RemovePeerResponse, Topology
from bee_py.utils.http import http
from bee_py.utils.logging import logger

Expand Down
8 changes: 1 addition & 7 deletions src/bee_py/modules/debug/stamps.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
from typing import Optional, Union

from bee_py.types.type import (
BatchId,
BeeRequestOptions,
PostageBatch,
PostageBatchBuckets,
PostageBatchOptions,
)
from bee_py.types.type import BatchId, BeeRequestOptions, PostageBatch, PostageBatchBuckets, PostageBatchOptions
from bee_py.utils.http import http
from bee_py.utils.logging import logger

Expand Down
8 changes: 1 addition & 7 deletions src/bee_py/modules/debug/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

from pydantic import ValidationError

from bee_py.types.type import (
BeeRequestOptions,
ChainState,
ReserveState,
WalletBalance,
WalletBalanceOLD,
)
from bee_py.types.type import BeeRequestOptions, ChainState, ReserveState, WalletBalance, WalletBalanceOLD
from bee_py.utils.http import http
from bee_py.utils.logging import logger

Expand Down
3 changes: 0 additions & 3 deletions src/bee_py/types/type.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import json

# from abc import abstractmethod
from enum import Enum
from typing import Annotated, Any, Callable, Generic, NewType, Optional, TypeVar, Union

from ape.managers.accounts import AccountAPI
from ape.types import AddressType

# from eth_pydantic_types import HexBytes
from eth_pydantic_types import HexBytes as BaseHexBytes
from pydantic import BaseModel, Field, validator

# from requests import PreparedRequest, Response
from typing_extensions import TypeAlias

Expand Down
2 changes: 1 addition & 1 deletion src/bee_py/utils/pss.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bee_py.types.type import PSS_TARGET_HEX_LENGTH_MAX, AddressPrefix
from bee_py.types.type import PSS_TARGET_HEX_LENGTH_MAX, AddressPrefix


def make_max_target(target: str) -> AddressPrefix:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/modules/test_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def test_store_retreive_data(bee_ky_options, get_debug_postage):

assert str(response) == reference

downaloded_data = download(bee_ky_options, response)
downloaded_data = download(bee_ky_options, response)

assert downaloded_data.hex() == data.hex()
assert downloaded_data.hex() == data.hex()


def test_fail_downalding_data(bee_debug_ky_options):
Expand Down

0 comments on commit b640b99

Please sign in to comment.