d6abdc0d4efa8386e549a9c8bbacc52bf5c82f7e,homeassistant/util/yaml.py,,_ordered_dict,#Any#Any#,36

Before Change


    Load YAML mappings into an ordered dict to preserve key order.
    loader.flatten_mapping(node)
    nodes = loader.construct_pairs(node)
    dups = [k for k, v in Counter(k for k, _ in nodes).items() if v > 1]
    if dups:
        raise yaml.YAMLError("ERROR: duplicate keys: {}".format(dups))
    return OrderedDict(nodes)

After Change


    seen = {}
    for (key, _), (node, _) in zip(nodes, node.value):
        line = getattr(node, "__line__", "unknown")
        if key in seen:
            fname = getattr(loader.stream, "name", "")
            raise yaml.YAMLError("ERROR: duplicate key: \"{}\""
                                 " in {} line {} and {}"
                                 .format(key, fname, seen[key], line))
        seen[key] = line

    return OrderedDict(nodes)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: home-assistant/home-assistant
Commit Name: d6abdc0d4efa8386e549a9c8bbacc52bf5c82f7e
Time: 2016-04-08
Author: jaharkes@cs.cmu.edu
File Name: homeassistant/util/yaml.py
Class Name:
Method Name: _ordered_dict


Project Name: scikit-learn-contrib/sklearn-pandas
Commit Name: 5ce407ce6c4bf6e9acc8466d47fc4e946f5f1bc8
Time: 2017-04-29
Author: dukebody@gmail.com
File Name: sklearn_pandas/categorical_imputer.py
Class Name: CategoricalImputer
Method Name: fit


Project Name: facebookresearch/pytext
Commit Name: 1207689fa1e6ff2d321ccc182be13825b4e2575e
Time: 2019-07-12
Author: mikaell@fb.com
File Name: pytext/models/embeddings/word_embedding.py
Class Name: WordEmbedding
Method Name: from_config