Linted :)

This commit is contained in:
Carl Beekhuizen 2019-05-16 12:38:50 +02:00
parent 229dfe81a6
commit 3e085947b7
No known key found for this signature in database
GPG Key ID: D05CA176D0020646
2 changed files with 14 additions and 18 deletions

View File

@ -1,11 +1,5 @@
from . import spec from . import spec
from typing import (
Any,
Callable,
List
)
from .spec import ( from .spec import (
BeaconState, BeaconState,
BeaconBlock, BeaconBlock,
@ -13,15 +7,11 @@ from .spec import (
) )
from eth2spec.phase0.state_transition import ( from eth2spec.phase0.state_transition import (
expected_deposit_count,
process_operation_type, process_operation_type,
process_operations as process_operations_phase0, process_operations as process_operations_phase0,
process_block as process_block_phase0,
process_epoch_transition as process_epoch_transition_phase0,
state_transition_to as state_transition_to_phase0,
state_transition as state_transition_phase0
) )
def process_operations(state: BeaconState, block: BeaconBlock) -> None: def process_operations(state: BeaconState, block: BeaconBlock) -> None:
process_operations_phase0(state, block) process_operations_phase0(state, block)
@ -39,6 +29,7 @@ def process_operations(state: BeaconState, block: BeaconBlock) -> None:
spec.process_early_derived_secret_reveal, spec.process_early_derived_secret_reveal,
) )
def process_block(state: BeaconState, def process_block(state: BeaconState,
block: BeaconBlock, block: BeaconBlock,
verify_state_root: bool=False) -> None: verify_state_root: bool=False) -> None:
@ -50,6 +41,7 @@ def process_block(state: BeaconState,
if verify_state_root: if verify_state_root:
spec.verify_block_state_root(state, block) spec.verify_block_state_root(state, block)
def process_epoch_transition(state: BeaconState) -> None: def process_epoch_transition(state: BeaconState) -> None:
spec.process_justification_and_finalization(state) spec.process_justification_and_finalization(state)
spec.process_crosslinks(state) spec.process_crosslinks(state)
@ -62,6 +54,7 @@ def process_epoch_transition(state: BeaconState) -> None:
spec.process_final_updates(state) spec.process_final_updates(state)
spec.after_process_final_updates(state) spec.after_process_final_updates(state)
def state_transition_to(state: BeaconState, up_to: Slot) -> BeaconState: def state_transition_to(state: BeaconState, up_to: Slot) -> BeaconState:
while state.slot < up_to: while state.slot < up_to:
spec.cache_state(state) spec.cache_state(state)

View File

@ -8,9 +8,10 @@ ZERO_CHUNK = b'\x00' * BYTES_PER_CHUNK
cached_typedefs = {} cached_typedefs = {}
def SSZType(name, fields): def SSZType(name, fields):
class SSZObject(): class SSZObject():
if name != None: if name is not None:
__name__ = name __name__ = name
__qualname__ = name __qualname__ = name
@ -44,16 +45,18 @@ def SSZType(name, fields):
SSZObject.fields = fields SSZObject.fields = fields
if name != None: if name is not None:
cached_typedefs[name] = SSZObject cached_typedefs[name] = SSZObject
return SSZObject return SSZObject
def SSZTypeExtension(original_type, new_fields): def SSZTypeExtension(original_type, new_fields):
typedef = cached_typedefs[original_type] typedef = cached_typedefs[original_type]
typedef.fields.update(new_fields) typedef.fields.update(new_fields)
return typedef return typedef
class Vector(): class Vector():
def __init__(self, items): def __init__(self, items):
self.items = items self.items = items