)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c8f78ee51823ac73658223fbe48081042f98091d","unresolved":false,"context_lines":[{"line_number":10,"context_line":"instances that boot from image. The commit fixes it by getting all"},{"line_number":11,"context_line":"images information in one shot."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"I also move the code that process non-API filters to a new function"},{"line_number":14,"context_line":"because otherwise my fix couldn\u0027t pass McCabe complexity. Project panel"},{"line_number":15,"context_line":"is changed similarly to make the code a bit consistent."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I360aef8c34304f3abe76a90787ab63647cd78491"},{"line_number":18,"context_line":"Closes-Bug: #1711486"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ff82abbf_f7bff1cd","line":15,"range":{"start_line":13,"start_character":0,"end_line":15,"end_character":55},"updated":"2017-12-01 00:56:45.000000000","message":"Mixing two things is not recommended: a bug fix and a refactoring. They should be done in separate patches.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"}],"openstack_dashboard/dashboards/admin/instances/views.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    return views.rdp(args, **kvargs)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"# re-use process_non_api_filters from project.instances.views"},{"line_number":65,"context_line":"def process_non_api_filters(search_opts, naf_info):"},{"line_number":66,"context_line":"    return views.process_non_api_filters(search_opts, naf_info)"},{"line_number":67,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_30f85779","line":64,"updated":"2017-10-16 17:03:32.000000000","message":"Why don\u0027t you call project.instances.views.process_non_api_filters directly? This method does nothing more.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"eb1fb6e6bea1c2c5576bfdf474cb0d63a91c4c8f","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    return views.rdp(args, **kvargs)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"# re-use process_non_api_filters from project.instances.views"},{"line_number":65,"context_line":"def process_non_api_filters(search_opts, naf_info):"},{"line_number":66,"context_line":"    return views.process_non_api_filters(search_opts, naf_info)"},{"line_number":67,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"ff82abbf_97ca259f","line":64,"in_reply_to":"5f4e5783_11567407","updated":"2017-12-01 00:45:43.000000000","message":"Even though there are copied code, it is not a reasonable reason to introduce a new copy.\n\nOther bad examples can be clean up as a follow-up patch when we notice them.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    return views.rdp(args, **kvargs)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"# re-use process_non_api_filters from project.instances.views"},{"line_number":65,"context_line":"def process_non_api_filters(search_opts, naf_info):"},{"line_number":66,"context_line":"    return views.process_non_api_filters(search_opts, naf_info)"},{"line_number":67,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_11567407","line":64,"in_reply_to":"5f4e5783_30f85779","updated":"2017-10-17 03:33:28.000000000","message":"\u003e Why don\u0027t you call project.instances.views.process_non_api_filters\n \u003e directly? This method does nothing more.\n\nSee other functions, like spice(), rdp(). They are all implemented this way.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            try:"},{"line_number":126,"context_line":"                tmp_images \u003d api.glance.image_list_detailed(self.request)[0]"},{"line_number":127,"context_line":"                images.extend(tmp_images)"},{"line_number":128,"context_line":"                image_map.update([(str(image.id), image) for image in images])"},{"line_number":129,"context_line":"            except Exception:"},{"line_number":130,"context_line":"                msg \u003d _(\"Unable to retrieve image list.\")"},{"line_number":131,"context_line":"                exceptions.handle(self.request, msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_f01bdfc6","line":128,"updated":"2017-10-16 17:03:32.000000000","message":"There is no use to dict update here.\nYou can calculate image_map around L.181.\n\n image_map \u003d dict((image.id, image) for image in images)","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"eb1fb6e6bea1c2c5576bfdf474cb0d63a91c4c8f","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            try:"},{"line_number":126,"context_line":"                tmp_images \u003d api.glance.image_list_detailed(self.request)[0]"},{"line_number":127,"context_line":"                images.extend(tmp_images)"},{"line_number":128,"context_line":"                image_map.update([(str(image.id), image) for image in images])"},{"line_number":129,"context_line":"            except Exception:"},{"line_number":130,"context_line":"                msg \u003d _(\"Unable to retrieve image list.\")"},{"line_number":131,"context_line":"                exceptions.handle(self.request, msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"ff82abbf_5749fd2f","line":128,"in_reply_to":"5f4e5783_d1b1fc48","updated":"2017-12-01 00:45:43.000000000","message":"Following the other code pattern without describing why leads to a situation nobody cannot understand why it was introduced. This is a good chance to clarify the situation. I cannot understand why this is a thing to avoid.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            try:"},{"line_number":126,"context_line":"                tmp_images \u003d api.glance.image_list_detailed(self.request)[0]"},{"line_number":127,"context_line":"                images.extend(tmp_images)"},{"line_number":128,"context_line":"                image_map.update([(str(image.id), image) for image in images])"},{"line_number":129,"context_line":"            except Exception:"},{"line_number":130,"context_line":"                msg \u003d _(\"Unable to retrieve image list.\")"},{"line_number":131,"context_line":"                exceptions.handle(self.request, msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_d1b1fc48","line":128,"in_reply_to":"5f4e5783_f01bdfc6","updated":"2017-10-17 03:33:28.000000000","message":"\u003e There is no use to dict update here.\n \u003e You can calculate image_map around L.181.\n \u003e \n \u003e image_map \u003d dict((image.id, image) for image in images)\n\nAgain, I\u0027m following coding style in other functions. I agree what you said is correct in this case. On the other hand, however, using update() make the code a bit more versatile.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":177,"context_line":"            return instances"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        _task_get_instances()"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        # Loop through instances to get image, flavor and tenant info."},{"line_number":182,"context_line":"        for inst in instances:"},{"line_number":183,"context_line":"            if hasattr(inst, \u0027image\u0027) and isinstance(inst.image, dict):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_d096a3f0","line":180,"updated":"2017-10-16 17:03:32.000000000","message":"You copied L.181-190 from the project instance view. Could you reuse the code of the project instance view rather than copying it?","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":177,"context_line":"            return instances"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"        _task_get_instances()"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        # Loop through instances to get image, flavor and tenant info."},{"line_number":182,"context_line":"        for inst in instances:"},{"line_number":183,"context_line":"            if hasattr(inst, \u0027image\u0027) and isinstance(inst.image, dict):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_117d546d","line":180,"in_reply_to":"5f4e5783_d096a3f0","updated":"2017-10-17 03:33:28.000000000","message":"\u003e You copied L.181-190 from the project instance view. Could you\n \u003e reuse the code of the project instance view rather than copying it?\n\nPlease see my comments above.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        # Loop through instances to get image, flavor and tenant info."},{"line_number":182,"context_line":"        for inst in instances:"},{"line_number":183,"context_line":"            if hasattr(inst, \u0027image\u0027) and isinstance(inst.image, dict):"},{"line_number":184,"context_line":"                if inst.image.get(\u0027id\u0027) in image_map:"},{"line_number":185,"context_line":"                    inst.image \u003d image_map[inst.image.get(\u0027id\u0027)]"},{"line_number":186,"context_line":"                # In case image not found in image_map, set name to empty"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_3054d752","line":183,"range":{"start_line":183,"start_character":42,"end_line":183,"end_character":71},"updated":"2017-10-16 17:03:32.000000000","message":"Is there a case where inst.image is not a dict? If there is, what value does inst.image have for such case?","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        # Loop through instances to get image, flavor and tenant info."},{"line_number":182,"context_line":"        for inst in instances:"},{"line_number":183,"context_line":"            if hasattr(inst, \u0027image\u0027) and isinstance(inst.image, dict):"},{"line_number":184,"context_line":"                if inst.image.get(\u0027id\u0027) in image_map:"},{"line_number":185,"context_line":"                    inst.image \u003d image_map[inst.image.get(\u0027id\u0027)]"},{"line_number":186,"context_line":"                # In case image not found in image_map, set name to empty"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_313df08e","line":183,"range":{"start_line":183,"start_character":42,"end_line":183,"end_character":71},"in_reply_to":"5f4e5783_3054d752","updated":"2017-10-17 03:33:28.000000000","message":"\u003e Is there a case where inst.image is not a dict? If there is, what\n \u003e value does inst.image have for such case?\n\nIf I remember it correctly, when an instance boots from volume, its image attribute is not a dict, but a string (the volume\u0027s id).","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # Loop through instances to get image, flavor and tenant info."},{"line_number":182,"context_line":"        for inst in instances:"},{"line_number":183,"context_line":"            if hasattr(inst, \u0027image\u0027) and isinstance(inst.image, dict):"},{"line_number":184,"context_line":"                if inst.image.get(\u0027id\u0027) in image_map:"},{"line_number":185,"context_line":"                    inst.image \u003d image_map[inst.image.get(\u0027id\u0027)]"},{"line_number":186,"context_line":"                # In case image not found in image_map, set name to empty"},{"line_number":187,"context_line":"                # to avoid fallback API call to Glance in api/nova.py"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_30d977f2","line":184,"range":{"start_line":184,"start_character":29,"end_line":184,"end_character":33},"updated":"2017-10-16 17:03:32.000000000","message":"Is \u0027id\u0027 optional? If not, it is better to use a normal dict access.\n\n  if inst.image[\u0027id\u0027] in image_map:","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        # Loop through instances to get image, flavor and tenant info."},{"line_number":182,"context_line":"        for inst in instances:"},{"line_number":183,"context_line":"            if hasattr(inst, \u0027image\u0027) and isinstance(inst.image, dict):"},{"line_number":184,"context_line":"                if inst.image.get(\u0027id\u0027) in image_map:"},{"line_number":185,"context_line":"                    inst.image \u003d image_map[inst.image.get(\u0027id\u0027)]"},{"line_number":186,"context_line":"                # In case image not found in image_map, set name to empty"},{"line_number":187,"context_line":"                # to avoid fallback API call to Glance in api/nova.py"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_5163ccb2","line":184,"range":{"start_line":184,"start_character":29,"end_line":184,"end_character":33},"in_reply_to":"5f4e5783_30d977f2","updated":"2017-10-17 03:33:28.000000000","message":"\u003e Is \u0027id\u0027 optional? If not, it is better to use a normal dict access.\n \u003e \n \u003e if inst.image[\u0027id\u0027] in image_map:\n\nHonestly speaking, I\u0027m not sure if \u0027id\u0027 is optional or not (I guess not?). But I think the current approach (defensive programming) is better? Again, this is copied from from project panel.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"}],"openstack_dashboard/dashboards/project/instances/views.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # item is a tuple of the following format:"},{"line_number":128,"context_line":"        #     \u003cfake field name\u003e, \u003creal field name\u003e, \u003cresource\u003e"},{"line_number":129,"context_line":"        # Resource is used to find the matched value of real field."},{"line_number":130,"context_line":"        naf_info \u003d [(\u0027image_name\u0027, \u0027image\u0027, images),"},{"line_number":131,"context_line":"                    (\u0027flavor_name\u0027, \u0027flavor\u0027, flavors)]"},{"line_number":132,"context_line":"        if not process_non_api_filters(search_opts, naf_info):"},{"line_number":133,"context_line":"            self._more \u003d False"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_90814bfe","line":130,"range":{"start_line":130,"start_character":8,"end_line":130,"end_character":16},"updated":"2017-10-16 17:03:32.000000000","message":"It is hard to understand what \u0027naf\u0027 means. Could you use full spelling? I guess \u0027naf\u0027 means \u0027non_api_filters\u0027 but it is not a good name....","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # item is a tuple of the following format:"},{"line_number":128,"context_line":"        #     \u003cfake field name\u003e, \u003creal field name\u003e, \u003cresource\u003e"},{"line_number":129,"context_line":"        # Resource is used to find the matched value of real field."},{"line_number":130,"context_line":"        naf_info \u003d [(\u0027image_name\u0027, \u0027image\u0027, images),"},{"line_number":131,"context_line":"                    (\u0027flavor_name\u0027, \u0027flavor\u0027, flavors)]"},{"line_number":132,"context_line":"        if not process_non_api_filters(search_opts, naf_info):"},{"line_number":133,"context_line":"            self._more \u003d False"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_b1f680d6","line":130,"range":{"start_line":130,"start_character":8,"end_line":130,"end_character":16},"in_reply_to":"5f4e5783_90814bfe","updated":"2017-10-17 03:33:28.000000000","message":"\u003e It is hard to understand what \u0027naf\u0027 means. Could you use full\n \u003e spelling? I guess \u0027naf\u0027 means \u0027non_api_filters\u0027 but it is not a\n \u003e good name....\n\nYes, it means that. I tried hard to think out a better name. Could you suggest one? :)","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                return True"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":""},{"line_number":174,"context_line":"def process_non_api_filters(search_opts, naf_info):"},{"line_number":175,"context_line":"    for fake_field, real_field, resources in naf_info:"},{"line_number":176,"context_line":"        if fake_field in search_opts and not swap_filter("},{"line_number":177,"context_line":"                resources, search_opts, fake_field, real_field):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_7086cf15","line":174,"range":{"start_line":174,"start_character":41,"end_line":174,"end_character":49},"updated":"2017-10-16 17:03:32.000000000","message":"same as the above","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"9adfc959e4c39d4108cba218867435cd97948f4a","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"def process_non_api_filters(search_opts, naf_info):"},{"line_number":175,"context_line":"    for fake_field, real_field, resources in naf_info:"},{"line_number":176,"context_line":"        if fake_field in search_opts and not swap_filter("},{"line_number":177,"context_line":"                resources, search_opts, fake_field, real_field):"},{"line_number":178,"context_line":"            return False"},{"line_number":179,"context_line":"    return True"},{"line_number":180,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_90af0b7c","line":177,"range":{"start_line":176,"start_character":8,"end_line":177,"end_character":64},"updated":"2017-10-16 17:03:32.000000000","message":"Could you change the place of wrapping lines for better readability?\n\n  if (fake_field in search_opts and\n      not swap_filter(resources, ....)):\n      return False","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"},{"author":{"_account_id":26861,"name":"Huan Xiong","email":"huan.xiong@hxt-semitech.com","username":"rayx"},"change_message_id":"fada242a6cdddd20d2cc26c9ce65f1c6fcea9f3c","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"def process_non_api_filters(search_opts, naf_info):"},{"line_number":175,"context_line":"    for fake_field, real_field, resources in naf_info:"},{"line_number":176,"context_line":"        if fake_field in search_opts and not swap_filter("},{"line_number":177,"context_line":"                resources, search_opts, fake_field, real_field):"},{"line_number":178,"context_line":"            return False"},{"line_number":179,"context_line":"    return True"},{"line_number":180,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_b1cd6086","line":177,"range":{"start_line":176,"start_character":8,"end_line":177,"end_character":64},"in_reply_to":"5f4e5783_90af0b7c","updated":"2017-10-17 03:33:28.000000000","message":"\u003e Could you change the place of wrapping lines for better\n \u003e readability?\n \u003e \n \u003e if (fake_field in search_opts and\n \u003e     not swap_filter(resources, ....)):\n \u003e     return False\n\nI don\u0027t think what you suggested could pass pep8 style checking. If I remember it correctly, wrapped line (the second one) should have indent of 8 chars, which unfortunately would generate another wrapped line in this case.","commit_id":"dfb669179365d7dc304f32c5ca1dc58ecc9fb3c9"}]}
