Skip to content

Commit

Permalink
add all none's (Chia-Network#4503)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolaj Kuntner <>
  • Loading branch information
Nikolaj-K authored May 11, 2021
1 parent 118e7cc commit cbc9141
Show file tree
Hide file tree
Showing 39 changed files with 184 additions and 184 deletions.
2 changes: 1 addition & 1 deletion chia/cmds/farm_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async def get_challenges(farmer_rpc_port: int) -> Optional[List[Dict[str, Any]]]
async def challenges(farmer_rpc_port: int, limit: int) -> None:
signage_points = await get_challenges(farmer_rpc_port)
if signage_points is None:
return
return None

signage_points.reverse()
if limit != 0:
Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/init_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def check_keys(new_root: Path) -> None:
all_sks = keychain.get_all_private_keys()
if len(all_sks) == 0:
print("No keys are present in the keychain. Generate them with 'chia keys generate'")
return
return None

config: Dict = load_config(new_root, "config.yaml")
pool_child_pubkeys = [master_sk_to_pool_sk(sk).get_g1() for sk, _ in all_sks]
Expand Down
6 changes: 3 additions & 3 deletions chia/cmds/keys_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def add_private_key_seed(mnemonic: str):

except ValueError as e:
print(e)
return
return None


def show_all_keys(show_mnemonic: bool):
Expand All @@ -68,7 +68,7 @@ def show_all_keys(show_mnemonic: bool):
prefix = config["network_overrides"]["config"][selected]["address_prefix"]
if len(private_keys) == 0:
print("There are no saved private keys")
return
return None
msg = "Showing all public keys derived from your private keys:"
if show_mnemonic:
msg = "Showing all public and private keys"
Expand Down Expand Up @@ -117,7 +117,7 @@ def sign(message: str, fingerprint: int, hd_path: str):
sk = AugSchemeMPL.derive_child_sk(sk, c)
print("Public key:", sk.get_g1())
print("Signature:", AugSchemeMPL.sign(sk, bytes(message, "utf-8")))
return
return None
print(f"Fingerprint {fingerprint} not found in keychain")


Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def show_async(
blockchain_state = await client.get_blockchain_state()
if blockchain_state is None:
print("There is no blockchain found yet. Try again shortly")
return
return None
peak: Optional[BlockRecord] = blockchain_state["peak"]
difficulty = blockchain_state["difficulty"]
sub_slot_iters = blockchain_state["sub_slot_iters"]
Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/start_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def async_start(root_path: Path, group: str, restart: bool) -> None:
daemon = await create_start_daemon_connection(root_path)
if daemon is None:
print("Failed to create the chia daemon")
return
return None

for service in services_for_groups(group):
if await daemon.is_running(service_name=service):
Expand Down
8 changes: 4 additions & 4 deletions chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ async def get_transactions(args: dict, wallet_client: WalletRpcClient, fingerpri
break
print_transaction(txs[i + j], verbose=(args["verbose"] > 0), name=name)
if i + num_per_screen >= len(txs):
return
return None
print("Press q to quit, or c to continue")
while True:
entered_key = sys.stdin.read(1)
if entered_key == "q":
return
return None
elif entered_key == "c":
break

Expand All @@ -86,7 +86,7 @@ async def send(args: dict, wallet_client: WalletRpcClient, fingerprint: int) ->
if len(tx.sent_to) > 0:
print(f"Transaction submitted to nodes: {tx.sent_to}")
print(f"Do chia wallet get_transaction -f {fingerprint} -tx 0x{tx_id} to get status")
return
return None

print("Transaction not yet submitted to nodes")
print(f"Do 'chia wallet get_transaction -f {fingerprint} -tx 0x{tx_id}' to get status")
Expand Down Expand Up @@ -214,7 +214,7 @@ async def execute_with_wallet(wallet_rpc_port: int, fingerprint: int, extra_para
if wallet_client_f is None:
wallet_client.close()
await wallet_client.await_closed()
return
return None
wallet_client, fingerprint = wallet_client_f
await function(extra_params, wallet_client, fingerprint)
except KeyboardInterrupt:
Expand Down
10 changes: 5 additions & 5 deletions chia/consensus/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def _load_chain_from_store(self) -> None:
if len(block_records) == 0:
assert peak is None
self._peak_height = None
return
return None

assert peak is not None
self._peak_height = self.block_record(peak).height
Expand Down Expand Up @@ -594,7 +594,7 @@ async def warmup(self, fork_point: uint32):
"""
if self._peak_height is None:
return
return None
block_records = await self.block_store.get_block_records_in_range(
max(fork_point - self.constants.BLOCKS_CACHE_SIZE, uint32(0)), fork_point
)
Expand All @@ -608,7 +608,7 @@ def clean_block_record(self, height: int):
height: Minimum height that we need to keep in the cache
"""
if height < 0:
return
return None
blocks_to_remove = self.__heights_in_cache.get(uint32(height), None)
while blocks_to_remove is not None and height >= 0:
for header_hash in blocks_to_remove:
Expand All @@ -626,12 +626,12 @@ def clean_block_records(self):
"""

if len(self.__block_records) < self.constants.BLOCKS_CACHE_SIZE:
return
return None

peak = self.get_peak()
assert peak is not None
if peak.height - self.constants.BLOCKS_CACHE_SIZE < 0:
return
return None
self.clean_block_record(peak.height - self.constants.BLOCKS_CACHE_SIZE)

async def get_block_records_in_range(self, start: int, stop: int) -> Dict[bytes32, BlockRecord]:
Expand Down
2 changes: 1 addition & 1 deletion chia/daemon/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async def listener():
try:
message = await self.websocket.recv()
except websockets.exceptions.ConnectionClosedOK:
return
return None
decoded = json.loads(message)
id = decoded["request_id"]

Expand Down
12 changes: 6 additions & 6 deletions chia/daemon/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ def extract_plot_queue(self, id=None) -> List[Dict]:
async def _state_changed(self, service: str, message: Dict[str, Any]):
"""If id is None, send the whole state queue"""
if service not in self.connections:
return
return None

websockets = self.connections[service]

if message is None:
return
return None

response = create_payload("state_changed", message, service, "wallet_ui")

Expand All @@ -366,7 +366,7 @@ async def _watch_file_changes(self, config, fp: TextIO, loop: asyncio.AbstractEv
new_data = await loop.run_in_executor(io_pool_exc, fp.readline)

if config["state"] is not PlotState.RUNNING:
return
return None

if new_data not in (None, ""):
config["log"] = new_data if config["log"] is None else config["log"] + new_data
Expand All @@ -376,7 +376,7 @@ async def _watch_file_changes(self, config, fp: TextIO, loop: asyncio.AbstractEv
if new_data:
for word in final_words:
if word in new_data:
return
return None
else:
time.sleep(0.5)

Expand Down Expand Up @@ -443,7 +443,7 @@ def _run_next_serial_plotting(self, loop: asyncio.AbstractEventLoop, queue: str
next_plot_id = None

if self._is_serial_plotting_running(queue) is True:
return
return None

for item in self.plots_queue:
if item["queue"] == queue and item["state"] is PlotState.SUBMITTED and item["parallel"] is False:
Expand All @@ -470,7 +470,7 @@ async def _start_plotting(self, id: str, loop: asyncio.AbstractEventLoop, queue:
await asyncio.sleep(delay)

if config["state"] is not PlotState.SUBMITTED:
return
return None

service_name = config["service_name"]
command_args = config["command_args"]
Expand Down
16 changes: 8 additions & 8 deletions chia/farmer/farmer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ async def new_proof_of_space(
f"Surpassed {max_pos_per_sp} PoSpace for one SP, no longer submitting PoSpace for signage point "
f"{new_proof_of_space.sp_hash}"
)
return
return None

if new_proof_of_space.sp_hash not in self.farmer.sps:
self.farmer.log.warning(
f"Received response for a signage point that we do not have {new_proof_of_space.sp_hash}"
)
return
return None

sps = self.farmer.sps[new_proof_of_space.sp_hash]
for sp in sps:
Expand All @@ -62,7 +62,7 @@ async def new_proof_of_space(
)
if computed_quality_string is None:
self.farmer.log.error(f"Invalid proof of space {new_proof_of_space.proof}")
return
return None

self.farmer.number_of_responses[new_proof_of_space.sp_hash] += 1

Expand Down Expand Up @@ -116,7 +116,7 @@ async def respond_signatures(self, response: harvester_protocol.RespondSignature
"""
if response.sp_hash not in self.farmer.sps:
self.farmer.log.warning(f"Do not have challenge hash {response.challenge_hash}")
return
return None
is_sp_signatures: bool = False
sps = self.farmer.sps[response.sp_hash]
signage_point_index = sps[0].signage_point_index
Expand All @@ -140,7 +140,7 @@ async def respond_signatures(self, response: harvester_protocol.RespondSignature
)
if computed_quality_string is None:
self.farmer.log.warning(f"Have invalid PoSpace {pospace}")
return
return None

if is_sp_signatures:
(
Expand Down Expand Up @@ -169,7 +169,7 @@ async def respond_signatures(self, response: harvester_protocol.RespondSignature
self.farmer.log.error(
f"Don't have the private key for the pool key used by harvester: {pool_pk.hex()}"
)
return
return None

pool_target: Optional[PoolTarget] = PoolTarget(self.farmer.pool_target, uint32(0))
assert pool_target is not None
Expand All @@ -196,7 +196,7 @@ async def respond_signatures(self, response: harvester_protocol.RespondSignature
self.farmer.state_changed("proof", {"proof": request, "passed_filter": True})
msg = make_msg(ProtocolMessageTypes.declare_proof_of_space, request)
await self.farmer.server.send_to_all([msg], NodeType.FULL_NODE)
return
return None

else:
# This is a response with block signatures
Expand Down Expand Up @@ -257,7 +257,7 @@ async def new_signage_point(self, new_signage_point: farmer_protocol.NewSignageP
async def request_signed_values(self, full_node_request: farmer_protocol.RequestSignedValues):
if full_node_request.quality_string not in self.farmer.quality_str_to_identifiers:
self.farmer.log.error(f"Do not have quality string {full_node_request.quality_string}")
return
return None

(plot_identifier, challenge_hash, sp_hash, node_id) = self.farmer.quality_str_to_identifiers[
full_node_request.quality_string
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/coin_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def new_block(self, block: FullBlock, tx_additions: List[Coin], tx_removal
Only called for blocks which are blocks (and thus have rewards and transactions)
"""
if block.is_transaction_block() is False:
return
return None
assert block.foliage_transaction_block is not None

for coin in tx_additions:
Expand Down
Loading

0 comments on commit cbc9141

Please sign in to comment.