)]}'
{"ceilometer/pipeline.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"eb6b9ec2af8e9818f6fd29d15565457e49aa90f2","unresolved":false,"context_lines":[{"line_number":684,"context_line":"                    raise PipelineException(\"Duplicated source names: %s\" %"},{"line_number":685,"context_line":"                                            s.get(\u0027name\u0027), self)"},{"line_number":686,"context_line":"                else:"},{"line_number":687,"context_line":"                    sources.append(p_type[\u0027source\u0027](s))"},{"line_number":688,"context_line":"            sinks \u003d {}"},{"line_number":689,"context_line":"            for s in cfg.get(\u0027sinks\u0027, []):"},{"line_number":690,"context_line":"                if s[\u0027name\u0027] in sinks:"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_65daca19","line":687,"updated":"2015-06-19 16:28:30.000000000","message":"I find this solution a little unreadable and in the case of a long list of sources, towards the end of the processing were going to be traversing that long list ever time we try to add a new item. Would something like this be better?\n\n            sources \u003d []\n            source_names \u003d set()\n            for s in cfg.get(\u0027sources\u0027, []):\n                name \u003d s.get(\u0027name\u0027)\n                if name in source_names:\n                    raise PipelineException(\"Duplicated source names: %s\" %\n                                            name, self)\n                else:\n                    source_names.add(name)\n                    sources.append(p_type[\u0027source\u0027](s))","commit_id":"d0097fec2e68378824c0cc4396ce3bafa21b8cdf"},{"author":{"_account_id":13560,"name":"Rohit Jaiswal","email":"rohit.jaiswal@gmail.com","username":"rjaiswal"},"change_message_id":"e44b74e6c39b06eb8e5f103f9e7d6b3fb75bebf7","unresolved":false,"context_lines":[{"line_number":684,"context_line":"                    raise PipelineException(\"Duplicated source names: %s\" %"},{"line_number":685,"context_line":"                                            s.get(\u0027name\u0027), self)"},{"line_number":686,"context_line":"                else:"},{"line_number":687,"context_line":"                    sources.append(p_type[\u0027source\u0027](s))"},{"line_number":688,"context_line":"            sinks \u003d {}"},{"line_number":689,"context_line":"            for s in cfg.get(\u0027sinks\u0027, []):"},{"line_number":690,"context_line":"                if s[\u0027name\u0027] in sinks:"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_ad543821","line":687,"in_reply_to":"fa32b979_65daca19","updated":"2015-06-19 17:42:48.000000000","message":"Yes, this is undoubtedly better from readability and performance point of view as set have O(1) lookup time compared to the list we are doing, which has O(n).\n\nWhat about the sinks and pipes? They are also iterating over a list to flag duplicates and could use this logic too?","commit_id":"d0097fec2e68378824c0cc4396ce3bafa21b8cdf"}]}
