(str_args)
return result_list
Take in a string of positional arguments and types and convert them to a list of values of the correct type.
    The string should be in the form: 'value1|type1,value2|type2'.
    e.g. '8|int, 0.5|float' would return [8, 0.5]
Take in a string of positional arguments and types and convert them to a list of values of the correct type.
    The string should be in the form: 'value1|type1,value2|type2'.
    e.g. '8|int, 0.5|float' would return [8, 0.5]
Take in a string of positional arguments and types and convert them to a list of values of the correct type . The string should be in the form : value1|type1 value2|type2 . e . g . 8|int 0 . 5|float would return [ 8 0 . 5 ]
def get_args_by_type(str_args):
    """
    Take in a string of positional arguments and types and convert them to a list of values of the correct type.
    The string should be in the form: 'value1|type1,value2|type2'.
    e.g. '8|int, 0.5|float' would return [8, 0.5]
    """
    
    # Dictionary used to convert argument values to the correct type
    types = {"boolean":ast.literal_eval, "bool":ast.literal_eval, "integer":atoi, "int":atoi,\
             "float":atof, "string":str, "str":str}
    
    result_list = []
    
    # If the argument string is empty return an empty list
    if len(str_args) == 0:
        return list()
    
    for arg in str_args.split(","):
        # Split the value and type
        split = arg.strip().split("|")
        
        try:
            if len(split) == 2:      
                # Handle conversion from string to boolean
                if split[1] in ("boolean", "bool"):
                    split[0] = split[0].capitalize()
                
                # Convert the value based on the correct type
                result_list.append(types[split[1]](split[0]))

            elif split[1] == "dict":
                # If the argument is a dictionary convert keys and values according to the correct types
                items = split[0].split(";")
                d = {}
                
                for i in items:
                    a,b = i.split(":")
                    
                    # Handle conversion from string to boolean
                    if split[2] in ("boolean", "bool"):
                        a = a.capitalize()
                    if split[3] in ("boolean", "bool"):
                        b = b.capitalize()
                    
                    # Handle None as an item in the dictionary
                    if b == "None":
                        d[types[split[2]](a)] = None
                    else:
                        d[types[split[2]](a)] = types[split[3]](b)
                
                result_list.append(d)
            
            elif split[1] in ("list", "array", "tuple"):
                # If the argument is a list, array or tuple convert keys and values according to the correct types
                items = split[0].split(";")
                l = []
                
                for i in items:
                    # Handle conversion from string to boolean
                    if split[2] in ("boolean", "bool"):
                        i = i.capitalize()

                    # Handle None as an item in the dictionary
                    if i == "None":
                        l.append(None)
                    else:
                        l.append(types[split[2]](i))
                
                if split[1] == "array":
                    l = np.array(l)
                elif split[1] == "tuple":
                    l = tuple(l)
                    
                result_list.append(l)
            else:
                err = "Incorrect syntax for argument: '{}'. Expected 'value1|type1, value2|type2, ...'".format(str_args)
                raise Exception(err)    
        
        except IndexError:
            err = "List index out of range. This is most likely due to incorrect syntax of arguments."
            raise Exception(err)
        
    return result_list
def get_args_by_type ( str_args ) : # Dictionary used to convert argument values to the correct type types = { "boolean" : ast . literal_eval , "bool" : ast . literal_eval , "integer" : atoi , "int" : atoi , "float" : atof , "string" : str , "str" : str } result_list = [ ] # If the argument string is empty return an empty list if len ( str_args ) == 0 : return list ( ) for arg in str_args . split ( "," ) : # Split the value and type split = arg . strip ( ) . split ( "|" ) try : if len ( split ) == 2 : # Handle conversion from string to boolean if split [ 1 ] in ( "boolean" , "bool" ) : split [ 0 ] = split [ 0 ] . capitalize ( ) # Convert the value based on the correct type result_list . append ( types [ split [ 1 ] ] ( split [ 0 ] ) ) elif split [ 1 ] == "dict" : # If the argument is a dictionary convert keys and values according to the correct types items = split [ 0 ] . split ( ";" ) d = { } for i in items : a , b = i . split ( ":" ) # Handle conversion from string to boolean if split [ 2 ] in ( "boolean" , "bool" ) : a = a . capitalize ( ) if split [ 3 ] in ( "boolean" , "bool" ) : b = b . capitalize ( ) # Handle None as an item in the dictionary if b == "None" : d [ types [ split [ 2 ] ] ( a ) ] = None else : d [ types [ split [ 2 ] ] ( a ) ] = types [ split [ 3 ] ] ( b ) result_list . append ( d ) elif split [ 1 ] in ( "list" , "array" , "tuple" ) : # If the argument is a list, array or tuple convert keys and values according to the correct types items = split [ 0 ] . split ( ";" ) l = [ ] for i in items : # Handle conversion from string to boolean if split [ 2 ] in ( "boolean" , "bool" ) : i = i . capitalize ( ) # Handle None as an item in the dictionary if i == "None" : l . append ( None ) else : l . append ( types [ split [ 2 ] ] ( i ) ) if split [ 1 ] == "array" : l = np . array ( l ) elif split [ 1 ] == "tuple" : l = tuple ( l ) result_list . append ( l ) else : err = "Incorrect syntax for argument: '{}'. Expected 'value1|type1, value2|type2, ...'" . format ( str_args ) raise Exception ( err ) except IndexError : err = "List index out of range. This is most likely due to incorrect syntax of arguments." raise Exception ( err ) return result_list