629167ee324a0b955ef46cd5a0cd7bb504ef8c44,hyperspy/misc/io/tools.py,,ensure_directory,#Any#,77

Before Change


def ensure_directory(path):
    Check if the path exists and if it does not create the directory
    directory = os.path.split(path)[0]
    if directory and not os.path.exists(directory):
        os.makedirs(directory)


def overwrite(fname):
     If file exists "fname", ask for overwriting and return True or False,
    else return True.

After Change


    p = Path(path)
    p = p.parent if p.is_file() else p

    try:
        p.mkdir(parents=True, exist_ok=False)
    except FileExistsError:
        _logger.debug(f"Directory {p} already exists. Doing nothing.")


def overwrite(fname):
     If file exists "fname", ask for overwriting and return True or False,
    else return True.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: hyperspy/hyperspy
Commit Name: 629167ee324a0b955ef46cd5a0cd7bb504ef8c44
Time: 2020-09-09
Author: tjof2@cam.ac.uk
File Name: hyperspy/misc/io/tools.py
Class Name:
Method Name: ensure_directory


Project Name: pytorch/tutorials
Commit Name: 00e131977b4e2cbe134f8832f3fbac7940644586
Time: 2018-08-29
Author: minkawhich@fb.com
File Name: beginner_source/hybrid_frontend/introduction_to_hybrid_frontend_tutorial.py
Class Name:
Method Name:


Project Name: NifTK/NiftyNet
Commit Name: d67181e84370f11479e2872271cae56cc2f3b8b3
Time: 2017-08-22
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/application_driver.py
Class Name: ApplicationDriver
Method Name: _summary_dir