py docs fixes

This commit is contained in:
protolambda 2019-10-24 15:31:43 +08:00
parent b2ad6069d4
commit 0cc50725ed
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 11 additions and 2 deletions

View File

@ -29,10 +29,18 @@ def with_custom_state(balances_fn: Callable[[Any], Sequence[int]],
def default_activation_threshold(spec):
"""
Helper method to use the default balance activation threshold for state creation for tests.
Usage: `@with_custom_state(threshold_fn=default_activation_threshold, ...)`
"""
return spec.MAX_EFFECTIVE_BALANCE
def default_balances(spec):
"""
Helper method to create a series of default balances.
Usage: `@with_custom_state(balances_fn=default_balances, ...)`
"""
num_validators = spec.SLOTS_PER_EPOCH * 8
return [spec.MAX_EFFECTIVE_BALANCE] * num_validators
@ -42,7 +50,8 @@ with_state = with_custom_state(default_balances, default_activation_threshold)
def low_balances(spec):
"""
Helper method to create a series of low balances. Usage: `@with_validator_balances(low_balances)`
Helper method to create a series of low balances.
Usage: `@with_custom_state(balances_fn=low_balances, ...)`
"""
num_validators = spec.SLOTS_PER_EPOCH * 8
# Technically the balances cannot be this low starting from genesis, but it is useful for testing
@ -53,7 +62,7 @@ def low_balances(spec):
def misc_balances(spec):
"""
Helper method to create a series of balances that includes some misc. balances.
Usage: `@with_validator_balances(misc_balances)`
Usage: `@with_custom_state(balances_fn=misc_balances, ...)`
"""
num_validators = spec.SLOTS_PER_EPOCH * 8
num_misc_validators = spec.SLOTS_PER_EPOCH