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
nodes = loader.construct_pairs(node)
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)
yaml.SafeLoader.add_constructor("!include", _include_yaml)
yaml.SafeLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
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: NTMC-Community/MatchZoo
Commit Name: 4bc0cb5d2924a63cf06f641b7cf36f799885f33f
Time: 2018-12-26
Author: 948280670@qq.com
File Name: matchzoo/processor_units/processor_units.py
Class Name: WordHashingUnit
Method Name: transform
Project Name: miso-belica/sumy
Commit Name: 744bf96954e31d80ddd21549805d5d0fc8fae3e7
Time: 2015-08-02
Author: jgriggs@princeton.edu
File Name: tests/test_summarizers/test_sum_basic.py
Class Name: TestSumBasic
Method Name: test_get_all_content_words_in_doc
Project Name: miso-belica/sumy
Commit Name: 744bf96954e31d80ddd21549805d5d0fc8fae3e7
Time: 2015-08-02
Author: jgriggs@princeton.edu
File Name: sumy/summarizers/sum_basic.py
Class Name: SumBasicSummarizer
Method Name: _compute_word_freq