test/lint/lint-python-format.py
def find_snippets(file):
    """Find code snippets in the source file that contains the percent ('%')
    character"""
    with open(file, 'r', encoding='utf-8') as f:
        snippet_line = ""
        snippets = {}

        for line_number, line in enumerate(f):
            # Skip comments
            if not line.strip().startswith('#'):
                # If we are not already in a snippet and the line contains a %
                # character, start saving the snippet
                if not snippet_line and '%' in line:
                    snippet_line = str(line_number + 1)
                    snippets[snippet_line] = ""

                # In a snippet ?
                # - save the line
                # - check if the snippet is complete
                if snippet_line:
                    snippets[snippet_line] += line
                    if is_complete(line):
                        snippet_line = ""

    return snippets
Find code snippets in the source file that contains the percent ('%')
    character
Find code snippets in the source file that contains the percent ('%')
character
Find code snippets in the source file that contains the percent ( ' % ' ) character
def find_snippets(file):
    with open(file, 'r', encoding='utf-8') as f:
        snippet_line = ""
        snippets = {}
        for line_number, line in enumerate(f):
            if not line.strip().startswith('#'):
                if not snippet_line and '%' in line:
                    snippet_line = str(line_number + 1)
                    snippets[snippet_line] = ""
                if snippet_line:
                    snippets[snippet_line] += line
                    if is_complete(line):
                        snippet_line = ""
    return snippets
def find_snippets ( file ) : with open ( file , 'r' , encoding = 'utf-8' ) as f : snippet_line = "" snippets = { } for line_number , line in enumerate ( f ) : if not line . strip ( ) . startswith ( '#' ) : if not snippet_line and '%' in line : snippet_line = str ( line_number + 1 ) snippets [ snippet_line ] = "" if snippet_line : snippets [ snippet_line ] += line if is_complete ( line ) : snippet_line = "" return snippets
Find code snippets in the source file that contains the percent ('%')
character
Find code snippets in the source file that contains the percent ( ' % ' ) character
"""Find code snippets in the source file that contains the percent ('%')
    character""" # Skip comments # If we are not already in a snippet and the line contains a % # character, start saving the snippet # In a snippet ? # - save the line # - check if the snippet is complete
file