)]}'
{"nova/scheduler/request_filter.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"ce1698c2bdc28fbd5e7de0042e1e48f145ed212e","unresolved":false,"context_lines":[{"line_number":166,"context_line":"    request_spec.flavor.extra_specs[\u0027trait:%s\u0027 % trait_name] \u003d \u0027required\u0027"},{"line_number":167,"context_line":"    request_spec.obj_reset_changes(fields\u003d[\u0027flavor\u0027], recursive\u003dTrue)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"class Transform(object):"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def __call__(self, request_spec):"},{"line_number":172,"context_line":"        return request_spec.obj_clone()"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_405feb0d","line":169,"updated":"2019-06-18 22:50:28.000000000","message":"This is all very clever... and way more complicated than it needs to be.\n\nI think it\u0027s important to make explicit individual methods and entries in ALL_REQUEST_FILTERS for each filter so that the results of @trace_request_filter are scrutable.\n\nAnd you can DRY the common logic in a (single, linear) helper method.\n\nTAJ (This Ain\u0027t Java).","commit_id":"29831229464ced88c576816fec0f9895352270b3"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"530ee556a07012747601e2cc89cfee10ebb59f8e","unresolved":false,"context_lines":[{"line_number":166,"context_line":"    request_spec.flavor.extra_specs[\u0027trait:%s\u0027 % trait_name] \u003d \u0027required\u0027"},{"line_number":167,"context_line":"    request_spec.obj_reset_changes(fields\u003d[\u0027flavor\u0027], recursive\u003dTrue)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"class Transform(object):"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def __call__(self, request_spec):"},{"line_number":172,"context_line":"        return request_spec.obj_clone()"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_35b8cee3","line":169,"in_reply_to":"9fb8cfa7_0a36c9e8","updated":"2019-06-20 17:51:36.000000000","message":"I\u0027m delighted at the idea of better organization in anticipation of the number of filters getting big, because I agree that\u0027s going to happen.\n\nI\u0027m also a fan of keeping the code as DRY as practical - but not at the expense of readability. As written, figuring out what the main loop at L220 does is an unnecessary amount of exercise. IMO everything in L169-203 could be in a single helper method that you call once for each model.","commit_id":"29831229464ced88c576816fec0f9895352270b3"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"57112ffd4998560cded696a0f8c8444ff5365c09","unresolved":false,"context_lines":[{"line_number":166,"context_line":"    request_spec.flavor.extra_specs[\u0027trait:%s\u0027 % trait_name] \u003d \u0027required\u0027"},{"line_number":167,"context_line":"    request_spec.obj_reset_changes(fields\u003d[\u0027flavor\u0027], recursive\u003dTrue)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"class Transform(object):"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def __call__(self, request_spec):"},{"line_number":172,"context_line":"        return request_spec.obj_clone()"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_f06324dc","line":169,"in_reply_to":"9fb8cfa7_35b8cee3","updated":"2019-06-20 18:45:25.000000000","message":"I agree with Eric.","commit_id":"29831229464ced88c576816fec0f9895352270b3"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e96afaea7ee58d253437c6d8401cec2e0114cbd1","unresolved":false,"context_lines":[{"line_number":166,"context_line":"    request_spec.flavor.extra_specs[\u0027trait:%s\u0027 % trait_name] \u003d \u0027required\u0027"},{"line_number":167,"context_line":"    request_spec.obj_reset_changes(fields\u003d[\u0027flavor\u0027], recursive\u003dTrue)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"class Transform(object):"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def __call__(self, request_spec):"},{"line_number":172,"context_line":"        return request_spec.obj_clone()"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_0a36c9e8","line":169,"in_reply_to":"9fb8cfa7_405feb0d","updated":"2019-06-20 16:37:06.000000000","message":"its not but i really dont like just haveing free function in this module as i see this endup like the nova/virt/hardware.py file if we are not carful where its imposibel to follow.\n\ni was actully thinking of moveing this into a different modle and having one module per prefilter.\n\nso we would have a new directory with one file/module per request filters like we have with the scheduler filters.\n\nso this was a v0 in taking a step back and thinking about how we will maintain this over time as we will likely be adding a lot of prefilters and i want to avoid having file that are 10000 lines long like the libvirt driver.\n\nim mainly using the fuctors for two things\none scoping the function so that people are not tempted to miss use tehm and second following DRY so that each transfrom it pretty tiny.\n\nthe other thing is i am writing this to be really eaisily testable to so there are not unexpect sideffect like modifying the imput and retrunting a status code which is very c like.\n\neach transform takes a request specs as an input, create a copy and return the updated version so its a pure function with no side effect so its trivail to assert it does the right thing.\n\nthe transform_image_metadata function handles all the contol flow and only has side effects.\nif people prefer just free function i can definetly do that but i really think wwe should not just dump them all in this one file.","commit_id":"29831229464ced88c576816fec0f9895352270b3"}]}
