)]}'
{"quantum/db/db_base_plugin_v2.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":653,"context_line":"        p \u003d port[\u0027port\u0027]"},{"line_number":654,"context_line":"        ips \u003d []"},{"line_number":655,"context_line":""},{"line_number":656,"context_line":"        fixed_configured \u003d p[\u0027fixed_ips\u0027] is not attributes.ATTR_NOT_SPECIFIED"},{"line_number":657,"context_line":"        if fixed_configured:"},{"line_number":658,"context_line":"            configured_ips \u003d self._test_fixed_ips_for_port(context,"},{"line_number":659,"context_line":"                                                           p[\"network_id\"],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fkqk%3D","line":656,"updated":"2013-01-15 16:10:51.000000000","message":"Changing equality comparison (\u003d\u003d) with object identity (is) is fine here, I guess, because all the non-populated API parameters are set to a particular instance of object, which is indeed attributes.ATTR_NOT_SPECIFIED.\n\nHave you checked that the above is correct? I hope we\u0027re not copying object instances or creating new ones.","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":653,"context_line":"        p \u003d port[\u0027port\u0027]"},{"line_number":654,"context_line":"        ips \u003d []"},{"line_number":655,"context_line":""},{"line_number":656,"context_line":"        fixed_configured \u003d p[\u0027fixed_ips\u0027] is not attributes.ATTR_NOT_SPECIFIED"},{"line_number":657,"context_line":"        if fixed_configured:"},{"line_number":658,"context_line":"            configured_ips \u003d self._test_fixed_ips_for_port(context,"},{"line_number":659,"context_line":"                                                           p[\"network_id\"],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FkpU%3D","line":656,"in_reply_to":"AAAAM3%2F%2Fkqk%3D","updated":"2013-01-15 16:31:16.000000000","message":"I have manually checked all occurances and none of them were copying objects or creating new ones. Should there be a test case where ATTR_NOT_SPECIFIED is being used?","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8ae72962202c7fcc9425e5c4f499746aa8659a0b","unresolved":false,"context_lines":[{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        if \u0027cidr\u0027 in s:"},{"line_number":1010,"context_line":"            self._validate_ip_version(ip_ver, s[\u0027cidr\u0027], \u0027cidr\u0027)"},{"line_number":1011,"context_line":"        if attributes.is_attr_set(s.get(\u0027gateway_ip\u0027)):"},{"line_number":1012,"context_line":"            self._validate_ip_version(ip_ver, s[\u0027gateway_ip\u0027], \u0027gateway_ip\u0027)"},{"line_number":1013,"context_line":"            if (cfg.CONF.force_gateway_on_subnet and"},{"line_number":1014,"context_line":"                not QuantumDbPluginV2._check_subnet_ip(s[\u0027cidr\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FksI%3D","line":1011,"updated":"2013-01-15 15:47:22.000000000","message":"This is not the equivalent conditional.  A valid input here is gateway_ip \u003d \"\". is_attr_set() will allow that through, but the _validate_ip_version() will fail and raise the InvalidInput exception.","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8ae72962202c7fcc9425e5c4f499746aa8659a0b","unresolved":false,"context_lines":[{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        if \u0027cidr\u0027 in s:"},{"line_number":1010,"context_line":"            self._validate_ip_version(ip_ver, s[\u0027cidr\u0027], \u0027cidr\u0027)"},{"line_number":1011,"context_line":"        if attributes.is_attr_set(s.get(\u0027gateway_ip\u0027)):"},{"line_number":1012,"context_line":"            self._validate_ip_version(ip_ver, s[\u0027gateway_ip\u0027], \u0027gateway_ip\u0027)"},{"line_number":1013,"context_line":"            if (cfg.CONF.force_gateway_on_subnet and"},{"line_number":1014,"context_line":"                not QuantumDbPluginV2._check_subnet_ip(s[\u0027cidr\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fkqo%3D","line":1011,"in_reply_to":"AAAAM3%2F%2Fkro%3D","updated":"2013-01-15 19:31:38.000000000","message":"You\u0027re correct.  I had forgotten that we had removed \u0027\u0027 as valid input.","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        if \u0027cidr\u0027 in s:"},{"line_number":1010,"context_line":"            self._validate_ip_version(ip_ver, s[\u0027cidr\u0027], \u0027cidr\u0027)"},{"line_number":1011,"context_line":"        if attributes.is_attr_set(s.get(\u0027gateway_ip\u0027)):"},{"line_number":1012,"context_line":"            self._validate_ip_version(ip_ver, s[\u0027gateway_ip\u0027], \u0027gateway_ip\u0027)"},{"line_number":1013,"context_line":"            if (cfg.CONF.force_gateway_on_subnet and"},{"line_number":1014,"context_line":"                not QuantumDbPluginV2._check_subnet_ip(s[\u0027cidr\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fkro%3D","line":1011,"in_reply_to":"AAAAM3%2F%2FksI%3D","updated":"2013-01-15 15:59:59.000000000","message":"gateway_ip is validated as None or a valid ip so I don\u0027t think this would happen","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"}],"quantum/policy.py":[{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8ae72962202c7fcc9425e5c4f499746aa8659a0b","unresolved":false,"context_lines":[{"line_number":67,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target):"},{"line_number":68,"context_line":"    \"\"\"Verify that an attribute is present and has a non-default value\"\"\""},{"line_number":69,"context_line":"    if (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":70,"context_line":"        attribute_name in target and"},{"line_number":71,"context_line":"        target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED):"},{"line_number":72,"context_line":"        if (target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]):"},{"line_number":73,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FktE%3D","line":70,"updated":"2013-01-15 15:47:22.000000000","message":"Consider consolidating to:\n\ntarget.get(attribute_name) is not attributes.ATTR_NOT_SPECIFIED","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":67,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target):"},{"line_number":68,"context_line":"    \"\"\"Verify that an attribute is present and has a non-default value\"\"\""},{"line_number":69,"context_line":"    if (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":70,"context_line":"        attribute_name in target and"},{"line_number":71,"context_line":"        target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED):"},{"line_number":72,"context_line":"        if (target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]):"},{"line_number":73,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fjnk%3D","line":70,"in_reply_to":"AAAAM3%2F%2Fko0%3D","updated":"2013-01-16 02:57:15.000000000","message":"Done","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":67,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target):"},{"line_number":68,"context_line":"    \"\"\"Verify that an attribute is present and has a non-default value\"\"\""},{"line_number":69,"context_line":"    if (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":70,"context_line":"        attribute_name in target and"},{"line_number":71,"context_line":"        target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED):"},{"line_number":72,"context_line":"        if (target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]):"},{"line_number":73,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FkoQ%3D","line":70,"in_reply_to":"AAAAM3%2F%2Fkq4%3D","updated":"2013-01-15 16:31:16.000000000","message":"So in the original logic there could be three cases 1) attribute_name is not set in target, 2) attribute_name is set as ATTR_NOT_SPECIFIED and 3) attribute_name is set as X. In cases 1) an 2), target.get(attribute_name, attributes.ATTR_NOT_SPECIFIED) will return ATTR_NOT_SPECIFIED thus False. In case 3), target.get(attribute_name, attributes.ATTR_NOT_SPECIFIED) returns X thus True.\n\nIf we use target.get(attribute_name), case 2) and 3) are consistant.However in case 1), the returning value will be None which will end up evaluating \"None is not ATTR_NOT_SPECIFIED\" which is True.","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":67,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target):"},{"line_number":68,"context_line":"    \"\"\"Verify that an attribute is present and has a non-default value\"\"\""},{"line_number":69,"context_line":"    if (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":70,"context_line":"        attribute_name in target and"},{"line_number":71,"context_line":"        target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED):"},{"line_number":72,"context_line":"        if (target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]):"},{"line_number":73,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fkq4%3D","line":70,"in_reply_to":"AAAAM3%2F%2FkrY%3D","updated":"2013-01-15 16:10:51.000000000","message":"ATTR_NOT_SPECIFIED \u003d\u003d object() and therefore !\u003d None.\n\nHow could the condition be satisfied if attribute_name key is not set?","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8ae72962202c7fcc9425e5c4f499746aa8659a0b","unresolved":false,"context_lines":[{"line_number":67,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target):"},{"line_number":68,"context_line":"    \"\"\"Verify that an attribute is present and has a non-default value\"\"\""},{"line_number":69,"context_line":"    if (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":70,"context_line":"        attribute_name in target and"},{"line_number":71,"context_line":"        target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED):"},{"line_number":72,"context_line":"        if (target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]):"},{"line_number":73,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fko0%3D","line":70,"in_reply_to":"AAAAM3%2F%2FkrY%3D","updated":"2013-01-15 19:31:38.000000000","message":"Should have had my coffee prior to reviewing.  You can do this without conditionals:\n\ndef _is_attribute_explicitly_set(attribute_name, resource, target):\n    return (\n        \u0027default\u0027 in resource[attribute_name] and\n        attribute_name in target and\n        target[attribute_name] not in attributes.ATTR_NOT_SPECIFIED and\n        target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]\n    )","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":67,"context_line":"def _is_attribute_explicitly_set(attribute_name, resource, target):"},{"line_number":68,"context_line":"    \"\"\"Verify that an attribute is present and has a non-default value\"\"\""},{"line_number":69,"context_line":"    if (\u0027default\u0027 in resource[attribute_name] and"},{"line_number":70,"context_line":"        attribute_name in target and"},{"line_number":71,"context_line":"        target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED):"},{"line_number":72,"context_line":"        if (target[attribute_name] !\u003d resource[attribute_name][\u0027default\u0027]):"},{"line_number":73,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FkrY%3D","line":70,"in_reply_to":"AAAAM3%2F%2FktE%3D","updated":"2013-01-15 15:59:59.000000000","message":"This would be a problem if the attribute_name is not set and it will satisfy the condition which differs from the original logic","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"}],"quantum/tests/unit/db/loadbalancer/test_db_loadbalancer.py":[{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"change_message_id":"a28848987d0792f65bfc625592241e6e38139f0f","unresolved":false,"context_lines":[{"line_number":24,"context_line":"from quantum.api.extensions import PluginAwareExtensionManager"},{"line_number":25,"context_line":"from quantum.api.extensions import ExtensionMiddleware"},{"line_number":26,"context_line":"from quantum.api.v2 import attributes"},{"line_number":27,"context_line":"from quantum.api.v2.attributes import ATTR_NOT_SPECIFIED"},{"line_number":28,"context_line":"from quantum.api.v2.router import APIRouter"},{"line_number":29,"context_line":"from quantum.common import config"},{"line_number":30,"context_line":"from quantum.common import exceptions as q_exc"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FlHA%3D","side":"PARENT","line":27,"updated":"2013-01-15 06:06:02.000000000","message":"This is not used.","commit_id":"98b05bc5d8b42e6ddc12b363f38cb9d37e94add6"}],"quantum/tests/unit/test_db_plugin.py":[{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8ae72962202c7fcc9425e5c4f499746aa8659a0b","unresolved":false,"context_lines":[{"line_number":249,"context_line":"            if arg in kwargs and kwargs[arg] is not None:"},{"line_number":250,"context_line":"                data[\u0027subnet\u0027][arg] \u003d kwargs[arg]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        if (\u0027gateway_ip\u0027 in kwargs and"},{"line_number":253,"context_line":"            kwargs[\u0027gateway_ip\u0027] is not ATTR_NOT_SPECIFIED):"},{"line_number":254,"context_line":"            data[\u0027subnet\u0027][\u0027gateway_ip\u0027] \u003d kwargs[\u0027gateway_ip\u0027]"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FktI%3D","line":252,"updated":"2013-01-15 15:47:22.000000000","message":"This can be simplified:\n\nif kwargs.get(\u0027gateway_ip\u0027) is not ATTR_NOT_SPECIFIED:","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8ae72962202c7fcc9425e5c4f499746aa8659a0b","unresolved":false,"context_lines":[{"line_number":249,"context_line":"            if arg in kwargs and kwargs[arg] is not None:"},{"line_number":250,"context_line":"                data[\u0027subnet\u0027][arg] \u003d kwargs[arg]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        if (\u0027gateway_ip\u0027 in kwargs and"},{"line_number":253,"context_line":"            kwargs[\u0027gateway_ip\u0027] is not ATTR_NOT_SPECIFIED):"},{"line_number":254,"context_line":"            data[\u0027subnet\u0027][\u0027gateway_ip\u0027] \u003d kwargs[\u0027gateway_ip\u0027]"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2Fkpo%3D","line":252,"in_reply_to":"AAAAM3%2F%2FkrM%3D","updated":"2013-01-15 19:31:38.000000000","message":"Next time I\u0027m going drink my morning coffee before reviewing.","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":249,"context_line":"            if arg in kwargs and kwargs[arg] is not None:"},{"line_number":250,"context_line":"                data[\u0027subnet\u0027][arg] \u003d kwargs[arg]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        if (\u0027gateway_ip\u0027 in kwargs and"},{"line_number":253,"context_line":"            kwargs[\u0027gateway_ip\u0027] is not ATTR_NOT_SPECIFIED):"},{"line_number":254,"context_line":"            data[\u0027subnet\u0027][\u0027gateway_ip\u0027] \u003d kwargs[\u0027gateway_ip\u0027]"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FkrM%3D","line":252,"in_reply_to":"AAAAM3%2F%2FktI%3D","updated":"2013-01-15 15:59:59.000000000","message":"This is also different from the original logic when \u0027gateway_ip\u0027 is not set in kwargs","commit_id":"00c9a6cc2db22d29e4d7240b96a95ba9a800bc98"}]}
