From 6f4ff15b089e9e085de9e1323e67258d5e4643d9 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Mon, 20 Jan 2020 10:48:20 +0000 Subject: [PATCH] added some small stuff here and there --- binarycpython/utils/functions.py | 1 - binarycpython/utils/grid.py | 19 +++++++++++++++---- tests/function_tests.py | 4 +++- tests/population/grid_tests.py | 6 ++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index cb3f41249..f5ebd8729 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -178,7 +178,6 @@ def create_arg_string(arg_dict): arg_string = arg_string.strip() return arg_string - def get_defaults(filter_values=False): """ Function that calls the binaryc get args function and cast it into a dictionary diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index eb8a6dc1d..ba5f677c7 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -205,16 +205,26 @@ class Population(object): return options - def return_binary_c_version_info(self): + def return_binary_c_version_info(self, parsed=False): """ Function that returns the version information of binary_c TODO: Put in a nice dict. """ - version_info = binary_c_python_api.return_version_info() + version_info = binary_c_python_api.return_version_info().strip() - return version_info.strip() + if parsed: + version_info = parse_binary_c_version_info(version_info) + + return version_info + + def parse_binary_c_version_info(self): + """ + Function that parses the output of the version info that binary_c gives. This again is alot of string manipulation. Sensitive to breaking somewhere along the line. + """ + # TODO: write parsing function + pass def return_binary_c_defaults(self): """ @@ -342,6 +352,7 @@ class Population(object): self.grid_options["store_memaddr"] = binary_c_python_api.return_store("") # Execute. + # TODO: CHange this part alot. This is not finished whatsoever out = binary_c_python_api.run_population( self.return_argline(), self.grid_options["custom_logging_func_memaddr"], @@ -409,4 +420,4 @@ class Population(object): print(output) -################################################################################################ +################################################################################################ \ No newline at end of file diff --git a/tests/function_tests.py b/tests/function_tests.py index 1e0c77c2f..9e42273a9 100644 --- a/tests/function_tests.py +++ b/tests/function_tests.py @@ -1,6 +1,7 @@ from binarycpython.utils.functions import ( get_help_super, - get_help_all + get_help_all, + get_help ) ############################# @@ -12,4 +13,5 @@ from binarycpython.utils.functions import ( ## Help functionality print(get_help_super(print_help=True, return_dict=False, fail_silently=False)) print(get_help_all(print_help=True)) +print(get_help('M_1')) # \ No newline at end of file diff --git a/tests/population/grid_tests.py b/tests/population/grid_tests.py index f25678360..66dd4b290 100644 --- a/tests/population/grid_tests.py +++ b/tests/population/grid_tests.py @@ -39,8 +39,10 @@ test_pop.set( # test_pop.return_argline() ## return version info -# version_info = test_pop.return_binary_c_version_info() -# print(version_info) +version_info = test_pop.return_binary_c_version_info() +print(version_info) + +quit() ## Use custom arg file # test_pop.evolve_population(custom_arg_file='/home/david/projects/binary_c_root/binary_c-python/tests/population/custom_arg_file.txt') -- GitLab