@@ -46,10 +46,9 @@ def bool_from_string(string):
4646 """Attempt conversion of string to a boolean """
4747 if string in {'true' , 'True' , 'TRUE' }:
4848 return True
49- elif string in {'false' , 'False' , 'FALSE' }:
49+ if string in {'false' , 'False' , 'FALSE' }:
5050 return False
51- else :
52- raise ValueError
51+ raise ValueError
5352
5453
5554def typeCheck (string ):
@@ -66,9 +65,7 @@ def typeCheck(string):
6665 return t (string )
6766 except ValueError :
6867 continue
69- else :
70- print ("String contains un-handled datatype" )
71- return string
68+ raise ValueError (f"String contains un-handled datatype: { repr (string )} !" )
7269
7370
7471def make_values (strings , name ):
@@ -186,12 +183,12 @@ def delete_elements(strings):
186183 char = strings [pos ]
187184 if char == "" :
188185 break
189- elif char == "," :
186+ if char == "," :
190187 break
191- elif char == " " :
188+ if char == " " :
192189 pos = pos + 1
193190 break
194- elif char == "{" :
191+ if char == "{" :
195192 break
196193 pos = pos - 1
197194 delStr = strings [pos : strings .rfind (")" )]
@@ -682,15 +679,14 @@ def skip_all_inner_sets(position):
682679 position += 1
683680 else :
684681 next_set [0 ] = ""
685- return ( len (string ) - 1 )
682+ return len (string ) - 1
686683
687684 max_of_sets = max (last_set , last_subset )
688685 max_of_main_set = max (max_of_sets , last_subset )
689686
690687 if max_of_main_set != 0 :
691688 return max_of_main_set
692- else :
693- return (len (string ) - 1 )
689+ return len (string ) - 1
694690
695691 # Main entry of get_the_string()
696692 index = 0
@@ -833,15 +829,15 @@ def check_for_values(string):
833829 if "record SimulationResult" in string :
834830 formatSimRes (string )
835831 return result
836- elif "record " in string :
832+ if "record " in string :
837833 formatRecords (string )
838834 return result
839835
840836 string = typeCheck (string )
841837
842838 if not isinstance (string , str ):
843839 return string
844- elif string .find ("{" ) == - 1 :
840+ if string .find ("{" ) == - 1 :
845841 return string
846842
847843 current_set , next_set = get_the_set (string )
0 commit comments