944a0ccc8dc9110516192b0b41a12e8f9612f7ef,server/website/website/db/base/parser.py,BaseParser,extract_valid_variables,#BaseParser#Any#Any#Any#,214

Before Change


        // default_value if provided (or the item"s actual default value if not) and
        // logged as "missing".
        lc_variables = {k.lower(): v for k, v in list(variables.items())}
        for valid_lc_name, metadata in list(valid_lc_variables.items()):
            if valid_lc_name not in lc_variables:
                diff_log.append(("missing", metadata.name, None, None))
                valid_variables[metadata.name] = default_value if \

After Change



    def extract_valid_variables(self, variables, catalog, default_value=None):
        valid_variables = {}
        diff_log = OrderedDict([(k, []) for k in ("miscapitalized", "extra", "missing")])
        lc_catalog = {k.lower(): v for k, v in catalog.items()}

        // First check that the names of all variables are valid (i.e., listed
        // in the official catalog). Invalid variables are logged as "extras".
        // Variable names that are valid but differ in capitalization are still
        // added to valid_variables but with the proper capitalization. They
        // are also logged as "miscapitalized".
        for var_name, var_value in variables.items():
            if var_name in catalog:
                valid_variables[var_name] = var_value
            else:
                lc_var_name = var_name.lower()
                if lc_var_name in lc_catalog:
                    valid_name = lc_catalog[lc_var_name].name
                    diff_log["miscapitalized"].append((valid_name, var_name))
                    valid_variables[valid_name] = var_value
                else:
                    diff_log["extra"].append(var_name)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: cmu-db/ottertune
Commit Name: 944a0ccc8dc9110516192b0b41a12e8f9612f7ef
Time: 2020-02-20
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/db/base/parser.py
Class Name: BaseParser
Method Name: extract_valid_variables


Project Name: elfi-dev/elfi
Commit Name: 91de05779be2545c6c95b2ed4658e7ab4d607ad5
Time: 2017-02-23
Author: jarno.lintusaari@aalto.fi
File Name: tests/functional/test_inference.py
Class Name:
Method Name: test_rejection


Project Name: reinforceio/tensorforce
Commit Name: 62cea7fcfcc9e20b784e08bddce5dc69b9578ef4
Time: 2019-01-05
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/baselines/cnn_baseline.py
Class Name: CNNBaseline
Method Name: __init__