Skip to content

Commit

Permalink
minor test fails fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Aviksaikat committed Jan 6, 2024
1 parent 353f9f7 commit ae50914
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 57 deletions.
6 changes: 3 additions & 3 deletions src/bee_py/modules/bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def upload(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

upload_response = response.json()
reference = Reference(value=upload_response["reference"])
Expand Down Expand Up @@ -75,7 +75,7 @@ def download(request_options: BeeRequestOptions, _hash: ReferenceOrENS) -> Data:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return wrap_bytes_with_helpers(response.content)

Expand All @@ -99,7 +99,7 @@ def download_readable(request_options: BeeRequestOptions, _hash: ReferenceOrENS)
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return response

Expand Down
8 changes: 4 additions & 4 deletions src/bee_py/modules/bzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def upload_file(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

upload_response = response.json()
reference = Reference(value=upload_response["reference"])
Expand Down Expand Up @@ -117,7 +117,7 @@ def download_file(request_options: BeeRequestOptions, _hash: ReferenceOrENS, pat
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore
file_headers = read_file_headers(response.headers)
file_data = wrap_bytes_with_helpers(response.content)

Expand Down Expand Up @@ -146,7 +146,7 @@ def download_file_readable(request_options: BeeRequestOptions, _hash: ReferenceO
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

file_headers = read_file_headers(response.headers)
file_data = response.data
Expand Down Expand Up @@ -226,7 +226,7 @@ def upload_collection(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

upload_response = response.json()
reference = Reference(value=upload_response["reference"])
Expand Down
4 changes: 2 additions & 2 deletions src/bee_py/modules/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def upload(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return Reference(value=response.json()["reference"])

Expand All @@ -56,5 +56,5 @@ def download(request_options: BeeRequestOptions, _hash: ReferenceOrENS) -> Data:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore
return wrap_bytes_with_helpers(response.content)
17 changes: 8 additions & 9 deletions src/bee_py/modules/debug/chequebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_chequebook_address(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

chequebook_address_response = response.json()
return ChequebookAddressResponse.model_validate(chequebook_address_response)
Expand All @@ -64,7 +64,7 @@ def get_chequebook_balance(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

chequebook_balance_response = response.json()
return ChequebookBalanceResponse.model_validate(chequebook_balance_response)
Expand Down Expand Up @@ -93,8 +93,7 @@ def get_last_cashout_action(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore
return None # type: ignore

last_cashout_action_response = response.json()
return LastCashoutActionResponse.model_validate(last_cashout_action_response)
Expand Down Expand Up @@ -140,7 +139,7 @@ def cashout_last_cheque(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

transaction_response = response.json()
return transaction_response["transactionHash"]
Expand Down Expand Up @@ -169,7 +168,7 @@ def get_last_cheques_for_peer(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

last_cheques_for_peer_response = response.json()
return LastChequesForPeerResponse.model_validate(last_cheques_for_peer_response)
Expand All @@ -194,7 +193,7 @@ def get_last_cheques(request_options: BeeRequestOptions) -> LastChequesResponse:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

last_cheques_response = response.json()
return LastChequesResponse.model_validate(last_cheques_response)
Expand Down Expand Up @@ -235,7 +234,7 @@ def deposit_tokens(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

transaction_response = response.json()
return transaction_response["transactionHash"]
Expand Down Expand Up @@ -276,7 +275,7 @@ def withdraw_tokens(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

transaction_response = response.json()
return transaction_response["transactionHash"]
10 changes: 5 additions & 5 deletions src/bee_py/modules/debug/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_node_addresses(request_options: BeeRequestOptions) -> NodeAddresses:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

addresses_response = response.json()
return NodeAddresses.model_validate(addresses_response)
Expand All @@ -53,7 +53,7 @@ def get_peers(request_options: NodeAddresses) -> Peers:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

peers_response = response.json()
return Peers.model_validate(peers_response)
Expand Down Expand Up @@ -103,7 +103,7 @@ def remove_peer(request_options: BeeRequestOptions, peer: str) -> RemovePeerResp
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return RemovePeerResponse.model_validate(response.json())

Expand All @@ -127,7 +127,7 @@ def get_topology(request_options: BeeRequestOptions) -> Topology:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return Topology.model_validate(response.json())

Expand All @@ -149,6 +149,6 @@ def ping_peer(request_options: BeeRequestOptions, peer: str) -> PingResponse:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return PingResponse.model_validate(response.json())
4 changes: 2 additions & 2 deletions src/bee_py/modules/debug/stake.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_stake(request_options: BeeRequestOptions) -> NumberString:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return response.json()["stakedAmount"]

Expand Down Expand Up @@ -91,7 +91,7 @@ def get_redistribution_state(request_options: BeeRequestOptions) -> Redistributi
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

redistribution_state = response.json()

Expand Down
14 changes: 7 additions & 7 deletions src/bee_py/modules/debug/stamps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_global_postage_batches(request_options: BeeRequestOptions) -> list[Posta
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return parse_postage_batch(response.json())

Expand All @@ -60,7 +60,7 @@ def get_all_postage_batches(request_options: BeeRequestOptions) -> list[PostageB
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return parse_postage_batch(response.json())

Expand All @@ -87,7 +87,7 @@ def get_postage_batch(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

return PostageBatch.model_validate(response.json())

Expand All @@ -114,7 +114,7 @@ def get_postage_batch_buckets(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

postage_batch_buckets = response.json()
return PostageBatchBuckets.model_validate(postage_batch_buckets)
Expand Down Expand Up @@ -166,7 +166,7 @@ def create_postage_batch(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

stamp_response = response.json()
return stamp_response["batchID"]
Expand Down Expand Up @@ -197,7 +197,7 @@ def top_up_batch(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

stamp_response = response.json()
return stamp_response["batchID"]
Expand Down Expand Up @@ -228,7 +228,7 @@ def dilute_batch(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

stamp_response = response.json()
return stamp_response["batchID"]
7 changes: 3 additions & 4 deletions src/bee_py/modules/debug/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_reserve_state(request_options: BeeRequestOptions) -> ReserveState:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

reserve_state_response = response.json()
return ReserveState.model_validate(reserve_state_response)
Expand All @@ -53,7 +53,7 @@ def get_chain_state(request_options: BeeRequestOptions) -> ChainState:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

chain_state_response = response.json()
return ChainState.model_validate(chain_state_response)
Expand Down Expand Up @@ -101,8 +101,7 @@ def get_wallet_balance(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None
return None # type: ignore

wallet_balance_response = response.json()

Expand Down
6 changes: 3 additions & 3 deletions src/bee_py/modules/debug/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_debug_status(request_options: BeeRequestOptions) -> DebugStatus:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

debug_status_response = response.json()
return DebugStatus.model_validate(debug_status_response)
Expand All @@ -62,7 +62,7 @@ def get_health(request_options: BeeRequestOptions) -> Health:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

health_response = response.json()
return Health.model_validate(health_response)
Expand Down Expand Up @@ -106,7 +106,7 @@ def get_node_info(request_options: BeeRequestOptions) -> NodeInfo:
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

node_info_response = response.json()
return NodeInfo.model_validate(node_info_response)
Expand Down
2 changes: 1 addition & 1 deletion src/bee_py/modules/debug/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def retrieve_extended_tag(request_options: BeeRequestOptions, uid: int) -> Exten
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

debug_status_response = response.json()
return ExtendedTag.model_validate(debug_status_response)
8 changes: 4 additions & 4 deletions src/bee_py/modules/debug/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_all_transactions(request_options: BeeRequestOptions) -> list[Transaction
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

transactions_response = response.json()

Expand Down Expand Up @@ -53,7 +53,7 @@ def get_transaction(request_options: BeeRequestOptions, transaction_hash: Transa
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

transaction_response = response.json()
return TransactionInfo.model_validate(transaction_response)
Expand All @@ -78,7 +78,7 @@ def rebroadcast_transaction(request_options: BeeRequestOptions, transaction_hash
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

rebroadcasted_transaction_response = response.json()
return rebroadcasted_transaction_response["transactionHash"]
Expand Down Expand Up @@ -117,7 +117,7 @@ def cancel_transaction(
logger.info(response.json())
if response.raise_for_status():
logger.error(response.raise_for_status()) # type: ignore
return None # type: ignore
return None # type: ignore

canceled_transaction_response = response.json()
return canceled_transaction_response["transactionHash"]
Loading

0 comments on commit ae50914

Please sign in to comment.