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

    Returns - checked product_dict
    -------
    
    """   
    
    #BOM assertions
    
    BOM = product_dict.get('BOM')
    assert BOM is not None, 'Input file requires BOM input'  
    
    
    BOM = product_dict.get('BOM')
    assert BOM[0] is not None, 'Input file requires BOM input'
    
    for i in range(len(BOM)):
        
        component = BOM[i]
        
        #BOM entry length assertion
        assert len(component) == 4, 'component ' + str(i+1) + ' entry is improperly formated.'
        
        
        #Component name assertions
        component_name= component[0]
        assert component_name, 'component ' + str(i+1) + ' needs a name.'
        
        assert type(component_name) == str, 'component ' + str(i+1) + ' name requires charater input.'
    
        try:
            component_name = int(component_name)
            assert type(component_name) == str, 'component ' + str(i+1) + ' name requires character input.'
            
        except ValueError:
            pass
        
        
        #Component description assertions    
        component_description = component[1]
        assert component_description, 'component ' + str(i+1) + ' needs a discription.'
        
        assert type(component_description) == str, 'component ' + str(i+1) + ' description requires character input.'
    
        try:
            component_description = int(component_description)
            assert type(component_description) == str, 'component ' + str(i+1) + ' description requires character input.'
            
        except ValueError:
            pass

        #Component basis assertions    
        component_basis = component[2]
        assert component_basis, 'component ' + str(i+1) + ' component basis requires component basis input'      
        assert type(component_basis) == int, 'component ' + str(i+1) + ' component basis requires integer input'  
        assert 1 <= component_basis <= 179, 'component ' + str(i+1) + ' component basis input not within range of index'  
        
        #Component material assertions    
        component_material = component[3]
        assert component_material, 'component ' + str(i+1) + ' material requires material input'      
        assert type(component_material) == int, 'component ' + str(i+1) + ' material requires integer input'  
        assert 1 <= component_material <= 18, 'component ' + str(i+1) + ' material input not within range of index'
 This function checks for errors in the BOM input
    
    Parameters - YAML for product information .dict
    ----------

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


This function checks for errors in the BOM input Parameters - YAML for product information . dict
def check_BOM(product_dict):
    BOM = product_dict.get('BOM')
    assert BOM is not None, 'Input file requires BOM input'  
    BOM = product_dict.get('BOM')
    assert BOM[0] is not None, 'Input file requires BOM input'
    for i in range(len(BOM)):
        component = BOM[i]
        assert len(component) == 4, 'component ' + str(i+1) + ' entry is improperly formated.'
        component_name= component[0]
        assert component_name, 'component ' + str(i+1) + ' needs a name.'
        assert type(component_name) == str, 'component ' + str(i+1) + ' name requires charater input.'
        try:
            component_name = int(component_name)
            assert type(component_name) == str, 'component ' + str(i+1) + ' name requires character input.'
        except ValueError:
            pass
        component_description = component[1]
        assert component_description, 'component ' + str(i+1) + ' needs a discription.'
        assert type(component_description) == str, 'component ' + str(i+1) + ' description requires character input.'
        try:
            component_description = int(component_description)
            assert type(component_description) == str, 'component ' + str(i+1) + ' description requires character input.'
        except ValueError:
            pass
        component_basis = component[2]
        assert component_basis, 'component ' + str(i+1) + ' component basis requires component basis input'      
        assert type(component_basis) == int, 'component ' + str(i+1) + ' component basis requires integer input'  
        assert 1 <= component_basis <= 179, 'component ' + str(i+1) + ' component basis input not within range of index'  
        component_material = component[3]
        assert component_material, 'component ' + str(i+1) + ' material requires material input'      
        assert type(component_material) == int, 'component ' + str(i+1) + ' material requires integer input'  
        assert 1 <= component_material <= 18, 'component ' + str(i+1) + ' material input not within range of index'
def check_BOM ( product_dict ) : BOM = product_dict . get ( 'BOM' ) assert BOM is not None , 'Input file requires BOM input' BOM = product_dict . get ( 'BOM' ) assert BOM [ 0 ] is not None , 'Input file requires BOM input' for i in range ( len ( BOM ) ) : component = BOM [ i ] assert len ( component ) == 4 , 'component ' + str ( i + 1 ) + ' entry is improperly formated.' component_name = component [ 0 ] assert component_name , 'component ' + str ( i + 1 ) + ' needs a name.' assert type ( component_name ) == str , 'component ' + str ( i + 1 ) + ' name requires charater input.' try : component_name = int ( component_name ) assert type ( component_name ) == str , 'component ' + str ( i + 1 ) + ' name requires character input.' except ValueError : pass component_description = component [ 1 ] assert component_description , 'component ' + str ( i + 1 ) + ' needs a discription.' assert type ( component_description ) == str , 'component ' + str ( i + 1 ) + ' description requires character input.' try : component_description = int ( component_description ) assert type ( component_description ) == str , 'component ' + str ( i + 1 ) + ' description requires character input.' except ValueError : pass component_basis = component [ 2 ] assert component_basis , 'component ' + str ( i + 1 ) + ' component basis requires component basis input' assert type ( component_basis ) == int , 'component ' + str ( i + 1 ) + ' component basis requires integer input' assert 1 <= component_basis <= 179 , 'component ' + str ( i + 1 ) + ' component basis input not within range of index' component_material = component [ 3 ] assert component_material , 'component ' + str ( i + 1 ) + ' material requires material input' assert type ( component_material ) == int , 'component ' + str ( i + 1 ) + ' material requires integer input' assert 1 <= component_material <= 18 , 'component ' + str ( i + 1 ) + ' material input not within range of index'
This function checks for errors in the BOM input
Parameters - YAML for product information .dict
This function checks for errors in the BOM input Parameters - YAML for product information . dict
""" This function checks for errors in the BOM input
    
    Parameters - YAML for product information .dict
    ----------

    Returns - checked product_dict
    -------
    
    """ #BOM assertions #BOM entry length assertion #Component name assertions #Component description assertions     #Component basis assertions     #Component material assertions    
product_dict