)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"65d79243a3a694a983d597221c64d7c025aca1de","unresolved":false,"context_lines":[{"line_number":10,"context_line":"DRY out the ListObjects into common code makes it pretty"},{"line_number":11,"context_line":"clear that the ListObjects, at least in some cases, are not"},{"line_number":12,"context_line":"really doing all that much and using simple Python lists"},{"line_number":13,"context_line":"works just fine."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This change move UsageList and Usage into their own file"},{"line_number":16,"context_line":"and makes the query methods on UsageList module level, and"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9fdfeff1_c1e337d7","line":13,"updated":"2019-02-28 15:24:07.000000000","message":"yup.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3861ac7bc11e93a03a6dde0781ff4e147c46ac0e","unresolved":false,"context_lines":[{"line_number":12,"context_line":"really doing all that much and using simple Python lists"},{"line_number":13,"context_line":"works just fine."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This change moves Usage into its own own file, deletes UsageList,"},{"line_number":16,"context_line":"and makes the get_all* query methods on UsageList module level"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"The unit and functional tests related to Usage* are moved into"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fdfeff1_3956f35d","line":15,"range":{"start_line":15,"start_character":33,"end_line":15,"end_character":36},"updated":"2019-02-28 17:26:23.000000000","message":"x","commit_id":"bef49b7fcf93fb5770ee1b82083aeb798dfde376"}],"placement/handlers/usage.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from placement.i18n import _"},{"line_number":21,"context_line":"from placement import microversion"},{"line_number":22,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":23,"context_line":"from placement.objects import usage as usage_list"},{"line_number":24,"context_line":"from placement.policies import usage as policies"},{"line_number":25,"context_line":"from placement.schemas import usage as schema"},{"line_number":26,"context_line":"from placement import util"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_07abc5d5","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":49},"updated":"2019-02-26 20:24:01.000000000","message":"This is icky; the import should be called \u0027usage\u0027. The \u0027all\u0027 in the method name implies we\u0027re getting multiple thingies. usage_list.get_all_* implies we\u0027re getting all the lists, wrapped in some larger data structure (another list? a dict? who knows?)\n\nLooking closer, I can see that the existing code follows the same icky pattern (UsageList.get_all_*). It\u0027s just as bad there.\n\n[Later] This would also be made clearer by get_all_* being @classmethod.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"011e66f1c5cf0c326f0f8ef48aaadb7fafff07ad","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from placement.i18n import _"},{"line_number":21,"context_line":"from placement import microversion"},{"line_number":22,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":23,"context_line":"from placement.objects import usage as usage_list"},{"line_number":24,"context_line":"from placement.policies import usage as policies"},{"line_number":25,"context_line":"from placement.schemas import usage as schema"},{"line_number":26,"context_line":"from placement import util"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_e7ca414d","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":49},"in_reply_to":"9fdfeff1_07abc5d5","updated":"2019-02-26 20:48:50.000000000","message":"I agree that the naming is messed up. I was doing the hasty thing to avoid too many changes. In this case there was already a \u0027usage\u0027 in scope and I wanted to keep the diff small, at least initially.\n\nIf we follow through on this than using better names throughout would be good, I agree.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"10e407f8740f77a1fbc80dbbc9d682283b2ada12","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from placement.i18n import _"},{"line_number":21,"context_line":"from placement import microversion"},{"line_number":22,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":23,"context_line":"from placement.objects import usage as usage_list"},{"line_number":24,"context_line":"from placement.policies import usage as policies"},{"line_number":25,"context_line":"from placement.schemas import usage as schema"},{"line_number":26,"context_line":"from placement import util"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_3a005c66","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":49},"in_reply_to":"9fdfeff1_27b3699c","updated":"2019-02-26 21:53:31.000000000","message":"I went to use usage_obj and then strayed away because my mind was in a \"we are making less objects\"","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"65d79243a3a694a983d597221c64d7c025aca1de","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from placement.i18n import _"},{"line_number":21,"context_line":"from placement import microversion"},{"line_number":22,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":23,"context_line":"from placement.objects import usage as usage_list"},{"line_number":24,"context_line":"from placement.policies import usage as policies"},{"line_number":25,"context_line":"from placement.schemas import usage as schema"},{"line_number":26,"context_line":"from placement import util"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_813f6f23","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":49},"in_reply_to":"9fdfeff1_3a005c66","updated":"2019-02-28 15:24:07.000000000","message":"I think usage_obj is appropriate (and consistent with the other model imports)","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3ab39ca1f280ac01ae84822e71e18382313f3df1","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from placement.i18n import _"},{"line_number":21,"context_line":"from placement import microversion"},{"line_number":22,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":23,"context_line":"from placement.objects import usage as usage_list"},{"line_number":24,"context_line":"from placement.policies import usage as policies"},{"line_number":25,"context_line":"from placement.schemas import usage as schema"},{"line_number":26,"context_line":"from placement import util"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_5dc67a18","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":49},"in_reply_to":"9fdfeff1_3a005c66","updated":"2019-02-26 22:41:22.000000000","message":"The usage module contains and is centered around the Usage object. We\u0027re not turning Usage into a dict or something.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"0af34c902a26ed37b582f480a3374bfb14971637","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from placement.i18n import _"},{"line_number":21,"context_line":"from placement import microversion"},{"line_number":22,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":23,"context_line":"from placement.objects import usage as usage_list"},{"line_number":24,"context_line":"from placement.policies import usage as policies"},{"line_number":25,"context_line":"from placement.schemas import usage as schema"},{"line_number":26,"context_line":"from placement import util"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_27b3699c","line":23,"range":{"start_line":23,"start_character":39,"end_line":23,"end_character":49},"in_reply_to":"9fdfeff1_e7ca414d","updated":"2019-02-26 21:07:10.000000000","message":"Oh, gotcha, because we have variables named \u0027usage\u0027 in this module. So usage_obj would be appropriate, following rp_obj. And usage_obj.get_all_* (or usage_obj.Usage.get_all_*) reads naturally (to me).","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4feacd629ea38015a720d580f240acbdb04b208a","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            _(\"No resource provider with uuid %(uuid)s found: %(error)s\") %"},{"line_number":63,"context_line":"             {\u0027uuid\u0027: uuid, \u0027error\u0027: exc})"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    usage \u003d usage_list.get_all_by_resource_provider_uuid("},{"line_number":66,"context_line":"        context, uuid)"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    response \u003d req.response"},{"line_number":69,"context_line":"    response.body \u003d encodeutils.to_utf8(jsonutils.dumps("}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_0bbdded6","line":66,"range":{"start_line":65,"start_character":0,"end_line":66,"end_character":22},"updated":"2019-02-28 14:21:43.000000000","message":"This should be on one line.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9165c05e9731a0de175b22922c486d525eac3081","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            _(\"No resource provider with uuid %(uuid)s found: %(error)s\") %"},{"line_number":63,"context_line":"             {\u0027uuid\u0027: uuid, \u0027error\u0027: exc})"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    usage \u003d usage_list.get_all_by_resource_provider_uuid("},{"line_number":66,"context_line":"        context, uuid)"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    response \u003d req.response"},{"line_number":69,"context_line":"    response.body \u003d encodeutils.to_utf8(jsonutils.dumps("}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_467d1db0","line":66,"range":{"start_line":65,"start_character":0,"end_line":66,"end_character":22},"in_reply_to":"9fdfeff1_0bbdded6","updated":"2019-02-28 15:00:35.000000000","message":"Yeah, that\u0027s an artifact of quick and dirty","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4feacd629ea38015a720d580f240acbdb04b208a","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    user_id \u003d req.GET.get(\u0027user_id\u0027)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    usages \u003d usage_list.get_all_by_project_user(context, project_id,"},{"line_number":106,"context_line":"                                                      user_id\u003duser_id)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    response \u003d req.response"},{"line_number":109,"context_line":"    usages_dict \u003d {\u0027usages\u0027: {resource.resource_class: resource.usage"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_cbb27606","line":106,"range":{"start_line":106,"start_character":47,"end_line":106,"end_character":53},"updated":"2019-02-28 14:21:43.000000000","message":"ick ick ick","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9165c05e9731a0de175b22922c486d525eac3081","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    user_id \u003d req.GET.get(\u0027user_id\u0027)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    usages \u003d usage_list.get_all_by_project_user(context, project_id,"},{"line_number":106,"context_line":"                                                      user_id\u003duser_id)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    response \u003d req.response"},{"line_number":109,"context_line":"    usages_dict \u003d {\u0027usages\u0027: {resource.resource_class: resource.usage"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_26501932","line":106,"range":{"start_line":106,"start_character":47,"end_line":106,"end_character":53},"in_reply_to":"9fdfeff1_cbb27606","updated":"2019-02-28 15:00:35.000000000","message":"same","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"}],"placement/objects/usage.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":18,"context_line":"from placement.objects import resource_provider"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":22,"context_line":"def _get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":23,"context_line":"    query \u003d (context.session.query(models.Inventory.resource_class_id,"},{"line_number":24,"context_line":"             func.coalesce(func.sum(models.Allocation.used), 0))"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_e772417c","line":21,"updated":"2019-02-26 20:24:01.000000000","message":"How come these aren\u0027t inline in the public methods? Are we really saving something by creating the return values outside of the db context?","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"0af34c902a26ed37b582f480a3374bfb14971637","unresolved":false,"context_lines":[{"line_number":18,"context_line":"from placement.objects import resource_provider"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":22,"context_line":"def _get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":23,"context_line":"    query \u003d (context.session.query(models.Inventory.resource_class_id,"},{"line_number":24,"context_line":"             func.coalesce(func.sum(models.Allocation.used), 0))"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_a7a67953","line":21,"in_reply_to":"9fdfeff1_27fb697b","updated":"2019-02-26 21:07:10.000000000","message":"Minimal change ++, please read my comment as, \"can we refactor it as XXX in a subsequent change or is there some reason it needs to stay like this?\"","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"011e66f1c5cf0c326f0f8ef48aaadb7fafff07ad","unresolved":false,"context_lines":[{"line_number":18,"context_line":"from placement.objects import resource_provider"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":22,"context_line":"def _get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":23,"context_line":"    query \u003d (context.session.query(models.Inventory.resource_class_id,"},{"line_number":24,"context_line":"             func.coalesce(func.sum(models.Allocation.used), 0))"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_27fb697b","line":21,"in_reply_to":"9fdfeff1_e772417c","updated":"2019-02-26 20:48:50.000000000","message":"This is a straight copy of the existing code, dedented. Again, to minimize the change (even though here it all looks like change because it is a new file and the dedent).\n\nIn the original code it was simply sort of the standard that emerged both in placement code and in nova code that didn\u0027t punt db calls over to the the db package hierarchy.\n\nI suspect that at some point it helped to make things easier to mock without needing to fake the database stuff. That\u0027s not a concern for us in the placement context where we use functional tests all the time, but in nova, perhaps it was.\n\nSo it stuck around, and, as above as well as earlier in the ovo-ectomy, limited change, for now.\n\nThat said, I\u0027m a fan of many and small methods...","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_c75b7d1f","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"updated":"2019-02-26 20:24:01.000000000","message":"Since these reference Usage, they should be @classmethod. That\u0027s what it exists for.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"10e407f8740f77a1fbc80dbbc9d682283b2ada12","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_fa8414b3","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_0773c5e8","updated":"2019-02-26 21:53:31.000000000","message":"Oh. I get you.\n\nYeah, no, let\u0027s not do that. That is very java. The hope here (from my standpoint and I think Jay\u0027s as well) was to minimize the false impression of OO and do things in the most pythonic way.\n\nI suspect I\u0027m further along on the spectrum. I think we should avoid using classes unless we absolutely have to or there is an already established local pattern.\n\nHowever, in this case what I\u0027m doing here is extrapolating from jay\u0027s comments at: https://review.openstack.org/#/c/636694/4/placement/objects/resource_provider.py@2083","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"1edf53d0bd1e163bed76242fc13493a7fb041539","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_5c0f532d","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_1db3129c","updated":"2019-02-27 09:25:43.000000000","message":"I think what this difference of opinion comes down to is whether having classmethodS is a thing we like or not. I don\u0027t.\n\nThe natural encapsulation of functionality in what I deem (and others disagree and that\u0027s good because it\u0027s at the interface of those differences where we come up with reasonable solutions) to be \"good\" python is the module, in part because it makes for small modules, but there are other reasons too.\n\nThat said, objects are still useful  a data encapsulators. So in this case, the Usage object is a worthwhile container of a thing called a usage. A tuple or dict would probably be workable too, but things like casting usage to an int or translating a resource_class_id to a resource_class string, during construction would be annoying.\n\nBut, there\u0027s no need (to me, tbc) to make getting or creating a list of those objects be on the object because we\u0027re already in a package called \"usage\".\n\nThe model being pursued here is essentially: plain old data objects for items, module methods to manipulate them. I seem to recall Jay liking that model too but I may be misremembering, we\u0027ll get him in here at some point.\n\nLike you, I\u0027m not wed to this enough to fall on my sword for it, but I do think it gets us two things that I think we want:\n\n* small modules\n* the important parts of those modules being all the way to the left","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4feacd629ea38015a720d580f240acbdb04b208a","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_ebe97a7e","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_5c0f532d","updated":"2019-02-28 14:21:43.000000000","message":"My 2¢:\n\nWe\u0027re in the `objects/usage` module. So we\u0027re already pretty object-y. So keeping things non-object-y isn\u0027t a persuasive argument.\n\nIf the goal is to do something that returns a bunch of Usage objects, I really don\u0027t like using classmethods like Usage.get_all...(). As you said, that\u0027s a very Java factory approach, and is overkill. Ideally they should be in the db layer, but making them module methods in this layer is OK.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"65d79243a3a694a983d597221c64d7c025aca1de","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_c1b49784","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_612dab8d","updated":"2019-02-28 15:24:07.000000000","message":"\u003e I kind of thing that the end game of all this change is that the\n \u003e directory name will seem entirely wrong. All this stuff is, really,\n \u003e is a shim between the handlers and persistence layer\n \u003e \n \u003e but we don\u0027t have a real separate persistence layer, so...\n \u003e \n \u003e But maybe we\u0027ll get there someday, at which point we\u0027ll swap in the\n \u003e graph db implementation :D\n\nack, yeah, I feel the same (that eventually we will see the \"objects\" directory as misnamed.\n\nRegardless of whether a graph DB backend is eventually an option, I guess I just prefer the non-Java-y calling structure of:\n\n from placement.objects import usage\n ...\n usage_objs \u003d usage.get_all_by_XXX()\n\nor, perhaps eventually:\n\n from placement.model import usage\n ...\n usages \u003d usage.get_all_by_XXX()\n\n\ninstead of:\n\n from placement.objects import usage\n ...\n usage_objs \u003d usage.Usage.get_all_by_XXX()\n\nat the end of the day, it\u0027s a preference, though, and I\u0027m certainly not going to cry myself to sleep worrying about it one way or the other.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"0af34c902a26ed37b582f480a3374bfb14971637","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_0773c5e8","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_a7ee79b2","updated":"2019-02-26 21:07:10.000000000","message":"Right, maybe I\u0027m being too Java-y, but these are \"factory methods\" producing lists of the class in question, so they should be\n\n class Usage(object):\n     ...\n     @classmethod\n     def get_all_whatever(cls, ...):\n         ...\n         return [cls(...) for ...]\n\nI get Jay\u0027s gripe about @staticmethod. I prefer methods which are \"about\" a class being @staticmethodZ in that class. I don\u0027t feel as strongly as Jay does in the other direction. But I do feel pretty strongly about using @classmethod where appropriate, as here.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"011e66f1c5cf0c326f0f8ef48aaadb7fafff07ad","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_a7ee79b2","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_c75b7d1f","updated":"2019-02-26 20:48:50.000000000","message":"Which \"they\" do you mean? get_all_by_project_user is not in a class? And we are constructing individual Usage items in a python list.\n\nAm I missing the point or are you misreading the code?","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9165c05e9731a0de175b22922c486d525eac3081","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_612dab8d","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_ebe97a7e","updated":"2019-02-28 15:00:35.000000000","message":"I kind of thing that the end game of all this change is that the directory name will seem entirely wrong. All this stuff is, really, is a shim between the handlers and persistence layer\n\nbut we don\u0027t have a real separate persistence layer, so...\n\nBut maybe we\u0027ll get there someday, at which point we\u0027ll swap in the graph db implementation :D","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3ab39ca1f280ac01ae84822e71e18382313f3df1","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    return result"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def get_all_by_resource_provider_uuid(context, rp_uuid):"},{"line_number":60,"context_line":"    usage_list \u003d _get_all_by_resource_provider_uuid(context, rp_uuid)"},{"line_number":61,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def get_all_by_project_user(context, project_id, user_id\u003dNone):"},{"line_number":65,"context_line":"    usage_list \u003d _get_all_by_project_user(context, project_id,"},{"line_number":66,"context_line":"                                          user_id\u003duser_id)"},{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_1db3129c","line":67,"range":{"start_line":59,"start_character":0,"end_line":67,"end_character":55},"in_reply_to":"9fdfeff1_fa8414b3","updated":"2019-02-26 22:41:22.000000000","message":"\u003e However, in this case what I\u0027m doing here is extrapolating from\n \u003e jay\u0027s comments at: https://review.openstack.org/#/c/636694/4/placement/objects/resource_provider.py@2083\n\nRight, extrapolation because he expresses disdain for @staticmethod, but doesn\u0027t mention @classmethod.\n\n \u003e Yeah, no, let\u0027s not do that. That is very java. The hope here (from\n \u003e my standpoint and I think Jay\u0027s as well) was to minimize the false\n \u003e impression of OO and do things in the most pythonic way.\n\nIt\u0027s not a false impression. We\u0027re keeping Usage, which inherits from `object`. It\u0027s not an oslo versioned object, but it\u0027s still an object.\n\n \u003e I suspect I\u0027m further along on the spectrum. I think we should\n \u003e avoid using classes unless we absolutely have to or there is an\n \u003e already established local pattern.\n\nAre you thinking we\u0027ll eventually get rid of Usage as a class and, like, make it a dict or a namedtuple or something? (Yeah, I guess I remember that being mentioned somewhere at some point.)\n\nWell, if you do, then I suppose we have to get rid of instance and class methods. But until then, it seems artificial to have what is naturally (to me, anyway??) a @classmethod moved to the module level.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_e73fa1b2","line":70,"updated":"2019-02-26 20:24:01.000000000","message":"Curious why this is last. My personal preference has always been to define things before they\u0027re referenced. (I recognize that the interpreter is still doing that; I mean for human reading.)\n\nBut thinking through the above, I may be convincing myself that it in fact makes more sense the other way around.\n\nSo, did you do this on purpose, and if so, for a good reason or just a preference, and if the former, what reason?","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"0af34c902a26ed37b582f480a3374bfb14971637","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_3a093c2a","line":70,"in_reply_to":"9fdfeff1_07698523","updated":"2019-02-26 21:07:10.000000000","message":"Okay, just curious. I have also tended to favor the order you cite, which is why it struck me as unusual to see this here. Since you\u0027re introducing this module, and it doesn\u0027t really matter what order things are cut-and-pasted, would you mind moving it to the top?","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"10e407f8740f77a1fbc80dbbc9d682283b2ada12","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_3ab85c73","line":70,"in_reply_to":"9fdfeff1_3a093c2a","updated":"2019-02-26 21:53:31.000000000","message":"I do not mind, not at all.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4feacd629ea38015a720d580f240acbdb04b208a","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_8b0eae38","line":70,"in_reply_to":"9fdfeff1_3ab85c73","updated":"2019-02-28 14:21:43.000000000","message":"My preference: I like to minimize scrolling when looking at a module, and prefer to have things that relate to each other grouped together. Alpha ordering is great for things like imports, and the classes within a module, but in all other cases I prefer a non-deterministic method that can be summarized as: when looking at some code that references another bit of code, maximize the possibility that that other bit of code will be visible without scrolling, or with the least amount of scrolling. \n\nThat said, I agree with Eric that you might as well move it to where it should be. We tend to get very obsessive about \"minimizing the diff\" in reviews, but since this is already all green...","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9165c05e9731a0de175b22922c486d525eac3081","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_61428b3d","line":70,"in_reply_to":"9fdfeff1_8b0eae38","updated":"2019-02-28 15:00:35.000000000","message":"omg, it\u0027s like I never put WIP in the commit message or something\n\nThis really was just a way of asking \"should we do this\", this is a proof of what it might look like. \n\nNot: here, I made a thing, it\u0027s done.\n\nSo, it seems like there\u0027s at least a vote from Ed and Eric of \"yeah, we should do [something like] this\". Is that accurate?","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"65d79243a3a694a983d597221c64d7c025aca1de","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_810e8f38","line":70,"in_reply_to":"9fdfeff1_e73fa1b2","updated":"2019-02-28 15:24:07.000000000","message":"\u003e Curious why this is last. My personal preference has always been to\n \u003e define things before they\u0027re referenced. (I recognize that the\n \u003e interpreter is still doing that; I mean for human reading.)\n \u003e \n \u003e But thinking through the above, I may be convincing myself that it\n \u003e in fact makes more sense the other way around.\n \u003e \n \u003e So, did you do this on purpose, and if so, for a good reason or\n \u003e just a preference, and if the former, what reason?\n\nProbably does make sense to define the plain-old-data object/struct at the top of the files.\n\nChris was just being consistent with the consumer/project/user.py files I think.\n\nThat said, probably good to have a single patch that just moves all that stuff around for all the broken-out placement/objects/*.py files in one style-only patch.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"011e66f1c5cf0c326f0f8ef48aaadb7fafff07ad","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    return [Usage(**db_item) for db_item in usage_list]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"class Usage(object):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_07698523","line":70,"in_reply_to":"9fdfeff1_e73fa1b2","updated":"2019-02-26 20:48:50.000000000","message":"No particular reason, this time around. I moved UsageList into this file first, then dedented it. Then I habitually ran the tests and realized oh yeah, need Usage too and copied it in. Since it was second it went at the end.\n\nI\u0027ve been pretty confused about ordering of methods in nova-originating code. I think it was Dan and Jay who had some fairly different ideas but had some compromises that they worked out and I mostly just followed their models to avoid kerfuffle.\n\nMy own opinion is it depends, but generally order as\n\nclasses (alpha order)\npublic module methods (alpha order)\nprivate module methods (alpha order)\n\nwithin a class:\n\ndunder methods\npublic methods (alpha)\nprivate methods (alpha)\n\nThat sort of thing makes a lot more sense in small and focused modules, less in giant behemoths like resource_provider.py (where grouping classes by some notion of \"type\" makes a kind of sense, but really I\u0027d think better to never make a module that big).","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"},{"line_number":74,"context_line":"        if resource_class_id is not None:"},{"line_number":75,"context_line":"            # FIXME(cdent): Make _RC_CACHE non-private indepenent module."},{"line_number":76,"context_line":"            self.resource_class \u003d resource_provider._RC_CACHE.string_from_id("},{"line_number":77,"context_line":"                resource_class_id)"},{"line_number":78,"context_line":"        self.usage \u003d usage"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_47f30d0a","line":75,"range":{"start_line":75,"start_character":55,"end_line":75,"end_character":65},"updated":"2019-02-26 20:24:01.000000000","message":"independent","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"011e66f1c5cf0c326f0f8ef48aaadb7fafff07ad","unresolved":false,"context_lines":[{"line_number":72,"context_line":"    def __init__(self, resource_class\u003dNone, resource_class_id\u003dNone, usage\u003d0):"},{"line_number":73,"context_line":"        self.resource_class \u003d resource_class"},{"line_number":74,"context_line":"        if resource_class_id is not None:"},{"line_number":75,"context_line":"            # FIXME(cdent): Make _RC_CACHE non-private indepenent module."},{"line_number":76,"context_line":"            self.resource_class \u003d resource_provider._RC_CACHE.string_from_id("},{"line_number":77,"context_line":"                resource_class_id)"},{"line_number":78,"context_line":"        self.usage \u003d usage"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_c7eb7da1","line":75,"range":{"start_line":75,"start_character":55,"end_line":75,"end_character":65},"in_reply_to":"9fdfeff1_47f30d0a","updated":"2019-02-26 20:48:50.000000000","message":"I was drunk and slurring my speech","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3ab39ca1f280ac01ae84822e71e18382313f3df1","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                resource_class_id)"},{"line_number":78,"context_line":"        self.usage \u003d usage"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    @staticmethod"},{"line_number":81,"context_line":"    def _from_db_object(context, target, source):"},{"line_number":82,"context_line":"        for field in target.fields:"},{"line_number":83,"context_line":"            if field not in (\u0027resource_class\u0027):"},{"line_number":84,"context_line":"                setattr(target, field, source[field])"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_3d6db602","line":81,"range":{"start_line":80,"start_character":0,"end_line":81,"end_character":49},"updated":"2019-02-26 22:41:22.000000000","message":"Was gonna say we should move this out too - but it actually appears to be unused, can be removed entirely?","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"1edf53d0bd1e163bed76242fc13493a7fb041539","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                resource_class_id)"},{"line_number":78,"context_line":"        self.usage \u003d usage"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    @staticmethod"},{"line_number":81,"context_line":"    def _from_db_object(context, target, source):"},{"line_number":82,"context_line":"        for field in target.fields:"},{"line_number":83,"context_line":"            if field not in (\u0027resource_class\u0027):"},{"line_number":84,"context_line":"                setattr(target, field, source[field])"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_4188d0c4","line":81,"range":{"start_line":80,"start_character":0,"end_line":81,"end_character":49},"in_reply_to":"9fdfeff1_3d6db602","updated":"2019-02-27 09:25:43.000000000","message":"Yeah, not sure what happened there, it should have been gone earlier in the stack.","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":84,"context_line":"                setattr(target, field, source[field])"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"        if \u0027resource_class\u0027 not in target:"},{"line_number":87,"context_line":"            # FIXME(cdent): Make _RC_CACHE non-private indepenent module."},{"line_number":88,"context_line":"            rc_str \u003d resource_provider._RC_CACHE.string_from_id("},{"line_number":89,"context_line":"                source[\u0027resource_class_id\u0027])"},{"line_number":90,"context_line":"            target.resource_class \u003d rc_str"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_07d98581","line":87,"range":{"start_line":87,"start_character":55,"end_line":87,"end_character":65},"updated":"2019-02-26 20:24:01.000000000","message":"ditto","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"}],"placement/tests/functional/db/test_resource_provider.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b3f7197d72ca64d3fffc97d6fb44dc6dd074adb9","unresolved":false,"context_lines":[{"line_number":24,"context_line":"from placement import exception"},{"line_number":25,"context_line":"from placement.objects import consumer as consumer_obj"},{"line_number":26,"context_line":"from placement.objects import resource_provider as rp_obj"},{"line_number":27,"context_line":"from placement.objects import usage as usage_list"},{"line_number":28,"context_line":"from placement.tests.functional.db import test_base as tb"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_a768b987","line":27,"range":{"start_line":27,"start_character":39,"end_line":27,"end_character":49},"updated":"2019-02-26 20:24:01.000000000","message":"ditto","commit_id":"e1172be52fab9f72e57a708ba7f90f4ac5a9b6ee"}]}
