# hub.solver.openevolve.code_utils
Utility functions for evolved code.
Domain specification
Domain
# extract_code_outside_evolveblocks
extract_code_outside_evolveblocks(
code:
) ->
Extract code outside evolve blocks.
# check_diff_outside_evolveblocks
check_diff_outside_evolveblocks(
code1: ,
code2: ,
show_diff: = True,
path1: ,
path2:
)
Check diff outside evolve blocks
# Parameters
- code1:
- code2:
- show_diff: print the diff if any
- path1: path corresponding to code1 (for diff printing)
- path2: path corresponding to code2 (for diff printing)
# Returns
True if no differences
# check_diff_outside_evolveblocks_from_paths
check_diff_outside_evolveblocks_from_paths(
path1,
path2,
show_diff = True
)
Check diff outside evolve blocks
# Parameters
- path1:
- path2:
- show_diff: print the diff if any
# Returns
True if no differences
# get_sorted_imported_modules
get_sorted_imported_modules(
modules_to_parse: typing.Union[collections.abc.Iterable[module], module],
recursive: = True,
module_filter_pattern: = ^skdecide\.
) -> list[module]
Get recursively the immported modules respecting a pattern.
# Parameters
- modules_to_parse: list of modules to inspect
- recursive: whether applying the function to imported modules
- module_filter_pattern: pattern that the imported modules need to respect to be included
# Returns
List of modules to import from the given modules respecting the given pattern, sorted by import depth.