a1a3a6a27e236464460d07fa7e0c4b605d094717,GPflow/_settings.py,,parse,#Any#,73

Before Change



// a very simple parser
def parse(string):
    if type(string) is not str:
        raise ValueError
    if string in ["true", "True"]:
        return True
    elif string in ["false", "False"]:
        return False
    elif string in ["float64", "float32", "float16", "int64", "int32", "int16"]:
        return getattr(tf, string)
    elif any([string.count(s) for s in ".eE"]):
        try:
            return float(string)
        except:
            return string
    else:
        try:

After Change


    
    Very simple config values parser.
    
    if not isinstance(string, str):
        raise ValueError("Config value "{0}" expected to be string."
                         .format(string))
    if string in ["true", "True"]:
        return True
    elif string in ["false", "False"]:
        return False
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: GPflow/GPflow
Commit Name: a1a3a6a27e236464460d07fa7e0c4b605d094717
Time: 2017-08-17
Author: art.art.v@gmail.com
File Name: GPflow/_settings.py
Class Name:
Method Name: parse


Project Name: deepmipt/DeepPavlov
Commit Name: f528c38e26d59b231dd94b87d6603ca243fee766
Time: 2018-02-28
Author: yoptar@gmail.com
File Name: deeppavlov/core/commands/train.py
Class Name:
Method Name: train_model_from_config


Project Name: ray-project/ray
Commit Name: d4a5d09dab446fd9c962c80c87bc7a29f3d8b5cd
Time: 2020-07-10
Author: simon.mo@hey.com
File Name: python/ray/serve/http_proxy.py
Class Name: HTTPProxy
Method Name: __call__