utils.py
def func_aggregation(func_str):
    '''
    This function is used for line execution with exec()

    args:
        function strings after inspect
    returns:
        list of functionable strings for exec()
    '''

    res = [] # executables for return
    stack_for_parent = [] # stack storing brackets for line integration
    logs_of_parent = [] # logs of lines for concat
#     convert function codes to list of strings
    func_list = [item.strip() for item in func_str.split('\n')]
    i = 0
    while True:
        if func_list[i].startswith('def'):
            func_list = func_list[i:]
            break
        i = i + 1
#     function args
    func_args = [item.strip() for item in func_list[0].split('(')[1].rstrip('):').split(',')]
    for item in func_list[1:]:
        if not item:
            continue
        logs_of_parent.append(item)
        for char in item:
            if char == '(':
                stack_for_parent.append('(')
            if char == '[':
                stack_for_parent.append('[')
            if char == ')' and stack_for_parent[-1] == '(':
                stack_for_parent.pop(-1)
            if char == ']' and stack_for_parent[-1] == '[':
                stack_for_parent.pop(-1)
        if not stack_for_parent:
            res.append(''.join(logs_of_parent))
            logs_of_parent.clear()
    return func_args, res[:-1], [item.strip() for item in res[-1].replace('return ', '').split(',')]

    This function is used for line execution with exec()

    args:
        function strings after inspect
    returns:
        list of functionable strings for exec()
    
This function is used for line execution with exec()
args:
function strings after inspect
returns:
list of functionable strings for exec()
This function is used for line execution with exec () args : function strings after inspect returns : list of functionable strings for exec ()
def func_aggregation(func_str):
    res = [] 
    stack_for_parent = [] 
    logs_of_parent = [] 
    func_list = [item.strip() for item in func_str.split('\n')]
    i = 0
    while True:
        if func_list[i].startswith('def'):
            func_list = func_list[i:]
            break
        i = i + 1
    func_args = [item.strip() for item in func_list[0].split('(')[1].rstrip('):').split(',')]
    for item in func_list[1:]:
        if not item:
            continue
        logs_of_parent.append(item)
        for char in item:
            if char == '(':
                stack_for_parent.append('(')
            if char == '[':
                stack_for_parent.append('[')
            if char == ')' and stack_for_parent[-1] == '(':
                stack_for_parent.pop(-1)
            if char == ']' and stack_for_parent[-1] == '[':
                stack_for_parent.pop(-1)
        if not stack_for_parent:
            res.append(''.join(logs_of_parent))
            logs_of_parent.clear()
    return func_args, res[:-1], [item.strip() for item in res[-1].replace('return ', '').split(',')]
def func_aggregation ( func_str ) : res = [ ] stack_for_parent = [ ] logs_of_parent = [ ] func_list = [ item . strip ( ) for item in func_str . split ( '\n' ) ] i = 0 while True : if func_list [ i ] . startswith ( 'def' ) : func_list = func_list [ i : ] break i = i + 1 func_args = [ item . strip ( ) for item in func_list [ 0 ] . split ( '(' ) [ 1 ] . rstrip ( '):' ) . split ( ',' ) ] for item in func_list [ 1 : ] : if not item : continue logs_of_parent . append ( item ) for char in item : if char == '(' : stack_for_parent . append ( '(' ) if char == '[' : stack_for_parent . append ( '[' ) if char == ')' and stack_for_parent [ - 1 ] == '(' : stack_for_parent . pop ( - 1 ) if char == ']' and stack_for_parent [ - 1 ] == '[' : stack_for_parent . pop ( - 1 ) if not stack_for_parent : res . append ( '' . join ( logs_of_parent ) ) logs_of_parent . clear ( ) return func_args , res [ : - 1 ] , [ item . strip ( ) for item in res [ - 1 ] . replace ( 'return ' , '' ) . split ( ',' ) ]
This function is used for line execution with exec()
args:
function strings after inspect
returns:
list of functionable strings for exec()
This function is used for line execution with exec () args : function strings after inspect returns : list of functionable strings for exec ()
'''
    This function is used for line execution with exec()

    args:
        function strings after inspect
    returns:
        list of functionable strings for exec()
    ''' # executables for return # stack storing brackets for line integration # logs of lines for concat #     convert function codes to list of strings #     function args
func_str