PyDamp/PyDampCheck.py
def check_flow_data(product_dict):
    
    
    """ This function checks for errors in the flow input
    
    Parameters - YAML for product information .dict
    ----------

    Returns - checked product_dict
    -------
    
    """   
    
    #flow_data assertion
    Flow_Data = product_dict['Flow_Data']
    assert Flow_Data is not None, 'Input file requires Flow data input(s)'  
    
    #flow_data vertical dimension assertion
    BOM = product_dict.get('BOM')
    assert len(Flow_Data) == len(BOM), 'There is not alteast one flow datum for each component.'
    

    # flow_data for each component assertions
    for i in range(len(Flow_Data)):
        
        #component flow data verticle dimentsion assertion
        Component_Function_data = product_dict.get('Function_Data')[i]
        assert len(Flow_Data[i]) == len(Component_Function_data), 'component ' + str(i+1) + ' flow data input in not in range of the function inputs or is not formatted correctly'
        
        
        for k in range(len(Flow_Data[i])):
        
            Flow_of_component = Flow_Data[i][k]
            
            try:
                multi_flow = len(Flow_of_component[0])
                
                for j in range(len(Flow_of_component)):
                    
                    multi_flow = Flow_of_component[j]
                    if type(multi_flow[0]) == bool or type(Flow_of_component[j][0]) == str:
                        assert multi_flow == False, 'component ' + str(i+1) + ' has error in false naming if flow is unknown or must be an integer'
                        
                    else:
                        assert type(multi_flow[0]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                        assert 0 <= multi_flow[0] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'
                        
                        if type(multi_flow[1]) == str:
                            assert multi_flow[1] == 'internal' or multi_flow[1] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                        else:
                            assert type(multi_flow[1]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                            assert 1 <= multi_flow[1] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
                        
                        
                        if type(multi_flow[2]) == str:
                            assert multi_flow[2] == 'internal' or multi_flow[2] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                        else:
                            assert type(multi_flow[2]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                            assert 1 <= multi_flow[2] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
        
                        assert type(multi_flow[3]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                        assert 0 <= multi_flow[3] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'                                    
                    
                
                
                
            except TypeError: # this is if there is not a multi flow
                if type(Flow_of_component) == bool or type(Flow_of_component) == str:
                    assert Flow_of_component == False, 'component ' + str(i+1) + ' function ' +str(k+1) + ' has error in false naming if function is unknown or must be an integer'
                    
                elif type(Flow_of_component[0]) == bool or type(Flow_of_component[0]) == str:
                    assert Flow_of_component == False, 'component ' + str(i+1) + ' function ' +str(k+1) + ' has error in false naming if function is unknown or must be an integer'
                    
                else:
                    assert type(Flow_of_component[0]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                    assert 0 <= Flow_of_component[0] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'
                    
                    if type(Flow_of_component[1]) == str:
                        assert Flow_of_component[1] == 'internal' or Flow_of_component[1] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                    else:
                        assert type(Flow_of_component[1]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                        assert 1 <= Flow_of_component[1] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
                    
                    
                    if type(Flow_of_component[2]) == str:
                        assert Flow_of_component[2] == 'internal' or Flow_of_component[2] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                    else:
                        assert type(Flow_of_component[2]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                        assert 1 <= Flow_of_component[2] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
    
                    assert type(Flow_of_component[3]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                    assert 0 <= Flow_of_component[3] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'
 This function checks for errors in the flow input
    
    Parameters - YAML for product information .dict
    ----------

    Returns - checked product_dict
    -------
    
    
This function checks for errors in the flow input
Parameters - YAML for product information .dict


This function checks for errors in the flow input Parameters - YAML for product information . dict
def check_flow_data(product_dict):
    Flow_Data = product_dict['Flow_Data']
    assert Flow_Data is not None, 'Input file requires Flow data input(s)'  
    BOM = product_dict.get('BOM')
    assert len(Flow_Data) == len(BOM), 'There is not alteast one flow datum for each component.'
    for i in range(len(Flow_Data)):
        Component_Function_data = product_dict.get('Function_Data')[i]
        assert len(Flow_Data[i]) == len(Component_Function_data), 'component ' + str(i+1) + ' flow data input in not in range of the function inputs or is not formatted correctly'
        for k in range(len(Flow_Data[i])):
            Flow_of_component = Flow_Data[i][k]
            try:
                multi_flow = len(Flow_of_component[0])
                for j in range(len(Flow_of_component)):
                    multi_flow = Flow_of_component[j]
                    if type(multi_flow[0]) == bool or type(Flow_of_component[j][0]) == str:
                        assert multi_flow == False, 'component ' + str(i+1) + ' has error in false naming if flow is unknown or must be an integer'
                    else:
                        assert type(multi_flow[0]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                        assert 0 <= multi_flow[0] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'
                        if type(multi_flow[1]) == str:
                            assert multi_flow[1] == 'internal' or multi_flow[1] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                        else:
                            assert type(multi_flow[1]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                            assert 1 <= multi_flow[1] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
                        if type(multi_flow[2]) == str:
                            assert multi_flow[2] == 'internal' or multi_flow[2] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                        else:
                            assert type(multi_flow[2]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                            assert 1 <= multi_flow[2] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
                        assert type(multi_flow[3]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                        assert 0 <= multi_flow[3] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'                                    
            except TypeError: 
                if type(Flow_of_component) == bool or type(Flow_of_component) == str:
                    assert Flow_of_component == False, 'component ' + str(i+1) + ' function ' +str(k+1) + ' has error in false naming if function is unknown or must be an integer'
                elif type(Flow_of_component[0]) == bool or type(Flow_of_component[0]) == str:
                    assert Flow_of_component == False, 'component ' + str(i+1) + ' function ' +str(k+1) + ' has error in false naming if function is unknown or must be an integer'
                else:
                    assert type(Flow_of_component[0]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                    assert 0 <= Flow_of_component[0] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'
                    if type(Flow_of_component[1]) == str:
                        assert Flow_of_component[1] == 'internal' or Flow_of_component[1] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                    else:
                        assert type(Flow_of_component[1]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                        assert 1 <= Flow_of_component[1] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
                    if type(Flow_of_component[2]) == str:
                        assert Flow_of_component[2] == 'internal' or Flow_of_component[2] == 'external', 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input error for assigning internal or external'
                    else:
                        assert type(Flow_of_component[2]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer, internal, or external.'
                        assert 1 <= Flow_of_component[2] <= len(BOM), 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the BOM inputs'
                    assert type(Flow_of_component[3]) == int, 'Flow data for component '+ str(i+1) + ' function ' + str(k+1) + ' needs to be an integer.'
                    assert 0 <= Flow_of_component[3] <= 45, 'component ' + str(i+1) + ' function ' + str(k+1) +  ' input in not in range of the flow index'
def check_flow_data ( product_dict ) : Flow_Data = product_dict [ 'Flow_Data' ] assert Flow_Data is not None , 'Input file requires Flow data input(s)' BOM = product_dict . get ( 'BOM' ) assert len ( Flow_Data ) == len ( BOM ) , 'There is not alteast one flow datum for each component.' for i in range ( len ( Flow_Data ) ) : Component_Function_data = product_dict . get ( 'Function_Data' ) [ i ] assert len ( Flow_Data [ i ] ) == len ( Component_Function_data ) , 'component ' + str ( i + 1 ) + ' flow data input in not in range of the function inputs or is not formatted correctly' for k in range ( len ( Flow_Data [ i ] ) ) : Flow_of_component = Flow_Data [ i ] [ k ] try : multi_flow = len ( Flow_of_component [ 0 ] ) for j in range ( len ( Flow_of_component ) ) : multi_flow = Flow_of_component [ j ] if type ( multi_flow [ 0 ] ) == bool or type ( Flow_of_component [ j ] [ 0 ] ) == str : assert multi_flow == False , 'component ' + str ( i + 1 ) + ' has error in false naming if flow is unknown or must be an integer' else : assert type ( multi_flow [ 0 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer.' assert 0 <= multi_flow [ 0 ] <= 45 , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the flow index' if type ( multi_flow [ 1 ] ) == str : assert multi_flow [ 1 ] == 'internal' or multi_flow [ 1 ] == 'external' , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input error for assigning internal or external' else : assert type ( multi_flow [ 1 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer, internal, or external.' assert 1 <= multi_flow [ 1 ] <= len ( BOM ) , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the BOM inputs' if type ( multi_flow [ 2 ] ) == str : assert multi_flow [ 2 ] == 'internal' or multi_flow [ 2 ] == 'external' , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input error for assigning internal or external' else : assert type ( multi_flow [ 2 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer, internal, or external.' assert 1 <= multi_flow [ 2 ] <= len ( BOM ) , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the BOM inputs' assert type ( multi_flow [ 3 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer.' assert 0 <= multi_flow [ 3 ] <= 45 , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the flow index' except TypeError : if type ( Flow_of_component ) == bool or type ( Flow_of_component ) == str : assert Flow_of_component == False , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' has error in false naming if function is unknown or must be an integer' elif type ( Flow_of_component [ 0 ] ) == bool or type ( Flow_of_component [ 0 ] ) == str : assert Flow_of_component == False , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' has error in false naming if function is unknown or must be an integer' else : assert type ( Flow_of_component [ 0 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer.' assert 0 <= Flow_of_component [ 0 ] <= 45 , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the flow index' if type ( Flow_of_component [ 1 ] ) == str : assert Flow_of_component [ 1 ] == 'internal' or Flow_of_component [ 1 ] == 'external' , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input error for assigning internal or external' else : assert type ( Flow_of_component [ 1 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer, internal, or external.' assert 1 <= Flow_of_component [ 1 ] <= len ( BOM ) , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the BOM inputs' if type ( Flow_of_component [ 2 ] ) == str : assert Flow_of_component [ 2 ] == 'internal' or Flow_of_component [ 2 ] == 'external' , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input error for assigning internal or external' else : assert type ( Flow_of_component [ 2 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer, internal, or external.' assert 1 <= Flow_of_component [ 2 ] <= len ( BOM ) , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the BOM inputs' assert type ( Flow_of_component [ 3 ] ) == int , 'Flow data for component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' needs to be an integer.' assert 0 <= Flow_of_component [ 3 ] <= 45 , 'component ' + str ( i + 1 ) + ' function ' + str ( k + 1 ) + ' input in not in range of the flow index'
This function checks for errors in the flow input
Parameters - YAML for product information .dict
This function checks for errors in the flow input Parameters - YAML for product information . dict
""" This function checks for errors in the flow input
    
    Parameters - YAML for product information .dict
    ----------

    Returns - checked product_dict
    -------
    
    """ #flow_data assertion #flow_data vertical dimension assertion # flow_data for each component assertions #component flow data verticle dimentsion assertion # this is if there is not a multi flow
product_dict