third_party/blink/tools/blinkpy/web_tests/merge_results.py
def ensure_empty_dir(fs, directory, allow_existing, remove_existing):
    """Ensure an empty directory exists.

    Args:
        allow_existing (bool): Allow the empty directory to already exist.
        remove_existing (bool): Remove the contents if the directory
            already exists.
    """
    if not fs.exists(directory):
        fs.maybe_make_directory(directory)
        return

    logging.warning('Output directory exists %r', directory)
    if not allow_existing:
        raise IOError(
            ('Output directory %s exists!\n'
             'Use --allow-existing-output-directory to continue') % directory)

    if not remove_existing:
        return

    layout_test_results = fs.join(directory, 'layout-test-results')
    merged_output_json = fs.join(directory, 'output.json')
    if (fs.exists(layout_test_results)
            and not fs.remove_contents(layout_test_results)):
        raise IOError(('Unable to remove output directory %s contents!\n'
                       'See log output for errors.') % layout_test_results)
    if fs.exists(merged_output_json):
        fs.remove(merged_output_json)
Ensure an empty directory exists.

    Args:
        allow_existing (bool): Allow the empty directory to already exist.
        remove_existing (bool): Remove the contents if the directory
            already exists.
    
Ensure an empty directory exists.
Ensure an empty directory exists .
def ensure_empty_dir(fs, directory, allow_existing, remove_existing):
    if not fs.exists(directory):
        fs.maybe_make_directory(directory)
        return
    logging.warning('Output directory exists %r', directory)
    if not allow_existing:
        raise IOError(
            ('Output directory %s exists!\n'
             'Use --allow-existing-output-directory to continue') % directory)
    if not remove_existing:
        return
    layout_test_results = fs.join(directory, 'layout-test-results')
    merged_output_json = fs.join(directory, 'output.json')
    if (fs.exists(layout_test_results)
            and not fs.remove_contents(layout_test_results)):
        raise IOError(('Unable to remove output directory %s contents!\n'
                       'See log output for errors.') % layout_test_results)
    if fs.exists(merged_output_json):
        fs.remove(merged_output_json)
def ensure_empty_dir ( fs , directory , allow_existing , remove_existing ) : if not fs . exists ( directory ) : fs . maybe_make_directory ( directory ) return logging . warning ( 'Output directory exists %r' , directory ) if not allow_existing : raise IOError ( ( 'Output directory %s exists!\n' 'Use --allow-existing-output-directory to continue' ) % directory ) if not remove_existing : return layout_test_results = fs . join ( directory , 'layout-test-results' ) merged_output_json = fs . join ( directory , 'output.json' ) if ( fs . exists ( layout_test_results ) and not fs . remove_contents ( layout_test_results ) ) : raise IOError ( ( 'Unable to remove output directory %s contents!\n' 'See log output for errors.' ) % layout_test_results ) if fs . exists ( merged_output_json ) : fs . remove ( merged_output_json )
Ensure an empty directory exists.
Ensure an empty directory exists .
"""Ensure an empty directory exists.

    Args:
        allow_existing (bool): Allow the empty directory to already exist.
        remove_existing (bool): Remove the contents if the directory
            already exists.
    """
fs
directory
allow_existing
Allow the empty directory to already exist.
Allow the empty directory to already exist .
remove_existing
Remove the contents if the directory
already exists.
Remove the contents if the directory already exists .