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)

After Change


    Check if the path exists and if it does not, creates the directory.
    // If it"s a file path, try the parent directory instead
    p = Path(path)
    p = p.parent if p.is_file() else p

    try:
        p.mkdir(parents=True, exist_ok=False)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

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: J535D165/recordlinkage
Commit Name: cba3992c51d4484656983fb7018455a44586691e
Time: 2019-07-12
Author: jonathandebruinos@gmail.com
File Name: recordlinkage/datasets/external.py
Class Name:
Method Name: load_krebsregister


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