repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/block_processing/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_withholding.py
from eth2spec.test.context import ( spec_state_test, with_altair_and_later, with_presets, ) from eth2spec.test.helpers.constants import ( MINIMAL, ) from eth2spec.test.helpers.attestations import ( state_transition_with_full_block, ) from eth2spec.test.helpers.block import ( build_empty_block_fo...
10,474
49.849515
116
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_get_head.py
import random from eth2spec.test.context import ( spec_state_test, with_altair_and_later, with_presets, ) from eth2spec.test.helpers.attestations import get_valid_attestation, next_epoch_with_attestations from eth2spec.test.helpers.block import ( apply_empty_block, build_empty_block_for_next_slot, ...
31,519
41.767978
119
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/fork_choice/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_on_block.py
import random from eth_utils import encode_hex from eth2spec.utils.ssz.ssz_impl import hash_tree_root from eth2spec.test.context import ( MINIMAL, spec_state_test, with_altair_and_later, with_presets ) from eth2spec.test.helpers.attestations import ( next_epoch_with_attestations, next_slots_wit...
59,113
42.788148
118
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_reorg.py
from eth2spec.test.context import ( spec_state_test, with_altair_and_later, with_presets, ) from eth2spec.test.helpers.constants import ( MINIMAL, ) from eth2spec.test.helpers.attestations import ( state_transition_with_full_block, get_valid_attestation, get_valid_attestation_at_slot, ) from...
20,423
39.92986
116
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_ex_ante.py
from eth2spec.test.context import ( MAINNET, spec_state_test, with_altair_and_later, with_presets, ) from eth2spec.test.helpers.attestations import ( get_valid_attestation, sign_attestation, ) from eth2spec.test.helpers.block import ( build_empty_block, ) from eth2spec.test.helpers.fork_choi...
17,645
40.815166
107
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py
from random import Random from eth2spec.utils import bls from eth2spec.test.helpers.state import ( get_balance, state_transition_and_sign_block, next_slot, next_epoch, next_epoch_via_block, ) from eth2spec.test.helpers.block import ( build_empty_block_for_next_slot, build_empty_block, sign_block, t...
41,750
35.368467
119
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/sanity/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/sanity/test_slots.py
from eth2spec.test.helpers.forks import ( is_post_capella, ) from eth2spec.test.helpers.state import get_state_root from eth2spec.test.context import ( spec_state_test, with_all_phases, ) @with_all_phases @spec_state_test def test_slots_1(spec, state): pre_slot = state.slot pre_root = state.hash_t...
2,338
24.988889
83
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/genesis/test_validity.py
from eth2spec.test.context import ( spec_test, single_phase, with_presets, with_all_phases, ) from eth2spec.test.helpers.constants import MINIMAL from eth2spec.test.helpers.deposits import ( prepare_full_genesis_deposits, ) from eth2spec.test.helpers.forks import ( is_post_altair, ) def get_po...
3,769
27.778626
93
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/genesis/test_initialization.py
from eth2spec.test.context import ( single_phase, spec_test, with_presets, with_all_phases, ) from eth2spec.test.helpers.constants import MINIMAL from eth2spec.test.helpers.deposits import ( prepare_full_genesis_deposits, prepare_random_genesis_deposits, ) from eth2spec.test.helpers.forks import...
7,451
32.719457
101
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/genesis/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/unittests/test_config_invariants.py
from eth2spec.test.context import ( spec_state_test, with_all_phases, ) from eth2spec.test.helpers.constants import MAX_UINT_64 from eth2spec.test.helpers.forks import ( is_post_altair, is_post_bellatrix, ) def check_bound(value, lower_bound, upper_bound): assert value >= lower_bound assert value ...
3,590
37.202128
104
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/unittests/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/unittests/validator/test_validator_unittest.py
import random from eth2spec.test.context import ( single_phase, spec_state_test, spec_test, always_bls, with_phases, with_all_phases, ) from eth2spec.test.helpers.constants import PHASE0 from eth2spec.test.helpers.attestations import build_attestation_data, get_valid_attestation from eth2spec.t...
16,880
31.715116
118
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/unittests/validator/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_attestation.py
from eth2spec.test.context import with_all_phases, spec_state_test from eth2spec.test.helpers.block import build_empty_block_for_next_slot from eth2spec.test.helpers.attestations import get_valid_attestation, sign_attestation from eth2spec.test.helpers.constants import ALL_PHASES from eth2spec.test.helpers.state import...
12,915
38.021148
109
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_tick.py
from eth2spec.test.context import with_all_phases, spec_state_test from eth2spec.test.helpers.fork_choice import get_genesis_forkchoice_store from eth2spec.test.helpers.block import ( build_empty_block_for_next_slot, ) from eth2spec.test.helpers.state import ( next_epoch, state_transition_and_sign_block, ...
4,249
35.016949
100
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_participation_record_updates.py
from eth2spec.test.context import spec_state_test, with_phases from eth2spec.test.helpers.constants import PHASE0 from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with ) def run_process_participation_record_updates(spec, state): yield from run_epoch_processing_with(spec, state, 'proce...
875
37.086957
93
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_justification_and_finalization.py
from random import Random from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with, ) from eth2spec.test.helpers.forks import is_post_altair from eth2spec.test.helpers.state import transition_to, next_epoch_via_block, next_slot...
16,059
41.37467
115
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_randao_mixes_reset.py
from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with ) def run_process_randao_mixes_reset(spec, state): yield from run_epoch_processing_with(spec, state, 'process_randao_mixes_reset') @with_all_phases @spec_state_te...
718
31.681818
101
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_registry_updates.py
from eth2spec.test.helpers.deposits import mock_deposit from eth2spec.test.helpers.state import next_epoch, next_slots from eth2spec.test.helpers.constants import MINIMAL from eth2spec.test.context import ( spec_test, spec_state_test, with_all_phases, single_phase, with_custom_state, with_presets, scale...
15,650
40.959786
119
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_effective_balance_updates.py
from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import run_epoch_processing_to @with_all_phases @spec_state_test def test_effective_balance_hysteresis(spec, state): # Prepare state up to the final-updates. # Then overwrite the balances, we only wa...
2,303
48.021277
109
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings_reset.py
from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with ) def run_process_slashings_reset(spec, state): yield from run_epoch_processing_with(spec, state, 'process_slashings_reset') @with_all_phases @spec_state_test def...
696
32.190476
80
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_historical_roots_update.py
from eth2spec.test.context import ( PHASE0, ALTAIR, BELLATRIX, spec_state_test, with_phases, ) from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with ) def run_process_historical_roots_update(spec, state): yield from run_epoch_processing_with(spec, state, 'process_historica...
772
29.92
100
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py
from eth2spec.test.context import ( spec_state_test, spec_test, with_all_phases, single_phase, with_phases, PHASE0, with_custom_state, zero_activation_threshold, misc_balances, low_single_balance, ) from eth2spec.test.helpers.forks import ( is_post_altair, ) from eth2spec.test.helpers.state ...
17,792
37.680435
116
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_eth1_data_reset.py
from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with, ) from eth2spec.test.helpers.state import transition_to def run_process_eth1_data_reset(spec, state): yield from run_epoch_processing_with(spec, state, 'process_et...
1,553
34.318182
80
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py
from random import Random from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with, run_epoch_processing_to ) from eth2spec.test.helpers.forks import is_post_altair, is_post_bellatrix from eth2spec.test.helpers.random import ra...
7,785
35.046296
104
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/rewards/test_leak.py
from eth2spec.test.context import with_all_phases, with_phases, spec_state_test from eth2spec.test.helpers.constants import PHASE0 from eth2spec.test.helpers.rewards import leaking import eth2spec.test.helpers.rewards as rewards_helpers @with_all_phases @spec_state_test @leaking() def test_empty_leak(spec, state): ...
4,112
25.031646
105
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/rewards/test_basic.py
from eth2spec.test.context import with_all_phases, with_phases, spec_state_test from eth2spec.test.helpers.constants import PHASE0 import eth2spec.test.helpers.rewards as rewards_helpers @with_all_phases @spec_state_test def test_empty(spec, state): yield from rewards_helpers.run_test_empty(spec, state) @with_a...
4,355
26.745223
105
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/rewards/test_random.py
from random import Random from eth2spec.test.context import ( with_all_phases, spec_test, spec_state_test, with_custom_state, single_phase, low_balances, misc_balances, ) import eth2spec.test.helpers.rewards as rewards_helpers from eth2spec.test.helpers.random import ( randomize_state, ...
4,355
32.251908
102
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/rewards/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/finality/test_finality.py
from eth2spec.test.context import spec_state_test, with_all_phases from eth2spec.test.helpers.state import next_epoch_via_block from eth2spec.test.helpers.attestations import next_epoch_with_attestations def check_finality(spec, state, prev_state, current_justi...
6,732
36.614525
109
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/phase0/finality/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_attestation.py
from eth2spec.test.context import ( with_phases, spec_state_test, always_bls, ) from eth2spec.test.helpers.constants import CUSTODY_GAME from eth2spec.test.helpers.state import transition_to from eth2spec.test.helpers.attestations import ( run_attestation_processing, get_valid_attestation, ) @with...
948
26.911765
85
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_custody_key_reveal.py
from eth2spec.test.helpers.constants import CUSTODY_GAME from eth2spec.test.helpers.custody import get_valid_custody_key_reveal from eth2spec.test.context import ( with_phases, spec_state_test, expect_assertion_error, always_bls, ) def run_custody_key_reveal_processing(spec, state, custody_key_reveal,...
2,833
30.488889
98
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_chunk_challenge.py
from eth2spec.test.helpers.custody import ( get_valid_chunk_challenge, get_valid_custody_chunk_response, get_sample_shard_transition, ) from eth2spec.test.helpers.attestations import ( get_valid_attestation, ) from eth2spec.test.helpers.constants import ( CUSTODY_GAME, MINIMAL, ) from eth2spec.t...
15,146
39.608579
120
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/block_processing/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_early_derived_secret_reveal.py
from eth2spec.test.helpers.constants import CUSTODY_GAME from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal from eth2spec.test.helpers.state import next_epoch_via_block, get_balance from eth2spec.test.context import ( with_phases, spec_state_test, expect_assertion_error, alw...
4,595
32.304348
109
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_custody_slashing.py
from eth2spec.test.helpers.custody import ( get_valid_custody_slashing, get_custody_slashable_shard_transition, ) from eth2spec.test.helpers.attestations import ( get_valid_attestation, ) from eth2spec.test.helpers.constants import ( CUSTODY_GAME, MINIMAL, ) from eth2spec.test.helpers.keys import pr...
5,666
34.41875
104
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/sanity/test_blocks.py
from typing import Dict, Sequence from eth2spec.test.context import ( with_phases, spec_state_test, with_presets, ) from eth2spec.test.helpers.attestations import get_valid_attestation from eth2spec.test.helpers.block import build_empty_block from eth2spec.test.helpers.constants import ( CUSTODY_GAME, ...
5,545
36.221477
118
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/sanity/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/epoch_processing/test_process_reveal_deadlines.py
from eth2spec.test.helpers.custody import ( get_valid_custody_key_reveal, ) from eth2spec.test.helpers.state import transition_to from eth2spec.test.context import ( with_phases, with_presets, spec_state_test, ) from eth2spec.test.helpers.constants import ( CUSTODY_GAME, MINIMAL, ) from eth2spec...
2,118
34.316667
117
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/epoch_processing/test_process_challenge_deadlines.py
from eth2spec.test.helpers.custody import ( get_valid_chunk_challenge, get_sample_shard_transition, ) from eth2spec.test.helpers.attestations import ( get_valid_attestation, ) from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot from eth2spec.test.context import ( spec_s...
2,270
33.938462
102
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/epoch_processing/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/test/custody_game/epoch_processing/test_process_custody_final_updates.py
from eth2spec.test.helpers.constants import ( CUSTODY_GAME, ) from eth2spec.test.helpers.custody import ( get_valid_chunk_challenge, get_valid_custody_chunk_response, get_valid_custody_key_reveal, get_sample_shard_transition ) from eth2spec.test.helpers.attestations import ( get_valid_attestatio...
7,210
39.511236
107
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
from eth2spec.utils.hash_function import hash from math import log2 ZERO_BYTES32 = b'\x00' * 32 zerohashes = [ZERO_BYTES32] for layer in range(1, 100): zerohashes.append(hash(zerohashes[layer - 1] + zerohashes[layer - 1])) def calc_merkle_tree_from_leaves(values, layer_count=32): values = list(values) ...
2,774
29.833333
117
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/kzg.py
# Ref: # - https://github.com/ethereum/research/blob/8f084630528ba33d92b2bc05edf5338dd193c6f1/trusted_setup/trusted_setup.py # - https://github.com/asn-d6/kzgverify import json import os from typing import ( Tuple, Sequence, ) from pathlib import Path from eth_utils import encode_hex from py_ecc.typing import ...
4,018
32.773109
117
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/test_merkle_proof_util.py
import pytest # Note: these functions are extract from merkle-proofs.md (deprecated), # the tests are temporary to show correctness while the document is still there. def get_power_of_two_ceil(x: int) -> int: if x <= 1: return 1 elif x == 2: return 2 else: return 2 * get_power_of_...
1,112
22.1875
84
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/bls.py
from py_ecc.bls import G2ProofOfPossession as py_ecc_bls from py_ecc.bls.g2_primatives import signature_to_G2 as _signature_to_G2 from py_ecc.optimized_bls12_381 import ( # noqa: F401 G1 as py_ecc_G1, G2 as py_ecc_G2, Z1 as py_ecc_Z1, add as py_ecc_add, multiply as py_ecc_mul, neg as py_ecc_neg...
8,681
26.388013
119
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/test_merkle_minimal.py
import pytest from .merkle_minimal import zerohashes, merkleize_chunks, get_merkle_root from .hash_function import hash def h(a: bytes, b: bytes) -> bytes: return hash(a + b) def e(v: int) -> bytes: # prefix with 0xfff... to make it non-zero return b'\xff' * 28 + v.to_bytes(length=4, byteorder='little')...
3,043
36.580247
117
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/hash_function.py
from hashlib import sha256 from remerkleable.byte_arrays import Bytes32 from typing import Union ZERO_BYTES32 = b'\x00' * 32 def hash(x: Union[bytes, bytearray, memoryview]) -> Bytes32: return Bytes32(sha256(x).digest())
228
21.9
60
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/ssz/ssz_impl.py
from typing import TypeVar from remerkleable.basic import uint from remerkleable.core import View from remerkleable.byte_arrays import Bytes32 def serialize(obj: View) -> bytes: return obj.encode_bytes() def hash_tree_root(obj: View) -> Bytes32: return Bytes32(obj.get_backing().merkle_root()) def uint_to...
563
20.692308
114
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/ssz/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/core/pyspec/eth2spec/utils/ssz/ssz_typing.py
# flake8: noqa # Ignore linter: This module makes importing SSZ types easy, and hides away the underlying library from the spec. from remerkleable.complex import Container, Vector, List from remerkleable.union import Union from remerkleable.basic import boolean, bit, uint, byte, uint8, uint16, uint32, uint64, uint128,...
587
44.230769
113
py
consensus-specs
consensus-specs-master/tests/generators/random/main.py
from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators if __name__ == "__main__": phase_0_mods = {key: 'eth2spec.test.phase0.random.test_' + key for key in [ 'random', ]} altair_mods = {key...
968
30.258065
85
py
consensus-specs
consensus-specs-master/tests/generators/random/generate.py
""" This test format currently uses code generation to assemble the tests as the current test infra does not have a facility to dynamically generate tests that can be seen by ``pytest``. This will likely change in future releases of the testing infra. NOTE: To add additional scenarios, add test cases below in ``_gene...
9,175
31.083916
94
py
consensus-specs
consensus-specs-master/tests/generators/ssz_static/main.py
from random import Random from typing import Iterable from inspect import getmembers, isclass from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing from eth2spec.debug import random_value, encode from eth2spec.test.helpers.constants import TESTGEN_FORKS, MINIMAL, MAINNET from eth2spec.test.context import s...
3,260
35.640449
116
py
consensus-specs
consensus-specs-master/tests/generators/ssz_static/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/generators/fork_choice/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators, combine_mods from eth2spec.test.helpers.constants import ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": # Note: Fork choice tests start from Altair - there are no fork choice test for phase 0 anymore altair_m...
1,384
39.735294
99
py
consensus-specs
consensus-specs-master/tests/generators/sanity/main.py
from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators, combine_mods if __name__ == "__main__": phase_0_mods = {key: 'eth2spec.test.phase0.sanity.test_' + key for key in [ 'blocks', ...
1,492
31.456522
94
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_bitvector.py
from ssz_test_case import invalid_test_case, valid_test_case from eth2spec.utils.ssz.ssz_typing import Bitvector from eth2spec.utils.ssz.ssz_impl import serialize from random import Random from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object def bitvector_case_fn(rng: Random, mode: Randomi...
2,159
49.232558
112
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/main.py
from typing import Iterable from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing import ssz_basic_vector import ssz_bitlist import ssz_bitvector import ssz_boolean import ssz_uints import ssz_container from eth2spec.test.helpers.constants import PHASE0 def create_provider(handler_name: str, suite_name: st...
1,886
39.148936
95
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_basic_vector.py
from ssz_test_case import invalid_test_case, valid_test_case from eth2spec.utils.ssz.ssz_typing import boolean, uint8, uint16, uint32, uint64, uint128, uint256, Vector, BasicView from eth2spec.utils.ssz.ssz_impl import serialize from random import Random from typing import Dict, Type from eth2spec.debug.random_value im...
3,158
46.863636
117
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_uints.py
from ssz_test_case import invalid_test_case, valid_test_case from eth2spec.utils.ssz.ssz_typing import BasicView, uint8, uint16, uint32, uint64, uint128, uint256 from random import Random from typing import Type from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object def uint_case_fn(rng: Ran...
2,045
46.581395
113
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/uint_test_cases.py
import random from eth_utils import ( to_tuple, ) import ssz from ssz.sedes import ( UInt, ) from renderers import ( render_test_case, ) random.seed(0) BIT_SIZES = [8, 16, 32, 64, 128, 256] RANDOM_TEST_CASES_PER_BIT_SIZE = 10 RANDOM_TEST_CASES_PER_LENGTH = 3 def get_random_bytes(length): return b...
2,643
25.707071
96
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_test_case.py
from eth2spec.utils.ssz.ssz_impl import serialize, hash_tree_root from eth2spec.debug.encode import encode from eth2spec.utils.ssz.ssz_typing import View from typing import Callable def valid_test_case(value_fn: Callable[[], View]): def case_fn(): value = value_fn() yield "value", "data", encode(v...
602
29.15
65
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_boolean.py
from ssz_test_case import valid_test_case, invalid_test_case from eth2spec.utils.ssz.ssz_typing import boolean def valid_cases(): yield "true", valid_test_case(lambda: boolean(True)) yield "false", valid_test_case(lambda: boolean(False)) def invalid_cases(): yield "byte_2", invalid_test_case(lambda: b'\...
506
32.8
63
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_bitlist.py
from ssz_test_case import invalid_test_case, valid_test_case from eth2spec.utils.ssz.ssz_typing import Bitlist from eth2spec.utils.ssz.ssz_impl import serialize from random import Random from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object def bitlist_case_fn(rng: Random, mode: Randomizati...
1,787
46.052632
86
py
consensus-specs
consensus-specs-master/tests/generators/ssz_generic/ssz_container.py
from ssz_test_case import invalid_test_case, valid_test_case from eth2spec.utils.ssz.ssz_typing import View, Container, byte, uint8, uint16, \ uint32, uint64, List, ByteList, Vector, Bitvector, Bitlist from eth2spec.utils.ssz.ssz_impl import serialize from random import Random from typing import Dict, Tuple, Sequen...
5,836
41.605839
111
py
consensus-specs
consensus-specs-master/tests/generators/sync/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.test.helpers.constants import BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": bellatrix_mods = {key: 'eth2spec.test.bellatrix.sync.test_' + key for key in [ 'optimistic', ]} capella_mods = bel...
610
28.095238
82
py
consensus-specs
consensus-specs-master/tests/generators/genesis/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators, combine_mods from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": phase_0_mods = {key: 'eth2spec.test.phase0.genesis.test_' + key for key in [ 'initialization...
1,190
37.419355
99
py
consensus-specs
consensus-specs-master/tests/generators/epoch_processing/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators, combine_mods from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": phase_0_mods = {key: 'eth2spec.test.phase0.epoch_processing.test_process_' + key for key in [ ...
2,012
34.946429
113
py
consensus-specs
consensus-specs-master/tests/generators/bls/main.py
""" BLS test vectors generator """ from hashlib import sha256 from typing import Tuple, Iterable, Any, Callable, Dict from eth_utils import ( encode_hex, int_to_big_endian, ) import milagro_bls_binding as milagro_bls from eth2spec.utils import bls from eth2spec.test.helpers.constants import PHASE0, ALTAIR fr...
21,609
38.797422
117
py
consensus-specs
consensus-specs-master/tests/generators/forks/main.py
from typing import Iterable from eth2spec.test.helpers.constants import ( PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, MINIMAL, MAINNET, ) from eth2spec.test.helpers.typing import SpecForkName, PresetBaseName from eth2spec.test.altair.fork import test_altair_fork_basic, test_altair_fork_random from eth2spec.test...
2,095
41.77551
94
py
consensus-specs
consensus-specs-master/tests/generators/transition/main.py
from typing import Iterable from eth2spec.test.helpers.constants import ( MINIMAL, MAINNET, ALL_PRE_POST_FORKS, ) from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing from eth2spec.gen_helpers.gen_from_tests.gen import ( generate_from_tests, ) from eth2spec.test.altair.transition import ( ...
1,802
30.631579
117
py
consensus-specs
consensus-specs-master/tests/generators/kzg_4844/main.py
""" KZG 4844 test vectors generator """ from hashlib import sha256 from typing import Tuple, Iterable, Any, Callable, Dict from eth_utils import ( encode_hex, int_to_big_endian, ) from eth2spec.utils import bls from eth2spec.test.helpers.constants import DENEB from eth2spec.test.helpers.typing import SpecFor...
21,655
38.446266
119
py
consensus-specs
consensus-specs-master/tests/generators/rewards/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": phase_0_mods = {key: 'eth2spec.test.phase0.rewards.test_' + key for key in [ 'basic', 'leak', ...
1,049
31.8125
97
py
consensus-specs
consensus-specs-master/tests/generators/finality/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": phase_0_mods = {'finality': 'eth2spec.test.phase0.finality.test_finality'} altair_mods = phase_0_mods # No ad...
964
40.956522
94
py
consensus-specs
consensus-specs-master/tests/generators/shuffling/main.py
from typing import Iterable import random from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing from eth2spec.test.helpers.typing import PresetBaseName from eth2spec.phase0 import mainnet as spec_mainnet, minimal as spec_minimal from eth2spec.test.helpers.constants import PHASE0, MINIMAL, MAINNET def gen...
2,140
30.028986
91
py
consensus-specs
consensus-specs-master/tests/generators/operations/main.py
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators, combine_mods from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110 if __name__ == "__main__": phase_0_mods = {key: 'eth2spec.test.phase0.block_processing.test_process_' + key for key in [ ...
2,548
34.901408
115
py
consensus-specs
consensus-specs-master/tests/generators/light_client/main.py
from eth2spec.test.helpers.constants import ALTAIR, BELLATRIX, CAPELLA, DENEB from eth2spec.gen_helpers.gen_from_tests.gen import combine_mods, run_state_test_generators if __name__ == "__main__": altair_mods = {key: 'eth2spec.test.altair.light_client.test_' + key for key in [ 'single_merkle_proof', ...
849
30.481481
91
py
consensus-specs
consensus-specs-master/tests/generators/light_client/__init__.py
0
0
0
py
consensus-specs
consensus-specs-master/solidity_deposit_contract/web3_tester/setup.py
from distutils.core import setup setup( name='deposit_contract_tester', packages=['deposit_contract'], package_dir={"": "."}, tests_requires=[], install_requires=[] # see requirements.txt file )
217
20.8
52
py
consensus-specs
consensus-specs-master/solidity_deposit_contract/web3_tester/tests/conftest.py
import pytest import eth_tester from eth_tester import ( EthereumTester, PyEVMBackend, ) from web3 import Web3 from web3.providers.eth_tester import EthereumTesterProvider import json import os DIR = os.path.dirname(__file__) def get_deposit_contract_json(): file_path = os.path.join(DIR, '../../deposit...
1,734
23.785714
94
py
consensus-specs
consensus-specs-master/solidity_deposit_contract/web3_tester/tests/test_deposit.py
from random import randint import pytest import eth_utils from eth2spec.phase0.spec import DepositData from eth2spec.utils.ssz.ssz_typing import List from eth2spec.utils.ssz.ssz_impl import hash_tree_root from tests.conftest import ( FULL_DEPOSIT_AMOUNT, MIN_DEPOSIT_AMOUNT, ) SAMPLE_PUBKEY = b'\x11' * 48 SA...
6,357
31.605128
99
py
consensus-specs
consensus-specs-master/solidity_deposit_contract/web3_tester/tests/__init__.py
0
0
0
py
drone-net
drone-net-master/split.py
import glob import os import Tkinter import Tkconstants import tkFileDialog while True: print("Please select your image directory.") current_dir = tkFileDialog.askdirectory() if current_dir == None or current_dir == "": print("You must select a directory.") continue break # Percentage of...
948
31.724138
70
py
drone-net
drone-net-master/normalize_labels.py
from __future__ import division from PIL import Image import os img_dir = 'images' lab_dir = 'labels' out_dir = 'normalized-labels' def normalize_label(label, width, height): cl, cx, cy, wx, wy = label return int(cl), cx/width, cy/height, wx/width, wy/height if not os.path.exists(out_dir): os.makedirs...
1,393
28.041667
81
py
wav2letter
wav2letter-main/recipes/seq2seq_tds/librispeech/prepare.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the MIT-style license found in the LICENSE file in the root directory of this source tree. ---------- Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines Command : python3 p...
4,355
34.704918
87
py
wav2letter
wav2letter-main/recipes/conv_glu/wsj/prepare.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the MIT-style license found in the LICENSE file in the root directory of this source tree. ---------- Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines Please install `sph2...
6,352
35.096591
90
py
wav2letter
wav2letter-main/recipes/conv_glu/librispeech/prepare.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the MIT-style license found in the LICENSE file in the root directory of this source tree. ---------- Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines Please install `kenl...
3,286
32.20202
87
py
wav2letter
wav2letter-main/recipes/learnable_frontend/prepare.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the MIT-style license found in the LICENSE file in the root directory of this source tree. ---------- Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines Please install `sph2...
2,576
30.814815
90
py
wav2letter
wav2letter-main/recipes/local_prior_match/librispeech/prepare_unpaired.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the MIT-style license found in the LICENSE file in the root directory of this source tree. ---------- Script to prepare unpaired data for training a model with local prior matching Command : python3 prepare_...
2,841
32.435294
84
py
wav2letter
wav2letter-main/recipes/local_prior_match/librispeech/prepare.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the MIT-style license found in the LICENSE file in the root directory of this source tree. ---------- Script to prepare token set and lexicon to train/eval model on Librispeech in wav2letter++ pipelines Comm...
5,194
36.107143
100
py