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: 5

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: comic/grand-challenge.org
Commit Name: c11a9660a04ee0dd5c2d25c69f53e271747c7612
Time: 2020-03-24
Author: 57257130+MikeOverkamp-diag@users.noreply.github.com
File Name: app/grandchallenge/reader_studies/views.py
Class Name: QuestionOptionMixin
Method Name: validate_options


Project Name: tensorflow/hub
Commit Name: e77ef353f0ec74e4ea819354545848e3cd2ac51d
Time: 2018-08-21
Author: no-reply@google.com
File Name: tensorflow_hub/native_module.py
Class Name:
Method Name: find_signature_inputs_from_multivalued_ops