)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add DictionaryField class to resource base"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"DictionaryField capable of handling dictionaries in resource body"},{"line_number":10,"context_line":"JSON."},{"line_number":11,"context_line":"This is necessary to parse resources like Message Registry:"},{"line_number":12,"context_line":"\"Messages\": {"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_6fd083f5","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":15},"updated":"2018-07-26 15:08:23.000000000","message":"Added `DictionaryField` class ...","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add DictionaryField class to resource base"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"DictionaryField capable of handling dictionaries in resource body"},{"line_number":10,"context_line":"JSON."},{"line_number":11,"context_line":"This is necessary to parse resources like Message Registry:"},{"line_number":12,"context_line":"\"Messages\": {"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_55a75aa9","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":15},"in_reply_to":"5f7c97a3_6fd083f5","updated":"2018-07-26 15:42:38.000000000","message":"Done","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"DictionaryField capable of handling dictionaries in resource body"},{"line_number":10,"context_line":"JSON."},{"line_number":11,"context_line":"This is necessary to parse resources like Message Registry:"},{"line_number":12,"context_line":"\"Messages\": {"},{"line_number":13,"context_line":"        \"Success\": {"},{"line_number":14,"context_line":"            \"Message\": \"Completed successfully\","}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_af98db66","line":11,"range":{"start_line":11,"start_character":18,"end_line":11,"end_character":27},"updated":"2018-07-26 15:08:23.000000000","message":"\u0027to be able to\u0027 or \u0027for parsing\u0027 perhaps","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"DictionaryField capable of handling dictionaries in resource body"},{"line_number":10,"context_line":"JSON."},{"line_number":11,"context_line":"This is necessary to parse resources like Message Registry:"},{"line_number":12,"context_line":"\"Messages\": {"},{"line_number":13,"context_line":"        \"Success\": {"},{"line_number":14,"context_line":"            \"Message\": \"Completed successfully\","}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_75a29699","line":11,"range":{"start_line":11,"start_character":18,"end_line":11,"end_character":27},"in_reply_to":"5f7c97a3_af98db66","updated":"2018-07-26 15:42:38.000000000","message":"Done","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":20,"context_line":"            \"Severity\": \"Critical\","},{"line_number":21,"context_line":"            [...]"},{"line_number":22,"context_line":"        }"},{"line_number":23,"context_line":"}"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Change-Id: I8a0b6fe2dda4c244be4b7a0abaf601f533dd30f9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_8fc63f4a","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":1},"updated":"2018-07-26 15:08:23.000000000","message":"should we link this patch to may be BIOS story under a new task?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":20,"context_line":"            \"Severity\": \"Critical\","},{"line_number":21,"context_line":"            [...]"},{"line_number":22,"context_line":"        }"},{"line_number":23,"context_line":"}"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Change-Id: I8a0b6fe2dda4c244be4b7a0abaf601f533dd30f9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_15b322ee","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":1},"in_reply_to":"5f7c97a3_8fc63f4a","updated":"2018-07-26 15:42:38.000000000","message":"Done","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"}],"sushy/resources/base.py":[{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b2c60441","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"updated":"2018-07-26 15:08:23.000000000","message":"It is probably impossible to use `MappedField`, let\u0027s may be explain that in comments?\n\nI actually wonder, can we have nested `MappedField`? I hope you pardon my ignorance. ;-D","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"99d79313304406d6d1b29fb71be5ac081ec78d11","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_e542190d","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"in_reply_to":"5f7c97a3_015632ce","updated":"2018-07-31 16:36:30.000000000","message":"how to run outer loop conditionally? \n\nHere is one sample for illustration purposes only when Composite inherits from Dictionary. Note the `if is_comp_field` statements. Also note that ListField in this case would need to be updated as well, because it shares almost the same code (that is if Dictionary can\u0027t have this duplication, ListField can\u0027t either :))\n\n    class DictionaryField(Field):\n        [...]\n        def _load(self, body, resource, nested_in\u003dNone):\n            nested_in \u003d (nested_in or []) + self._path\n            values \u003d super(DictionaryField, self)._load(body, resource)\n            if values is None:\n                return None\n            is_comp_field \u003d isinstance(self, CompositeField)\n            if is_comp_field:\n                values \u003d {\u0027fake\u0027: values}\n            instances \u003d {}\n            for key, value in values.items():\n                instance_value \u003d copy.copy(self)\n                for attr, field in self._subfields.items():\n                    setattr(instance_value, attr, field._load(value,\n                                                              resource,\n                                                              nested_in))\n                instances[key] \u003d instance_value\n            if is_comp_field:\n                return instances[\u0027fake\u0027]\n            else:\n                return instances\n\n    class CompositeField(collections.Mapping, DictionaryField):\n        def __getitem__(self, key):\n            if key in self._subfields:\n                return getattr(self, key)\n            else:\n                raise KeyError(key)\n\n        def __len__(self):\n            return len(self._subfields)\n\n        def __iter__(self):\n            return iter(self._subfields)\n\nShould I update patch with this^ approach? I personally dislike the \u0027fake\u0027 key usage, but I couldn\u0027t find another way how to optionally run outer loop and change return type from dictionary value to dictionary. Any ideas?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"9044c0c1f1a475828a4679be5c7b277e8c170571","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_9da73e0a","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"in_reply_to":"5f7c97a3_2e5b5623","updated":"2018-07-27 17:44:24.000000000","message":"np, maybe this new class is not necessary, though it is hard to figure it out how existing fields could help - if the new class is not missing from base, then it could be documentation :)\n\nAs for CompositeField, it is meant for fields that consist of other fields. Usually sushy starts with Resource that contains a list of fields, but if any of these fields contain more fields (nesting), then CompositeField comes to help.\nProbably to allow iterating through all fields, it implements Mapping interface, but the main thing why this cannot be used here: key values are not known upfront when defining nested fields, e.g., we don\u0027t know that field will be named \u0027Success\u0027 or \u0027Failure\u0027.\n\nIt could be possible to achieve the same outcome by overriding the adapter of basic Field - which would be to implement the same logic as currently is in DictionaryField._load function to be inside a lambda function.\nThis wouldn\u0027t be re-usable, and probably would raise a question why this is not implemented the same way as MappedField, which does not have its own _load, but overrides adapter in constructor (and it has super simple adapter - mapping.get where for dictionary it would be more complex).\nIn the end the difference from the current implementation would be that that is using lambda and does not use _load. I don\u0027t think that\u0027s worth the effort.\n\nIf you find otherwise, let me know.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"9162bf0672333ebfc58d85a5004d61eaad912d22","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_2e5b5623","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"in_reply_to":"5f7c97a3_555e7a13","updated":"2018-07-27 13:07:16.000000000","message":"I hope you still tolerate my nitpickiness. I know it\u0027s not easy, sometimes I can\u0027t tolerate myself. ;-)\n\nWould it be possible to use existing `CompositeField` instead of the new `DictionaryField`? Not having dug deeper, I just observed that JSON serialization in the test case for the former field [1] looks conceptually similar to the test case you\u0027ve introduced for the `DictionaryField` in this patch.\n\n1. https://github.com/openstack/sushy/blob/master/sushy/tests/unit/resources/test_base.py#L154","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"71ec7ebac907085c2f0b45d5ffddf0c39aec910d","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_015632ce","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"in_reply_to":"5f7c97a3_9da73e0a","updated":"2018-07-31 12:31:19.000000000","message":"Another thought...\n\nWould it make sense to pass a new flag like `anonymous_fields` to `CompositeField.__init__` which would conditionally run outer loop over JSON keys (#211) on top of loop over subfields (#213)?\n\nOr yet another thought!\n\nWould it work if we declare `CompositeField` as a subfield of the `DictionaryField`? That way we\u0027d possibly remove the duplicate inner loop  #213-217 and make the purpose of `DictionaryField` more specific.\n\nSee, I am not 100% happy of partial code and functionality duplication that `DictionaryField` introduces. So I am thinking how to fit it into existing set of base classes...","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_555e7a13","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"in_reply_to":"5f7c97a3_b2c60441","updated":"2018-07-26 15:42:38.000000000","message":"I thought about MappedField but couldn\u0027t figure it out how that would work. MappedField is built more for enums to map Redfish\u0027s enums to sushy\u0027s enums.\nThis seems more straightforward.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"8c73af55f7c50c413c0b50a08419fe57416038ca","unresolved":false,"context_lines":[{"line_number":187,"context_line":"        return instances"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b7c3e405","line":190,"range":{"start_line":190,"start_character":6,"end_line":190,"end_character":21},"in_reply_to":"5f7c97a3_e542190d","updated":"2018-08-01 12:35:59.000000000","message":"I though of doing it the other way round [1]. My second thought would look like [2] from the usage standpoint.\n\nWDYT?\n\nI am just searching for a more logical and less duplicative code arrangements. Do not take it like I oppose merging your solution if you think it makes sense to merge it now.\n\n1. http://paste.openstack.org/show/727056/\n2. http://paste.openstack.org/show/727057/","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":194,"context_line":"        super(DictionaryField, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_af1d3bc0","line":191,"range":{"start_line":191,"start_character":29,"end_line":191,"end_character":39},"updated":"2018-07-26 15:08:23.000000000","message":"may be something like \u0027representing nested JSON object\u0027?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"class DictionaryField(Field):"},{"line_number":191,"context_line":"    \"\"\"Base class for fields consisting of dictionary of several sub-fields.\"\"\""},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":194,"context_line":"        super(DictionaryField, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_15e48241","line":191,"range":{"start_line":191,"start_character":29,"end_line":191,"end_character":39},"in_reply_to":"5f7c97a3_af1d3bc0","updated":"2018-07-26 15:42:38.000000000","message":"As everything here I re-used the pattern from ListField (see class above). I wouldn\u0027t call this nested JSON object, because that would cover any nested structure.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        :returns: a new dictionary object containing subfields."},{"line_number":204,"context_line":"        \"\"\""},{"line_number":205,"context_line":"        nested_in \u003d (nested_in or []) + self._path"},{"line_number":206,"context_line":"        values \u003d super(DictionaryField, self)._load(body, resource)"},{"line_number":207,"context_line":"        if values is None:"},{"line_number":208,"context_line":"            return None"},{"line_number":209,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_af03fb10","line":206,"range":{"start_line":206,"start_character":58,"end_line":206,"end_character":66},"updated":"2018-07-26 15:08:23.000000000","message":"no need to pass `nested_in`?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        :returns: a new dictionary object containing subfields."},{"line_number":204,"context_line":"        \"\"\""},{"line_number":205,"context_line":"        nested_in \u003d (nested_in or []) + self._path"},{"line_number":206,"context_line":"        values \u003d super(DictionaryField, self)._load(body, resource)"},{"line_number":207,"context_line":"        if values is None:"},{"line_number":208,"context_line":"            return None"},{"line_number":209,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b5d26e5e","line":206,"range":{"start_line":206,"start_character":58,"end_line":206,"end_character":66},"in_reply_to":"5f7c97a3_af03fb10","updated":"2018-07-26 15:42:38.000000000","message":"I think so far we haven\u0027t got the case where this matters + this is how ListField does it.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":204,"context_line":"        \"\"\""},{"line_number":205,"context_line":"        nested_in \u003d (nested_in or []) + self._path"},{"line_number":206,"context_line":"        values \u003d super(DictionaryField, self)._load(body, resource)"},{"line_number":207,"context_line":"        if values is None:"},{"line_number":208,"context_line":"            return None"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_920d0838","line":207,"range":{"start_line":207,"start_character":0,"end_line":207,"end_character":26},"updated":"2018-07-26 15:08:23.000000000","message":"may be just `if not values`?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":204,"context_line":"        \"\"\""},{"line_number":205,"context_line":"        nested_in \u003d (nested_in or []) + self._path"},{"line_number":206,"context_line":"        values \u003d super(DictionaryField, self)._load(body, resource)"},{"line_number":207,"context_line":"        if values is None:"},{"line_number":208,"context_line":"            return None"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_95c0927f","line":207,"range":{"start_line":207,"start_character":0,"end_line":207,"end_character":26},"in_reply_to":"5f7c97a3_920d0838","updated":"2018-07-26 15:42:38.000000000","message":"re-used the same as ListField above, probably this need project wide cleanup, because this appears here and there.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        nested_in \u003d (nested_in or []) + self._path"},{"line_number":206,"context_line":"        values \u003d super(DictionaryField, self)._load(body, resource)"},{"line_number":207,"context_line":"        if values is None:"},{"line_number":208,"context_line":"            return None"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"},{"line_number":211,"context_line":"        for key, value in values.items():"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d21ce067","line":208,"range":{"start_line":208,"start_character":19,"end_line":208,"end_character":23},"updated":"2018-07-26 15:08:23.000000000","message":"`None` is implicit in return, but may be `return values`?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        nested_in \u003d (nested_in or []) + self._path"},{"line_number":206,"context_line":"        values \u003d super(DictionaryField, self)._load(body, resource)"},{"line_number":207,"context_line":"        if values is None:"},{"line_number":208,"context_line":"            return None"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"},{"line_number":211,"context_line":"        for key, value in values.items():"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_153242c1","line":208,"range":{"start_line":208,"start_character":19,"end_line":208,"end_character":23},"in_reply_to":"5f7c97a3_d21ce067","updated":"2018-07-26 15:42:38.000000000","message":"same as ListField above","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"a9af58025ddaae57d209e8e27c3a2a741454e254","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"},{"line_number":211,"context_line":"        for key, value in values.items():"},{"line_number":212,"context_line":"            instance_value \u003d copy.copy(self)"},{"line_number":213,"context_line":"            for attr, field in self._subfields.items():"},{"line_number":214,"context_line":"                # Hide the Field object behind the real value"},{"line_number":215,"context_line":"                setattr(instance_value, attr, field._load(value,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_72ae2ce5","line":212,"range":{"start_line":212,"start_character":34,"end_line":212,"end_character":38},"updated":"2018-07-26 15:08:23.000000000","message":"This looks fishy at the first glance.\n\nDo we need to copy the parent? Can we just create a brand new `DictionaryField`?\n\nWhat worries me a bit is that this is a shallow copy meaning that `instance_value` might share all objects it refers to with the parent and other copies...","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"9044c0c1f1a475828a4679be5c7b277e8c170571","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"},{"line_number":211,"context_line":"        for key, value in values.items():"},{"line_number":212,"context_line":"            instance_value \u003d copy.copy(self)"},{"line_number":213,"context_line":"            for attr, field in self._subfields.items():"},{"line_number":214,"context_line":"                # Hide the Field object behind the real value"},{"line_number":215,"context_line":"                setattr(instance_value, attr, field._load(value,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_5d1686a3","line":212,"range":{"start_line":212,"start_character":34,"end_line":212,"end_character":38},"in_reply_to":"5f7c97a3_5fd683c6","updated":"2018-07-27 17:44:24.000000000","message":"This could be intended - the pattern for sushy to define resources and fields is to use class attributes. If somebody will define field as instance attribute probably this will break, but that will go against the pattern how resources are defined. \n\nself.__class__() probably would work, I will look at this in another patch when I have some break - out of scope for this patch.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"ec8e88746b02de3de510420d0678c313420eed07","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"},{"line_number":211,"context_line":"        for key, value in values.items():"},{"line_number":212,"context_line":"            instance_value \u003d copy.copy(self)"},{"line_number":213,"context_line":"            for attr, field in self._subfields.items():"},{"line_number":214,"context_line":"                # Hide the Field object behind the real value"},{"line_number":215,"context_line":"                setattr(instance_value, attr, field._load(value,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_f5b30608","line":212,"range":{"start_line":212,"start_character":34,"end_line":212,"end_character":38},"in_reply_to":"5f7c97a3_72ae2ce5","updated":"2018-07-26 15:42:38.000000000","message":"same as above in ListField. We cannot create base.DictionaryField as we need to preserve the properties as defined in the inherited class.\nOn sharing instances, I think this should be ok so far as the classes are rather simple.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"1c4c78842fc04303d9505e128458676d87323712","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        instances \u003d {}"},{"line_number":211,"context_line":"        for key, value in values.items():"},{"line_number":212,"context_line":"            instance_value \u003d copy.copy(self)"},{"line_number":213,"context_line":"            for attr, field in self._subfields.items():"},{"line_number":214,"context_line":"                # Hide the Field object behind the real value"},{"line_number":215,"context_line":"                setattr(instance_value, attr, field._load(value,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_5fd683c6","line":212,"range":{"start_line":212,"start_character":34,"end_line":212,"end_character":38},"in_reply_to":"5f7c97a3_f5b30608","updated":"2018-07-27 12:00:35.000000000","message":"\u003e We cannot create base.DictionaryField as we need to preserve the properties as defined in the inherited class.\n\nMay be we could do:\n\n  instance_value \u003d self.__class__()\n\n?\n\nBTW, the `_collect_fields` function seems to work purely on class attributes, as opposed to instance attributes.\n\nI do not really know if that\u0027s OK though. Just wanted to note that `copy` should probably copy over both class and instance attributes while a new instance, created anew from class, may have just class attributes.","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"}],"sushy/tests/unit/resources/test_base.py":[{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"71ec7ebac907085c2f0b45d5ffddf0c39aec910d","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        self.assertEqual(2, self.test_resource.field_list[1].integer)"},{"line_number":230,"context_line":"        self.assertEqual(2, len(self.test_resource.dictionary))"},{"line_number":231,"context_line":"        self.assertEqual(\u0027value1\u0027,"},{"line_number":232,"context_line":"                         self.test_resource.dictionary[\u0027key1\u0027].property_a)"},{"line_number":233,"context_line":"        self.assertEqual(\u0027value4\u0027,"},{"line_number":234,"context_line":"                         self.test_resource.dictionary[\u0027key2\u0027].property_b)"},{"line_number":235,"context_line":"        self.assertIsNone(self.test_resource.non_existing_nested)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_c1a91a25","line":232,"range":{"start_line":232,"start_character":54,"end_line":232,"end_character":62},"updated":"2018-07-31 12:31:19.000000000","message":"Would it make sense / be possible to retain the attribute notation e.g. `test_resource.dictionary.key1.property_a`?","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"99d79313304406d6d1b29fb71be5ac081ec78d11","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        self.assertEqual(2, self.test_resource.field_list[1].integer)"},{"line_number":230,"context_line":"        self.assertEqual(2, len(self.test_resource.dictionary))"},{"line_number":231,"context_line":"        self.assertEqual(\u0027value1\u0027,"},{"line_number":232,"context_line":"                         self.test_resource.dictionary[\u0027key1\u0027].property_a)"},{"line_number":233,"context_line":"        self.assertEqual(\u0027value4\u0027,"},{"line_number":234,"context_line":"                         self.test_resource.dictionary[\u0027key2\u0027].property_b)"},{"line_number":235,"context_line":"        self.assertIsNone(self.test_resource.non_existing_nested)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_2ae3fed8","line":232,"range":{"start_line":232,"start_character":54,"end_line":232,"end_character":62},"in_reply_to":"5f7c97a3_c1a91a25","updated":"2018-07-31 16:36:30.000000000","message":"it would be possible, but at least for message registry it will be no use.\nThese keys are not known upfront, so they will not be used as part of the code, keys will be variables.\nThere will be MessageId like \u0027Base.1.2.QueryParameterValueFormatError\u0027. sushy will disassemble it in 3 variables: \nregistry, version, message_key\nand look for the right registry\u0027s dictionary to fetch the message, e.g. `messages[message_key]` instead of somehow generating code `messages.QueryParameterValueFormatError` or using `getattr(messages, message_key)`","commit_id":"793b5e21ee787cefbc40ca226030e9cccb47ff77"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"93b10793b414cb71fbcb862ead2a6c353b73c5bc","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        self.assertEqual(2, self.test_resource.field_list[1].integer)"},{"line_number":230,"context_line":"        self.assertEqual(2, len(self.test_resource.dictionary))"},{"line_number":231,"context_line":"        self.assertEqual(\u0027value1\u0027,"},{"line_number":232,"context_line":"                         self.test_resource.dictionary[\u0027key1\u0027].property_a)"},{"line_number":233,"context_line":"        self.assertEqual(\u0027value4\u0027,"},{"line_number":234,"context_line":"                         self.test_resource.dictionary[\u0027key2\u0027].property_b)"},{"line_number":235,"context_line":"        self.assertIsNone(self.test_resource.non_existing_nested)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_75665bf0","line":232,"range":{"start_line":232,"start_character":25,"end_line":232,"end_character":73},"updated":"2018-08-07 05:08:45.000000000","message":"an issue I feel is: any nested level attributes are to be accessed by the subscript operator (and not by dot notation). If that\u0027s what the case is then simple Filed would have sufficed to have value as is (whether or not it\u0027s a dict).","commit_id":"893ccec796b6c161a0d9db28e90ceed75f311b67"}]}
