def core_instructions(type_library: PushTypeLibrary) -> Sequence[Instruction]: """All instructions definied by pyshgp for the given type library.""" supported_stacks = type_library.supported_stacks() instrucion_modules = [numeric, text, logical, code] basic_instr = list(chain(*[m.instructions() for m in instrucion_modules])) gen_instrs = generic_instructions(type_library) supported_instructions = _supported(basic_instr + gen_instrs, supported_stacks) return supported_instructions
def core_instructions(type_library: PushTypeLibrary) -> Sequence[Instruction]: """All instructions definied by pyshgp for the given type library.""" supported_stacks = type_library.supported_stacks() instrucion_modules = [numeric, text, logical, code] basic_instr = list(chain(*[m.instructions() for m in instrucion_modules])) gen_instrs = generic_instructions(type_library) supported_instructions = _supported(basic_instr + gen_instrs, supported_stacks) return supported_instructions
def test_supported_stacks(self): lib = PushTypeLibrary() assert lib.supported_stacks() == ALL_CORE_TYPE_NAMES
def test_supported_stacks(self): lib = PushTypeLibrary() assert lib.supported_stacks() == { "bool", "int", "float", "char", "str", "code", "exec" }
def test_supported_stacks(self): lib = PushTypeLibrary() assert lib.supported_stacks() == {"bool", "int", "float", "char", "str", "code", "exec"}