(logical_line, filename)
Check for explicit import of the _ function

    We need to ensure that any files that are using the _() function
    to translate logs are explicitly importing the _ function.  We
    can't trust unit test to catch whether the import has been
    added so we need to check for it here.
Check for explicit import of the _ function
Check for explicit import of the _ function
def check_explicit_underscore_import(logical_line, filename):
    """Check for explicit import of the _ function

    We need to ensure that any files that are using the _() function
    to translate logs are explicitly importing the _ function.  We
    can't trust unit test to catch whether the import has been
    added so we need to check for it here.
    """

    # Build a list of the files that have _ imported.  No further
    # checking needed once it is found.
    if filename in UNDERSCORE_IMPORT_FILES:
        pass
    elif (underscore_import_check.match(logical_line) or
          custom_underscore_check.match(logical_line)):
        UNDERSCORE_IMPORT_FILES.append(filename)
    elif (translated_log.match(logical_line) or
          string_translation.match(logical_line)):
        yield(0, "M340: Found use of _() without explicit import of _ !")
def check_explicit_underscore_import ( logical_line , filename ) : # Build a list of the files that have _ imported.  No further # checking needed once it is found. if filename in UNDERSCORE_IMPORT_FILES : pass elif ( underscore_import_check . match ( logical_line ) or custom_underscore_check . match ( logical_line ) ) : UNDERSCORE_IMPORT_FILES . append ( filename ) elif ( translated_log . match ( logical_line ) or string_translation . match ( logical_line ) ) : yield ( 0 , "M340: Found use of _() without explicit import of _ !" )