From 4e646b2f616774610d86bdde3cf9cefaaa4fac12 Mon Sep 17 00:00:00 2001
From: dh00601 <dh00601@surrey.ac.uk>
Date: Sat, 4 Jun 2022 13:39:47 +0100
Subject: [PATCH] cleaning source file handling

---
 binarycpython/utils/grid.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index 5228374a3..1ee1f2b2e 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -2990,6 +2990,7 @@ class Population:
     #
     # Functions below are used to run populations with
     # Monte Carlo
+    # TODO: this should be placed in its own Mix-in class
     ###################################################
 
     ###################################################
@@ -2997,6 +2998,7 @@ class Population:
     #
     # Functions below are used to run populations from
     # a file containing binary_c calls
+    # TODO: this should be placed in its own Mix-in class
     ###################################################
     def _dry_run_source_file(self):
         """
@@ -3072,10 +3074,13 @@ class Population:
         arg_dict = {}
 
         for i in range(0, len(split_line), 2):
-            if "." in split_line[i + 1]:
-                arg_dict[split_line[i]] = float(split_line[i + 1])
-            else:
+            try:
                 arg_dict[split_line[i]] = int(split_line[i + 1])
+            except ValueError:
+                try: 
+                    arg_dict[split_line[i]] = float(split_line[i + 1])
+                except ValueError:
+                    arg_dict[split_line[i]] = str(split_line[i + 1])
 
         return arg_dict
 
-- 
GitLab