)]}'
{"openstack/resource.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"05a07c53617b770448b704236d47b71dc100fc43","unresolved":false,"context_lines":[{"line_number":1460,"context_line":"                    id\u003dname_or_id,"},{"line_number":1461,"context_line":"                    connection\u003dsession._get_connection(),"},{"line_number":1462,"context_line":"                    **params)"},{"line_number":1463,"context_line":"                return match.fetch(session)"},{"line_number":1464,"context_line":"            else:"},{"line_number":1465,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1466,"context_line":"        except exceptions.NotFoundException:"}],"source_content_type":"text/x-python","patch_set":2,"id":"9fdfeff1_1112960a","line":1463,"updated":"2019-02-20 15:23:47.000000000","message":"Should we account for the case when a name can look like UUID?","commit_id":"5e2affa76a967bbee21fd295f043908aecd32c36"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"534beaeb622a460dc7618883f217f9958ef4bb86","unresolved":false,"context_lines":[{"line_number":1460,"context_line":"                    id\u003dname_or_id,"},{"line_number":1461,"context_line":"                    connection\u003dsession._get_connection(),"},{"line_number":1462,"context_line":"                    **params)"},{"line_number":1463,"context_line":"                return match.fetch(session)"},{"line_number":1464,"context_line":"            else:"},{"line_number":1465,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1466,"context_line":"        except exceptions.NotFoundException:"}],"source_content_type":"text/x-python","patch_set":2,"id":"9fdfeff1_ac67b1ea","line":1463,"in_reply_to":"9fdfeff1_1112960a","updated":"2019-02-20 17:08:43.000000000","message":"This is corner case but a valid one.\n\nIf the strange case the name looks like a UUID, the call will return a NotFoundException exception and then the former path will be followed:\n- Retrieve the list of registers.\n- Filter manually _get_one_match\n\nAs I said, this is a corner case where the function will return the same value but without the optimization.","commit_id":"5e2affa76a967bbee21fd295f043908aecd32c36"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"05a07c53617b770448b704236d47b71dc100fc43","unresolved":false,"context_lines":[{"line_number":1462,"context_line":"                    **params)"},{"line_number":1463,"context_line":"                return match.fetch(session)"},{"line_number":1464,"context_line":"            else:"},{"line_number":1465,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1466,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1467,"context_line":"            pass"},{"line_number":1468,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9fdfeff1_b1f62ad8","line":1465,"updated":"2019-02-20 15:23:47.000000000","message":".. if we do, this should be moved outside of the try..except block","commit_id":"5e2affa76a967bbee21fd295f043908aecd32c36"},{"author":{"_account_id":27900,"name":"Artem Goncharov","email":"artem.goncharov@gmail.com","username":"gtema"},"change_message_id":"8a3a149d36c9c30a196ba4ed5c8ac9567782b095","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_ecf6f0d8","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"updated":"2019-02-22 08:59:30.000000000","message":"let us ensure, that \u0027name\u0027 is an accepted query parameter first. Not each resource has name at all, and in some crazy cases we might even get an error from API due to that","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"e4ff1b9fb9e7eff411d5412d985c86462e6a7a9e","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_f024470f","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"in_reply_to":"9fdfeff1_01be7164","updated":"2019-02-26 09:13:55.000000000","message":"Sorry but I don\u0027t understand this suggestion:\n1) **params variable is untouched apart from the \"name\" parameter. I only add/delete the \"name\" key.\n2) This test you point out in your comment is already done in cl.list() [1]. I don\u0027t need to add this check because this validation is present in the \"list\" method.\n\n[1] https://github.com/openstack/openstacksdk/blob/master/openstack/resource.py#L1335","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"},{"author":{"_account_id":27900,"name":"Artem Goncharov","email":"artem.goncharov@gmail.com","username":"gtema"},"change_message_id":"9651b90b72b4bc470a5630babb0bdb6546d91d83","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_01be7164","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"in_reply_to":"9fdfeff1_0e0a23d1","updated":"2019-02-25 17:53:39.000000000","message":"You are right, that we would get an exception from QueryParameters._validate. But is it better to introduce a retry mechanism instead of 2 simple lines:\n```\n        if \u0027name\u0027 in cls._query_mapping._mapping:\n            params[\u0027name\u0027] \u003d name_or_id\n```\nThis is especially the case, when **params contain additional attiributes","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"24728567715628e7948773e0ad392772cedace2a","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_0e0a23d1","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"in_reply_to":"9fdfeff1_23896625","updated":"2019-02-25 14:11:23.000000000","message":"1) First we validate the query in QueryParameters._validate(). If the parameter is not accepted, we\u0027ll receive a InvalidResourceQuery exception. If \"name_or_id\" is for an object (DB table) without name as a parameter, we\u0027ll try always first L1458 because utils.is_uuid_like(name_or_id) will be True. OSSDK won\u0027t query using \"name\" if this argument is not supported.\nSorry, but I don\u0027t see the problem here. Am I missing something?\n\n2) That\u0027s the point: we don\u0027t query using \"name\" if this parameter is not supported. If \"name\" is not supported that means \"name_or_id\" is an ID (UUID formatted) and L1457 will be executed. With \"cls.existing\" we can expect two results: the value or 404, but this is not handled by this function.","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"},{"author":{"_account_id":27900,"name":"Artem Goncharov","email":"artem.goncharov@gmail.com","username":"gtema"},"change_message_id":"2c63e8f43e329d3ace36dc43457f81a1ee596041","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_23896625","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"in_reply_to":"9fdfeff1_a372367b","updated":"2019-02-22 11:14:59.000000000","message":"ah, that\u0027s why an except is here. Well, to be honest I am not sure:\n- we get 404 if query argument is not supported (can be nearly anything from 4xx)\n- it is better to fire unnecessary request when we can identify in advance whether it will bring something. I see lot of resources not supporting name. Do we really want this inefficiency?","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"a99ebdc930e565fe681f0af99ee35a3638ad32e4","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_a372367b","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"in_reply_to":"9fdfeff1_ecf6f0d8","updated":"2019-02-22 11:05:55.000000000","message":"Yes, of course. That\u0027s why I defined the exception catch in L1470. If name is not accepted, a InvalidResourceQuery will be raised. Then the same query without name is executed again.","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"},{"author":{"_account_id":27900,"name":"Artem Goncharov","email":"artem.goncharov@gmail.com","username":"gtema"},"change_message_id":"00c34184d40df4f2af4d92cfdc54472fe31601a4","unresolved":false,"context_lines":[{"line_number":1461,"context_line":"                    **params)"},{"line_number":1462,"context_line":"                return match.fetch(session)"},{"line_number":1463,"context_line":"            else:"},{"line_number":1464,"context_line":"                params[\u0027name\u0027] \u003d name_or_id"},{"line_number":1465,"context_line":"        except exceptions.NotFoundException:"},{"line_number":1466,"context_line":"            pass"},{"line_number":1467,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9fdfeff1_504c339d","line":1464,"range":{"start_line":1464,"start_character":0,"end_line":1464,"end_character":16},"in_reply_to":"9fdfeff1_f024470f","updated":"2019-02-26 09:25:41.000000000","message":"what I mean is that instead of introducing new try/catch block for handling InvalidResourceQuery exeption (with a fallback) you can simply check, whether name is an accepted QueryParameter and add it if it is. This would be much more readable from my POV.","commit_id":"fee0ded8ba84e8cb81ef92bc8e76e6bbc0092f96"}],"openstack/tests/unit/test_resource.py":[{"author":{"_account_id":27900,"name":"Artem Goncharov","email":"artem.goncharov@gmail.com","username":"gtema"},"change_message_id":"cf10a292f86727f7dbe3a4ac0284bf0baf8f4194","unresolved":false,"context_lines":[{"line_number":2152,"context_line":"                                                  connection\u003dmock.ANY)"},{"line_number":2153,"context_line":"            mock_list.assert_called_once_with(mock.ANY)"},{"line_number":2154,"context_line":""},{"line_number":2155,"context_line":"    def _restore_query_mapping(self, resource, query_mapping):"},{"line_number":2156,"context_line":"        resource._query_mapping \u003d query_mapping"},{"line_number":2157,"context_line":""},{"line_number":2158,"context_line":"    def test_find_result_name_in_query_parameters(self):"}],"source_content_type":"text/x-python","patch_set":18,"id":"3fce034c_ae00c568","line":2155,"updated":"2019-04-17 09:27:07.000000000","message":"let us probably better to define one more internal class (inherit from OneResult and add QueryParam) instead of modifying the one potentially used in other tests during parallel testing","commit_id":"bc6a2053dfa6b470faac3259ee81f6371a64151f"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"5598ba782ab838eedf466efd01329a1863fc81b0","unresolved":false,"context_lines":[{"line_number":2152,"context_line":"                                                  connection\u003dmock.ANY)"},{"line_number":2153,"context_line":"            mock_list.assert_called_once_with(mock.ANY)"},{"line_number":2154,"context_line":""},{"line_number":2155,"context_line":"    def _restore_query_mapping(self, resource, query_mapping):"},{"line_number":2156,"context_line":"        resource._query_mapping \u003d query_mapping"},{"line_number":2157,"context_line":""},{"line_number":2158,"context_line":"    def test_find_result_name_in_query_parameters(self):"}],"source_content_type":"text/x-python","patch_set":18,"id":"3fce034c_5700bbab","line":2155,"in_reply_to":"3fce034c_ae00c568","updated":"2019-04-18 09:40:45.000000000","message":"It won\u0027t affect to other tests because those are executed in other contexts, but it makes sense to create another class for this. I always prefer to create something like a fixture instead of mocking.","commit_id":"bc6a2053dfa6b470faac3259ee81f6371a64151f"}],"requirements.txt":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"05a07c53617b770448b704236d47b71dc100fc43","unresolved":false,"context_lines":[{"line_number":8,"context_line":"jsonpatch!\u003d1.20,\u003e\u003d1.16 # BSD"},{"line_number":9,"context_line":"six\u003e\u003d1.10.0 # MIT"},{"line_number":10,"context_line":"os-service-types\u003e\u003d1.2.0 # Apache-2.0"},{"line_number":11,"context_line":"oslo.utils\u003e\u003d3.33.0 # Apache-2.0"},{"line_number":12,"context_line":"keystoneauth1\u003e\u003d3.11.0 # Apache-2.0"},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"munch\u003e\u003d2.1.0 # MIT"}],"source_content_type":"text/plain","patch_set":2,"id":"9fdfeff1_f10cb2ed","line":11,"updated":"2019-02-20 15:23:47.000000000","message":"Let us not introduce a new requirement for like 10 lines of trivial code: https://github.com/openstack/oslo.utils/blob/master/oslo_utils/uuidutils.py","commit_id":"5e2affa76a967bbee21fd295f043908aecd32c36"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"534beaeb622a460dc7618883f217f9958ef4bb86","unresolved":false,"context_lines":[{"line_number":8,"context_line":"jsonpatch!\u003d1.20,\u003e\u003d1.16 # BSD"},{"line_number":9,"context_line":"six\u003e\u003d1.10.0 # MIT"},{"line_number":10,"context_line":"os-service-types\u003e\u003d1.2.0 # Apache-2.0"},{"line_number":11,"context_line":"oslo.utils\u003e\u003d3.33.0 # Apache-2.0"},{"line_number":12,"context_line":"keystoneauth1\u003e\u003d3.11.0 # Apache-2.0"},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"munch\u003e\u003d2.1.0 # MIT"}],"source_content_type":"text/plain","patch_set":2,"id":"9fdfeff1_b75dba49","line":11,"in_reply_to":"9fdfeff1_f10cb2ed","updated":"2019-02-20 17:08:43.000000000","message":"As discussed in IRC, I\u0027ll implement in this repo the needed functions.","commit_id":"5e2affa76a967bbee21fd295f043908aecd32c36"}]}
