)]}'
{"nova/compute/resource_tracker.py":[{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"1acaf79a3cb78f5958cef854461661e55b448b12","unresolved":false,"context_lines":[{"line_number":433,"context_line":"        metrics \u003d []"},{"line_number":434,"context_line":"        for monitor in self.monitors:"},{"line_number":435,"context_line":"            try:"},{"line_number":436,"context_line":"                metrics.extend(monitor.get_metric_objects().objects)"},{"line_number":437,"context_line":"            except Exception:"},{"line_number":438,"context_line":"                LOG.warning(_LW(\"Cannot get the metrics from %s.\"), monitor)"},{"line_number":439,"context_line":"        metrics \u003d objects.MonitorMetricList(objects\u003dmetrics)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a2fa921_f4fe0aad","line":436,"updated":"2015-10-08 09:25:45.000000000","message":"So this seems weirder to me - we get the list object, then we get the objects out of it to extend it, and then we put it back into an object.\n\nWe are really just flattening a list. There is a nice idiom in python to do this:\n\n  flat_list \u003d list(itertools.chain(*list_of_lists))\n\nSo why not just do that in this method and avoid all this object dancing.","commit_id":"2575d2c16c0430d36d0b628a3074a3f9ae85d24b"},{"author":{"_account_id":8688,"name":"Alexis Lee","email":"openstack@lxsli.co.uk","username":"lxsli"},"change_message_id":"d769884ef8d2c9b273bf17ac31516d99ff8717c6","unresolved":false,"context_lines":[{"line_number":433,"context_line":"        metrics \u003d []"},{"line_number":434,"context_line":"        for monitor in self.monitors:"},{"line_number":435,"context_line":"            try:"},{"line_number":436,"context_line":"                metrics.extend(monitor.get_metric_objects().objects)"},{"line_number":437,"context_line":"            except Exception:"},{"line_number":438,"context_line":"                LOG.warning(_LW(\"Cannot get the metrics from %s.\"), monitor)"},{"line_number":439,"context_line":"        metrics \u003d objects.MonitorMetricList(objects\u003dmetrics)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a2fa921_b73894f0","line":436,"in_reply_to":"7a2fa921_f4fe0aad","updated":"2015-10-08 10:03:04.000000000","message":"The try/except makes it tricky to do that. We\u0027d need to wrap each call to get_metric_objects.\n\nI agree the object dancing is ugly, there\u0027d be less of it if get_metric_objects returned a simple list but I\u0027m trying to reach a compromise with Jay (see PS#1).\n\nAnother way would be to make ObjectListBase implement collections.MutableSequence, which is how we\u0027re treating it. Dan Smith has a good reason not to do that though, can\u0027t remember the details right now.","commit_id":"2575d2c16c0430d36d0b628a3074a3f9ae85d24b"}]}
