bb6b2d059ad7b8a231d9f8015b41e60f033eaf76,studio/model.py,,get_config,#Any#,595

Before Change


def get_config(config_file=None):

    if config_file:
        with open(config_file) as f:
            config = yaml.load(f.read())
    else:
        def_config_file = os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            "default_config.yaml")

After Change



def get_config(config_file=None):

    config_paths = []
    if config_file:
        config_paths.append(os.expanduser(config_file))
    
    config_paths.append(os.path.expanduser("~/.tfstudio/config.yaml"))
    config_paths.append(
            os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            "default_config.yaml"))

    for path in config_paths:
        if not os.path.exists(path):
            continue
        
        with(open(path)) as f:
            return yaml.load(f.read())

    raise ValueError("None of the config paths {} exits!"
            .format(config_paths))

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: studioml/studio
Commit Name: bb6b2d059ad7b8a231d9f8015b41e60f033eaf76
Time: 2017-08-04
Author: peter.zhokhov@sentient.ai
File Name: studio/model.py
Class Name:
Method Name: get_config


Project Name: tensorflow/datasets
Commit Name: 5a68c464caac68e4623f9a7b173bcf24aa719a5c
Time: 2019-12-06
Author: adarob@google.com
File Name: tensorflow_datasets/text/trivia_qa.py
Class Name: TriviaQA
Method Name: _generate_examples


Project Name: pantsbuild/pants
Commit Name: 0f80c70a2bdaffbf4b1797aea481a62641701e93
Time: 2018-10-14
Author: benjyw@gmail.com
File Name: src/python/pants/releases/reversion.py
Class Name:
Method Name: reversion