chrome/test/mini_installer/file_operations.py
def CleanFile(expectation_name, expectation, variable_expander):
    """Deletes files or directories based on expectations.

    Args:
        expectation_name: Path to the file/directory to be cleaned.
        expectation: A dictionary describing the state of the path:
            'exists': A boolean False indicating that the path must not exist.
        variable_expander: A VariableExpander object.

    Raises:
        AssertionError: If an expectation is not satisfied.
        WindowsError: If an error occurs while deleting the path.
    """
    file_path = variable_expander.Expand(expectation_name)
    assert not expectation['exists'], (
        'Invalid expectation for CleanFile operation: \'exists\' property for '
        + 'path %s must not be True' % file_path)
    try:
        if stat.S_ISDIR(os.lstat(file_path).st_mode):
            shutil.rmtree(file_path)
            LOGGER.info('CleanFile deleted directory %s' % file_path)
        else:
            os.remove(file_path)
            LOGGER.info('CleanFile deleted file %s' % file_path)
    except WindowsError as e:
        if (e.winerror != winerror.ERROR_FILE_NOT_FOUND
                and e.winerror != winerror.ERROR_PATH_NOT_FOUND):
            raise
Deletes files or directories based on expectations.

    Args:
        expectation_name: Path to the file/directory to be cleaned.
        expectation: A dictionary describing the state of the path:
            'exists': A boolean False indicating that the path must not exist.
        variable_expander: A VariableExpander object.

    Raises:
        AssertionError: If an expectation is not satisfied.
        WindowsError: If an error occurs while deleting the path.
    
Deletes files or directories based on expectations.
Deletes files or directories based on expectations .
def CleanFile(expectation_name, expectation, variable_expander):
    file_path = variable_expander.Expand(expectation_name)
    assert not expectation['exists'], (
        'Invalid expectation for CleanFile operation: \'exists\' property for '
        + 'path %s must not be True' % file_path)
    try:
        if stat.S_ISDIR(os.lstat(file_path).st_mode):
            shutil.rmtree(file_path)
            LOGGER.info('CleanFile deleted directory %s' % file_path)
        else:
            os.remove(file_path)
            LOGGER.info('CleanFile deleted file %s' % file_path)
    except WindowsError as e:
        if (e.winerror != winerror.ERROR_FILE_NOT_FOUND
                and e.winerror != winerror.ERROR_PATH_NOT_FOUND):
            raise
def CleanFile ( expectation_name , expectation , variable_expander ) : file_path = variable_expander . Expand ( expectation_name ) assert not expectation [ 'exists' ] , ( 'Invalid expectation for CleanFile operation: \'exists\' property for ' + 'path %s must not be True' % file_path ) try : if stat . S_ISDIR ( os . lstat ( file_path ) . st_mode ) : shutil . rmtree ( file_path ) LOGGER . info ( 'CleanFile deleted directory %s' % file_path ) else : os . remove ( file_path ) LOGGER . info ( 'CleanFile deleted file %s' % file_path ) except WindowsError as e : if ( e . winerror != winerror . ERROR_FILE_NOT_FOUND and e . winerror != winerror . ERROR_PATH_NOT_FOUND ) : raise
Deletes files or directories based on expectations.
Deletes files or directories based on expectations .
"""Deletes files or directories based on expectations.

    Args:
        expectation_name: Path to the file/directory to be cleaned.
        expectation: A dictionary describing the state of the path:
            'exists': A boolean False indicating that the path must not exist.
        variable_expander: A VariableExpander object.

    Raises:
        AssertionError: If an expectation is not satisfied.
        WindowsError: If an error occurs while deleting the path.
    """
If an expectation is not satisfied.
If an expectation is not satisfied .
AssertionError
If an error occurs while deleting the path.
If an error occurs while deleting the path .
WindowsError
expectation_name
Path to the file/directory to be cleaned.
Path to the file / directory to be cleaned .
expectation
A dictionary describing the state of the path:
'exists': A boolean False indicating that the path must not exist.
A dictionary describing the state of the path : ' exists ' : A boolean False indicating that the path must not exist .
variable_expander
A VariableExpander object.
A VariableExpander object .