def strip_func(col): ''' Remove the function attached to a column name, i.e. FUNC(col_name), return col_name :param col: string :return: column name string ''' __, col = col.split('(') return col.strip(')').strip()
def clean_col(col): ''' Given a column name which might have a function attached return only the column name :param col: column name string :return: column name ''' if '(' in col and ')' in col: return strip_func(col) else: return col.strip()
def _create_requirement(child, filename, design, design_line, issues, issues_line, collections, collections_line, deprecated, deprecated_line): # Create the Requirement object req = Requirement(name=child.name, filename=filename, line=child.line()) # "deprecated" parameter req.deprecated = child.get('deprecated', deprecated) req.deprecated_line = child.line('deprecated', deprecated_line) # "requirement" parameter req.requirement = child.get('requirement', None) req.requirement_line = child.line('requirement', None) # "design" parameter design = child.get('design', design if not req.deprecated else None) req.design = design.split() if (design is not None) else None req.design_line = child.line('design', design_line) # "issues" parameter issues = child.get('issues', issues if not req.deprecated else None) req.issues = issues.split() if (issues is not None) else None req.issues_line = child.line('issues', issues_line) # "collections" parameter collections = child.get('collections', collections if (collections is not None) else None) req.collections = set( collections.strip().split()) if (collections is not None) else None req.collections_line = child.line('collections', collections_line) # V&V document verification = child.get('verification', None) req.verification = verification.strip().split() if (verification is not None) else None req.verification_line = child.line('verification', None) validation = child.get('validation', None) req.validation = validation.strip().split() if (validation is not None) else None req.validation_line = child.line('validation', None) # "detail" parameter (this will error in check_requirements) req.detail = child.get('detail', None) req.detail_line = child.line('detail', None) return req