)]}'
{"sushy/resources/base.py":[{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"e2f74423b5e6728644ec43a40b349203a1c04603","unresolved":false,"context_lines":[{"line_number":264,"context_line":"        \"\"\"Based on data source get data and parse to JSON\"\"\""},{"line_number":265,"context_line":""},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"class JsonDataReader(AbstractJsonReader):"},{"line_number":268,"context_line":"    \"\"\"Gets the data from HTTP response given by path\"\"\""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def get_json(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_b628c435","line":267,"updated":"2018-11-27 19:25:58.000000000","message":"Just an afterthought. We possibly can avoid the ``set_connection`` method from AbstractJsonReader. More possibly a misfit to a reader, it seems. My thoughts in code:\n\n    @six.add_metaclass(abc.ABCMeta)\n    class AbstractJsonReader(object):\n\n        @abc.abstractmethod\n        def get_json(self, response):\n            pass\n\n    class JsonDataReader(AbstractJsonReader):\n        def get_json(self, response):\n\t    return response.json()\n\n    class JsonArchiveReader(AbstractJsonReader):\n        def __init__(self, archive_file):\n            ...\n        def get_json(self, response):\n            if response.headers.get(\u0027content-type\u0027) \u003d\u003d \u0027application/zip\u0027:\n                try:\n                    archive \u003d zipfile.ZipFile(io.BytesIO(response.content))\n                    return json.loads(archive.read(self._archive_file).\n                                      decode(encoding\u003d\u0027utf-8\u0027))\n                except (zipfile.BadZipfile, ValueError) as e:\n                    ...\n\nAnd in ResourceBase::refresh() method::\n\n    self._json \u003d self._reader.get_json(self._conn.get(path\u003dself._path))\n\nWhat do you think?","commit_id":"21dd9b36157516e63c450ead350ac57e7f3c9703"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"cee53951d6f81471e77e1de306f917f7b48fa261","unresolved":false,"context_lines":[{"line_number":264,"context_line":"        \"\"\"Based on data source get data and parse to JSON\"\"\""},{"line_number":265,"context_line":""},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"class JsonDataReader(AbstractJsonReader):"},{"line_number":268,"context_line":"    \"\"\"Gets the data from HTTP response given by path\"\"\""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def get_json(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_e434aaad","line":267,"in_reply_to":"3f79a3b5_0de81ede","updated":"2018-12-05 09:36:19.000000000","message":"Thank you, Aija! Okay I can understand what you are saying. But passing None value to connector itself is kind if an indication that we are probably not headed towards the right approach here. See my mind dump here: https://review.openstack.org/#/c/590747/5","commit_id":"21dd9b36157516e63c450ead350ac57e7f3c9703"},{"author":{"_account_id":27909,"name":"Aija Jauntēva","email":"code@clusums.eu","username":"ajya"},"change_message_id":"0894a9bcdbabf0b1c403cd2002c26420fc437b57","unresolved":false,"context_lines":[{"line_number":264,"context_line":"        \"\"\"Based on data source get data and parse to JSON\"\"\""},{"line_number":265,"context_line":""},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"class JsonDataReader(AbstractJsonReader):"},{"line_number":268,"context_line":"    \"\"\"Gets the data from HTTP response given by path\"\"\""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def get_json(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_0de81ede","line":267,"in_reply_to":"3f79a3b5_b628c435","updated":"2018-12-03 19:43:57.000000000","message":"Debayan, thank you for considering more improvements.\n\nUnfortuntaly, this part would not work in upcoming readers:\n\n  self._json \u003d self._reader.get_json(self._conn.get(path\u003dself._path))\n\nIn one reader need to use absolute, full URL like this [1], ln280\n\n  self._conn.get(self._path)\n\nand then there is local filesystem reader, where there is no connection as such at all [2], ln306\n\n  open(self._path)\n\nIn this case for connector \u0027None\u0027 is passed.\n\nIf you have any suggestions, considering these cases that would be awesome. Could be done as part of reviewing those [1][2] patches :))\n\n[1] https://review.openstack.org/#/c/590747/5/sushy/resources/base.py\n[2] https://review.openstack.org/#/c/589837/3/sushy/resources/base.py","commit_id":"21dd9b36157516e63c450ead350ac57e7f3c9703"}]}
