chore: fix some comments (#19493)

Signed-off-by: timesince <seekseat@icloud.com>
This commit is contained in:
timesince
2025-04-11 09:23:21 -07:00
committed by GitHub
parent acbe88923b
commit 09f48746de
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -394,7 +394,7 @@ bother_waterfowl(fowl=Goose(), aggressiveness=3)
When hinting based on a Protocol there can often be unexpected complexities. When hinting based on a Protocol there can often be unexpected complexities.
Consider passing in an instance of a class with an attribute hinted `str` while the protocol hints it as `Union[str, int]`. Consider passing in an instance of a class with an attribute hinted `str` while the protocol hints it as `Union[str, int]`.
It is common to expect that `str` satisfies `Union[str, int]` and to be throughly confused by mypy's complaint that it does not. It is common to expect that `str` satisfies `Union[str, int]` and to be thoroughly confused by mypy's complaint that it does not.
The hazard here is that since the function receiving the object thinks the attribute can be either a `str` or an `int` it may decide to assign an `int` to it. The hazard here is that since the function receiving the object thinks the attribute can be either a `str` or an `int` it may decide to assign an `int` to it.
The protocol says this is ok. The protocol says this is ok.
A good solution for many cases is to hint that attribute as being read only on the protocol. A good solution for many cases is to hint that attribute as being read only on the protocol.
+1 -1
View File
@@ -362,7 +362,7 @@ class Blockchain:
fork_info.reset(block.height - 1, block.prev_header_hash) fork_info.reset(block.height - 1, block.prev_header_hash)
# we dont consider block_record passed in here since it might be from # we dont consider block_record passed in here since it might be from
# a current sync process and not yet fully validated and commited to the DB # a current sync process and not yet fully validated and committed to the DB
block_rec_from_db = await self.get_block_record_from_db(header_hash) block_rec_from_db = await self.get_block_record_from_db(header_hash)
if block_rec_from_db is not None: if block_rec_from_db is not None:
# We have already validated the block, but if it's not part of the # We have already validated the block, but if it's not part of the
+1 -1
View File
@@ -38,7 +38,7 @@ DEFAULT_CONSTANTS = ConsensusConstants(
# Default used for tests is std_hash(b'') # Default used for tests is std_hash(b'')
GENESIS_CHALLENGE=bytes32.fromhex("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"), GENESIS_CHALLENGE=bytes32.fromhex("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
# Forks of chia should change the AGG_SIG_*_ADDITIONAL_DATA values to provide # Forks of chia should change the AGG_SIG_*_ADDITIONAL_DATA values to provide
# replay attack protection. This is set to mainnet genesis challange # replay attack protection. This is set to mainnet genesis challenge
AGG_SIG_ME_ADDITIONAL_DATA=AGG_SIG_DATA, AGG_SIG_ME_ADDITIONAL_DATA=AGG_SIG_DATA,
AGG_SIG_PARENT_ADDITIONAL_DATA=std_hash(AGG_SIG_DATA + bytes([43])), AGG_SIG_PARENT_ADDITIONAL_DATA=std_hash(AGG_SIG_DATA + bytes([43])),
AGG_SIG_PUZZLE_ADDITIONAL_DATA=std_hash(AGG_SIG_DATA + bytes([44])), AGG_SIG_PUZZLE_ADDITIONAL_DATA=std_hash(AGG_SIG_DATA + bytes([44])),
+1 -1
View File
@@ -155,7 +155,7 @@ class Program(SExp):
# (2 (1 . self) rest) # (2 (1 . self) rest)
# #
# Resulting in a function which places its own arguments after those # Resulting in a function which places its own arguments after those
# curried in in the form of a proper list. # curried in the form of a proper list.
def curry(self, *args) -> Program: def curry(self, *args) -> Program:
fixed_args: Any = 1 fixed_args: Any = 1
for arg in reversed(args): for arg in reversed(args):
+1 -1
View File
@@ -49,7 +49,7 @@ class Formatter:
def __init__(self) -> None: def __init__(self) -> None:
self.start_paren_level: int = 0 self.start_paren_level: int = 0
self.paren_level: int = 0 self.paren_level: int = 0
self.out_col: int = 0 # The colum we are at while outputting a line self.out_col: int = 0 # The column we are at while outputting a line
self.cur_line: int = 0 self.cur_line: int = 0
self.line: list[bytes] = [] self.line: list[bytes] = []
self.comment: Optional[list[bytes]] = None self.comment: Optional[list[bytes]] = None