)]}'
{"glanceclient/common/http.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"3a00a55dcff7c5c83bf6295873fcfe6a20cce931","unresolved":false,"context_lines":[{"line_number":409,"context_line":""},{"line_number":410,"context_line":"    \"\"\""},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"    def __init__(self, body, chunksize\u003dCHUNKSIZE, show_progress\u003dFalse):"},{"line_number":413,"context_line":"        self._body \u003d body"},{"line_number":414,"context_line":"        self._chunksize \u003d chunksize"},{"line_number":415,"context_line":"        size \u003d float(utils.get_file_size(self._body) or 0)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1b4%3D","line":412,"updated":"2013-04-19 11:35:25.000000000","message":"Hey,\n\nWhat about adding a file_size kwarg here. We could use response\u0027s `Content-Length` to know the size of the response instead of calling get_file_size. If passed with use it, otherwise we call the function.","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"a8a7fe729ed898e880bdcc1d7752a5dfd9d4ce6e","unresolved":false,"context_lines":[{"line_number":409,"context_line":""},{"line_number":410,"context_line":"    \"\"\""},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"    def __init__(self, body, chunksize\u003dCHUNKSIZE, show_progress\u003dFalse):"},{"line_number":413,"context_line":"        self._body \u003d body"},{"line_number":414,"context_line":"        self._chunksize \u003d chunksize"},{"line_number":415,"context_line":"        size \u003d float(utils.get_file_size(self._body) or 0)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1Xs%3D","line":412,"in_reply_to":"AAAAOn%2F%2F1Y8%3D","updated":"2013-04-19 13:33:11.000000000","message":"Actually i fail to notice that if we want to use this for download the above will not work (the size will be always 0) and the only way to get the size will be to fetch it from response headers like you said, but for upload the correct way will be to fetch the size automatically (using seek-\u003etell-\u003eseek), so what i am looking here is two different behavior  for two different cases, and i don\u0027t think adding a new optional argument is the right fix, but IMHO i think it will be better if we can split this into two separate classes one used for Upload (or files in general) and the other class can be used for download, i will include a patch soon to show you what i mean, but if you have any better idea or if you don\u0027t agree with the above please let me know :)","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"aded3662d56e4ea25d4e321f21572416a0af6f24","unresolved":false,"context_lines":[{"line_number":409,"context_line":""},{"line_number":410,"context_line":"    \"\"\""},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"    def __init__(self, body, chunksize\u003dCHUNKSIZE, show_progress\u003dFalse):"},{"line_number":413,"context_line":"        self._body \u003d body"},{"line_number":414,"context_line":"        self._chunksize \u003d chunksize"},{"line_number":415,"context_line":"        size \u003d float(utils.get_file_size(self._body) or 0)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1Y8%3D","line":412,"in_reply_to":"AAAAOn%2F%2F1b4%3D","updated":"2013-04-19 12:11:24.000000000","message":"I guess more customization does\u0027t hurt, will do :)","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"3a00a55dcff7c5c83bf6295873fcfe6a20cce931","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":417,"context_line":"        self._percent \u003d self._step \u003d chunksize / size if size else 0"},{"line_number":418,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":419,"context_line":"        self._show_progress \u003d \\"},{"line_number":420,"context_line":"            show_progress and sys.stdout.isatty() and size !\u003d 0"},{"line_number":421,"context_line":""},{"line_number":422,"context_line":"    def next(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1dE%3D","line":419,"updated":"2013-04-19 11:35:25.000000000","message":"Hey,\n\nPls, use () instead of \\ for wrapping lines","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"aded3662d56e4ea25d4e321f21572416a0af6f24","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":417,"context_line":"        self._percent \u003d self._step \u003d chunksize / size if size else 0"},{"line_number":418,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":419,"context_line":"        self._show_progress \u003d \\"},{"line_number":420,"context_line":"            show_progress and sys.stdout.isatty() and size !\u003d 0"},{"line_number":421,"context_line":""},{"line_number":422,"context_line":"    def next(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1ZA%3D","line":419,"in_reply_to":"AAAAOn%2F%2F1dE%3D","updated":"2013-04-19 12:11:24.000000000","message":"will do","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"f1620a90cfcd3ee657c8b25a969ae452328fa2f0","unresolved":false,"context_lines":[{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    def _get_size(self):"},{"line_number":448,"context_line":"        \"\"\"Return the size of the HTTP response body.\"\"\""},{"line_number":449,"context_line":"        return int(self._file_obj.getheader(\u0027content-length\u0027, 0))"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAOn%2F%2F0PM%3D","line":449,"updated":"2013-04-22 10:20:40.000000000","message":"Hey,\n\nmmhh, TBH, I don\u0027t like this. I\u0027d prefer just to have a file_size\u003dNone in the ChunkedFileIterator and pass the response\u0027s length. If that kwarg is None then it tries to get the size from the file object.\n\nI don\u0027t think we need to split this. Thoughts?","commit_id":"f4e62d7bf5cf8f62f32f84d221ae885b830ec193"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"7cc767bfaa1073b7c5118d6217e5a98e220a23fc","unresolved":false,"context_lines":[{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    def _get_size(self):"},{"line_number":448,"context_line":"        \"\"\"Return the size of the HTTP response body.\"\"\""},{"line_number":449,"context_line":"        return int(self._file_obj.getheader(\u0027content-length\u0027, 0))"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAOn%2F%2F0KM%3D","line":449,"in_reply_to":"AAAAOn%2F%2F0Lc%3D","updated":"2013-04-22 13:23:21.000000000","message":"Ok good, i am reassured now, if we are not looking for generality in this case i will be glad to do the changes, thanks :\u003d)","commit_id":"f4e62d7bf5cf8f62f32f84d221ae885b830ec193"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"549fca647f8b0339a12a186d50a942f7142aba57","unresolved":false,"context_lines":[{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    def _get_size(self):"},{"line_number":448,"context_line":"        \"\"\"Return the size of the HTTP response body.\"\"\""},{"line_number":449,"context_line":"        return int(self._file_obj.getheader(\u0027content-length\u0027, 0))"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAOn%2F%2F0Lc%3D","line":449,"in_reply_to":"AAAAOn%2F%2F0Mk%3D","updated":"2013-04-22 13:01:19.000000000","message":"It makes a lot of sense, my point about adding the size and making it a bit simpler is that I don\u0027t think this will be used anywhere else. It is intended to be used just here and for this purpose. If it happens to be useful for some other case then we can move it under common and make it a bit more generic.\n\nWe could also put a \u0027_\u0027 in the class name just to make sure it is clear that this class is not intended to be used outside this module.\n\nDoes the above make sense? \n\nThanks for the feedback! :D","commit_id":"f4e62d7bf5cf8f62f32f84d221ae885b830ec193"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"8b485e2aea78b5a52f670f5c09a902f31e5b320b","unresolved":false,"context_lines":[{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    def _get_size(self):"},{"line_number":448,"context_line":"        \"\"\"Return the size of the HTTP response body.\"\"\""},{"line_number":449,"context_line":"        return int(self._file_obj.getheader(\u0027content-length\u0027, 0))"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAOn%2F%2F0Mk%3D","line":449,"in_reply_to":"AAAAOn%2F%2F0PM%3D","updated":"2013-04-22 12:29:27.000000000","message":"Hi,\n\nI did it this way because it what should be done in each case (file and response), i mean, that we don\u0027t want users of this class to pass anything other than all the file size in case of a file or another value different than content-length in case of HTTP response, because first of all that\u0027s not what the intend behavior that we want from this class and second if someone pass a size value different than the one expected than we will need to read until that size and nothing more, and so start the hassle if you know what i mean :), i hope what i said made sense to you if not please let me know.\n\nThanks,","commit_id":"f4e62d7bf5cf8f62f32f84d221ae885b830ec193"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"89609b2a5db9e66b31d02e5529a639b7c26a6d73","unresolved":false,"context_lines":[{"line_number":193,"context_line":"            raise exc.CommunicationError(message\u003dmessage)"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        body_iter \u003d _ChunkedBodyIterator("},{"line_number":196,"context_line":"            resp, totalsize\u003dfloat(resp.getheader(\u0027content-length\u0027, 0))"},{"line_number":197,"context_line":"        )"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"        # Read body into string if it isn\u0027t obviously image data"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fz0k%3D","line":196,"updated":"2013-04-22 17:12:57.000000000","message":"Hey,\n\nJust a small style nitpick. Could you please change this to:\n\n    totalsize \u003d float(resp.getheader(\u0027content-length\u0027, 0)\n    body_iter \u003d _ChunkedBodyIterator(resp, totalsize\u003dtotalsize)\n\nAlso, totalsize is already converted to float bellow, I guess you could get rid of that call here.","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"8f298fcb9da75db3a90e564e7310f7cfaf2473c8","unresolved":false,"context_lines":[{"line_number":193,"context_line":"            raise exc.CommunicationError(message\u003dmessage)"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        body_iter \u003d _ChunkedBodyIterator("},{"line_number":196,"context_line":"            resp, totalsize\u003dfloat(resp.getheader(\u0027content-length\u0027, 0))"},{"line_number":197,"context_line":"        )"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"        # Read body into string if it isn\u0027t obviously image data"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fys8%3D","line":196,"in_reply_to":"AAAAOn%2F%2Fz0k%3D","updated":"2013-04-23 08:07:07.000000000","message":"Done","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"89609b2a5db9e66b31d02e5529a639b7c26a6d73","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        if totalsize is None:"},{"line_number":419,"context_line":"            totalsize \u003d utils.get_file_size(self._body) or 0"},{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fz0U%3D","line":421,"updated":"2013-04-22 17:12:57.000000000","message":"Hey,\n\nI guess we could call float(totalsize) in the line bellow it.","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"9da6d9e88e07f97d2dc19e51dd17c0e03d28071a","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        if totalsize is None:"},{"line_number":419,"context_line":"            totalsize \u003d utils.get_file_size(self._body) or 0"},{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fyag%3D","line":421,"in_reply_to":"AAAAOn%2F%2Fyk4%3D","updated":"2013-04-23 12:58:09.000000000","message":"Oh right! Content-Length! mmhh!\n\nIn that case, I\u0027d have converted it to int before calling the class constructor. Not big deal, though!","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"5a9441079d0eab177d1f617ad5154887a6b40171","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        if totalsize is None:"},{"line_number":419,"context_line":"            totalsize \u003d utils.get_file_size(self._body) or 0"},{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fyk4%3D","line":421,"in_reply_to":"AAAAOn%2F%2Fynk%3D","updated":"2013-04-23 10:20:21.000000000","message":"How about when Content-Length: \"0\" ? which mean server returned a response without body !? Well the idea of this line is basically to protect against extrem behavior and like you said it just one line of code, doesn\u0027t hurst :)","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"36fb442dbfc344e5c275759e86557212879137d8","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        if totalsize is None:"},{"line_number":419,"context_line":"            totalsize \u003d utils.get_file_size(self._body) or 0"},{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fynk%3D","line":421,"in_reply_to":"AAAAOn%2F%2FytU%3D","updated":"2013-04-23 09:27:48.000000000","message":"That\u0027s true but, is there a case where \u00270\u0027 would be passed? I mean, this is meant to be used within this module so I guessed that wouldn\u0027t happen. \n\nI don\u0027t mind leaving it, though. So, feel free to ignore this comment if you want, this change would just reduce the lines of code. :D","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"8f298fcb9da75db3a90e564e7310f7cfaf2473c8","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        if totalsize is None:"},{"line_number":419,"context_line":"            totalsize \u003d utils.get_file_size(self._body) or 0"},{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2FytU%3D","line":421,"in_reply_to":"AAAAOn%2F%2Fz0U%3D","updated":"2013-04-23 08:07:07.000000000","message":"I don\u0027t think this is a good idea, what come after this line need totalsize to be a float if we pass a value of totalsize \u003d \u00270\u0027 (string 0) than self._show_progress will be True else it should be False !","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"89609b2a5db9e66b31d02e5529a639b7c26a6d73","unresolved":false,"context_lines":[{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":425,"context_line":"        self._show_progress \u003d ("},{"line_number":426,"context_line":"            show_progress and sys.stdout.isatty() and totalsize !\u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fz0c%3D","line":423,"updated":"2013-04-22 17:12:57.000000000","message":"Hey\n\ntotalsize will always have a value \u003e\u003d 0. I think you can get rid of this check here.","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"9da6d9e88e07f97d2dc19e51dd17c0e03d28071a","unresolved":false,"context_lines":[{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":425,"context_line":"        self._show_progress \u003d ("},{"line_number":426,"context_line":"            show_progress and sys.stdout.isatty() and totalsize !\u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2FyZ4%3D","line":423,"in_reply_to":"AAAAOn%2F%2Fyk0%3D","updated":"2013-04-23 12:58:09.000000000","message":"#Fuck!\n\nNever mind! Don\u0027t ask me why but, in my mind, I was grouping it like (even though I knew this already):\n\n    chunksize / (totalsize if totalsize else 0)\n\nWhat you said makes sense to me. What about putting some parenthesis:\n\n    (chunksize / totalsize) if totalsize else 0\n\nJust to make it more obvious (yeah, talking to myself here :P)","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"5a9441079d0eab177d1f617ad5154887a6b40171","unresolved":false,"context_lines":[{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":425,"context_line":"        self._show_progress \u003d ("},{"line_number":426,"context_line":"            show_progress and sys.stdout.isatty() and totalsize !\u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fyk0%3D","line":423,"in_reply_to":"AAAAOn%2F%2Fyn4%3D","updated":"2013-04-23 10:20:21.000000000","message":"In line 419 totalsize may be set to 0 if file is empty or if get_file_size return None, which mean that chunk / totalsize will raise ZeroDivisionError exception, that\u0027s why i added a check, which say If totalsize is 0 than the else statement will be executed:\n\nchunksize / totalsize if totalsize else 0\n\nis equivalent to:\n\nif totalsize:\n    chunksize / totalsize\nelse:\n    0","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"36fb442dbfc344e5c275759e86557212879137d8","unresolved":false,"context_lines":[{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":425,"context_line":"        self._show_progress \u003d ("},{"line_number":426,"context_line":"            show_progress and sys.stdout.isatty() and totalsize !\u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2Fyn4%3D","line":423,"in_reply_to":"AAAAOn%2F%2FytQ%3D","updated":"2013-04-23 09:27:48.000000000","message":"Hey :D\n\nI\u0027m struggling on seeing how this protects against dividing by 0, I mean, If totalsize is 0 the you\u0027ll end up dividing by zero - since 0 is False. Plus, you\u0027re already making sure totalsize is set in line 419. I think this line could be:\n\n    self._percent \u003d self._step \u003d chunksize / totalsize","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"8f298fcb9da75db3a90e564e7310f7cfaf2473c8","unresolved":false,"context_lines":[{"line_number":420,"context_line":"        # Convert to float to be able to use it as a denominator."},{"line_number":421,"context_line":"        totalsize \u003d float(totalsize)"},{"line_number":422,"context_line":"        # Set the progress percent and the incrementation step of this later."},{"line_number":423,"context_line":"        self._percent \u003d self._step \u003d chunksize / totalsize if totalsize else 0"},{"line_number":424,"context_line":"        # Enable progress bar if stdout is a tty and the body size is not zero."},{"line_number":425,"context_line":"        self._show_progress \u003d ("},{"line_number":426,"context_line":"            show_progress and sys.stdout.isatty() and totalsize !\u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2FytQ%3D","line":423,"in_reply_to":"AAAAOn%2F%2Fz0c%3D","updated":"2013-04-23 08:07:07.000000000","message":"Sorry but i didn\u0027t undertand what you mean, the check is to protect against dividing by 0, this what the check is doing.","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"}],"glanceclient/common/utils.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"3a00a55dcff7c5c83bf6295873fcfe6a20cce931","unresolved":false,"context_lines":[{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_file_size(file_obj):"},{"line_number":269,"context_line":"    \"\"\"Analyze file-like object and attempt to determine its size."},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    :param file_obj: file-like object."},{"line_number":272,"context_line":"    :retval The file\u0027s size or None if it cannot be determined."},{"line_number":273,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1cE%3D","line":270,"updated":"2013-04-19 11:35:25.000000000","message":"Hey,\n\nIf the docstring is multi-line, the content should start under the \"\"\"","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"ea7d0798d30eed9471505efebf8d5fc5285eceb6","unresolved":false,"context_lines":[{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_file_size(file_obj):"},{"line_number":269,"context_line":"    \"\"\"Analyze file-like object and attempt to determine its size."},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    :param file_obj: file-like object."},{"line_number":272,"context_line":"    :retval The file\u0027s size or None if it cannot be determined."},{"line_number":273,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1Yg%3D","line":270,"in_reply_to":"AAAAOn%2F%2F1ZE%3D","updated":"2013-04-19 12:49:58.000000000","message":"Yeah, this is more a HACKING file thing than Python\u0027s.\n\nhttps://github.com/openstack/python-glanceclient/blob/master/HACKING.rst\n\nThanks a lot!","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"aded3662d56e4ea25d4e321f21572416a0af6f24","unresolved":false,"context_lines":[{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_file_size(file_obj):"},{"line_number":269,"context_line":"    \"\"\"Analyze file-like object and attempt to determine its size."},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    :param file_obj: file-like object."},{"line_number":272,"context_line":"    :retval The file\u0027s size or None if it cannot be determined."},{"line_number":273,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F1ZE%3D","line":270,"in_reply_to":"AAAAOn%2F%2F1cE%3D","updated":"2013-04-19 12:11:24.000000000","message":"AFAIK Python style http://www.python.org/dev/peps/pep-0257/ is flexible on this, and this is also not a consistency issue (docstring in this module doesn\u0027t follow same style), but if it matter will do :)","commit_id":"1e766efc59fbffa6170641f15a01a7ee51aa8ac4"},{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"1a0383c5444ec8b6b911bdff2ffec40a5a84c0bc","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        try:"},{"line_number":277,"context_line":"            file_obj.seek(0, os.SEEK_END)"},{"line_number":278,"context_line":"            size \u003d file_obj.tell()"},{"line_number":279,"context_line":"            file_obj.seek(0)"},{"line_number":280,"context_line":"            return size"},{"line_number":281,"context_line":"        except IOError, e:"},{"line_number":282,"context_line":"            if e.errno \u003d\u003d errno.ESPIPE:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2FzrU%3D","line":279,"updated":"2013-04-22 18:42:10.000000000","message":"Instead of assuming that the caller started at offset 0 in the file can we assume have the first line get the location and then seek back to it after finding the end?  In the use case that inspired this change it may not matter, however this is not being moved to common utils and future callers may not expect to have the current location reset to 0.","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"8f298fcb9da75db3a90e564e7310f7cfaf2473c8","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        try:"},{"line_number":277,"context_line":"            file_obj.seek(0, os.SEEK_END)"},{"line_number":278,"context_line":"            size \u003d file_obj.tell()"},{"line_number":279,"context_line":"            file_obj.seek(0)"},{"line_number":280,"context_line":"            return size"},{"line_number":281,"context_line":"        except IOError, e:"},{"line_number":282,"context_line":"            if e.errno \u003d\u003d errno.ESPIPE:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAOn%2F%2FyuU%3D","line":279,"in_reply_to":"AAAAOn%2F%2FzrU%3D","updated":"2013-04-23 08:07:07.000000000","message":"Done","commit_id":"9881aa5e4fd13456043077a30dc245e645cf2586"},{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"40773e3f6056e1132234a1e0535bcabb0d2baf34","unresolved":false,"context_lines":[{"line_number":292,"context_line":"            return size"},{"line_number":293,"context_line":"        except IOError, e:"},{"line_number":294,"context_line":"            if e.errno \u003d\u003d errno.ESPIPE:"},{"line_number":295,"context_line":"                # Illegal seek. This means the file object"},{"line_number":296,"context_line":"                # is a pipe (e.g the user is trying"},{"line_number":297,"context_line":"                # to pipe image data to the client,"},{"line_number":298,"context_line":"                # echo testdata | bin/glance add blah...), or"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fy7E%3D","line":295,"updated":"2013-05-22 21:15:06.000000000","message":"Can you add #NOTE(username) ?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"d29cf1944358bf6c44d68abeeae7e80e0cf88aa7","unresolved":false,"context_lines":[{"line_number":292,"context_line":"            return size"},{"line_number":293,"context_line":"        except IOError, e:"},{"line_number":294,"context_line":"            if e.errno \u003d\u003d errno.ESPIPE:"},{"line_number":295,"context_line":"                # Illegal seek. This means the file object"},{"line_number":296,"context_line":"                # is a pipe (e.g the user is trying"},{"line_number":297,"context_line":"                # to pipe image data to the client,"},{"line_number":298,"context_line":"                # echo testdata | bin/glance add blah...), or"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fx2U%3D","line":295,"in_reply_to":"AAAAPH%2F%2Fy7E%3D","updated":"2013-05-23 13:35:57.000000000","message":"Comment is not mine, code was moved from v1/images.py","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"}],"glanceclient/progressbar.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"2a5c172894e4e9a91748b553fbae11dcb216ef3b","unresolved":false,"context_lines":[{"line_number":77,"context_line":"    def next(self):"},{"line_number":78,"context_line":"        try:"},{"line_number":79,"context_line":"            data \u003d self._wrapped.next()"},{"line_number":80,"context_line":"            # XXX(mouad): Assuming that data is a string b/c otherwise calling"},{"line_number":81,"context_line":"            # len function will not make any sense."},{"line_number":82,"context_line":"            self._display_progress_bar(len(data))"},{"line_number":83,"context_line":"            return data"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAOn%2F%2FrN0%3D","line":80,"updated":"2013-04-29 16:05:28.000000000","message":"hey, pls, use NOTE","commit_id":"cb5e0966918b1c09247ba2cba67bd40be7d51757"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"545fc9cfab7d7d299afac2b607e2d72ab77960e5","unresolved":false,"context_lines":[{"line_number":77,"context_line":"    def next(self):"},{"line_number":78,"context_line":"        try:"},{"line_number":79,"context_line":"            data \u003d self._wrapped.next()"},{"line_number":80,"context_line":"            # XXX(mouad): Assuming that data is a string b/c otherwise calling"},{"line_number":81,"context_line":"            # len function will not make any sense."},{"line_number":82,"context_line":"            self._display_progress_bar(len(data))"},{"line_number":83,"context_line":"            return data"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAOn%2F%2FqJQ%3D","line":80,"in_reply_to":"AAAAOn%2F%2FrN0%3D","updated":"2013-04-30 08:33:47.000000000","message":"Done","commit_id":"cb5e0966918b1c09247ba2cba67bd40be7d51757"}],"glanceclient/v1/images.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"40773e3f6056e1132234a1e0535bcabb0d2baf34","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        meta \u003d self._image_meta_from_headers(dict(resp.getheaders()))"},{"line_number":106,"context_line":"        return Image(self, meta)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    def data(self, image, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":109,"context_line":"        \"\"\"Get the raw data for a specific image."},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"        :param image: image object or id to look up"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fy7I%3D","line":108,"updated":"2013-05-22 21:15:06.000000000","message":"I would prefer that the return type is not based upon the input parameters.","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"d29cf1944358bf6c44d68abeeae7e80e0cf88aa7","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        meta \u003d self._image_meta_from_headers(dict(resp.getheaders()))"},{"line_number":106,"context_line":"        return Image(self, meta)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    def data(self, image, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":109,"context_line":"        \"\"\"Get the raw data for a specific image."},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"        :param image: image object or id to look up"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fx10%3D","line":108,"in_reply_to":"AAAAPH%2F%2Fy7I%3D","updated":"2013-05-23 13:35:57.000000000","message":"Suggestions ?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"c944a5418eea488886508391b04369ce860c9ecb","unresolved":false,"context_lines":[{"line_number":210,"context_line":"        \"\"\""},{"line_number":211,"context_line":"        image_data \u003d kwargs.pop(\u0027data\u0027, None)"},{"line_number":212,"context_line":"        if image_data is not None:"},{"line_number":213,"context_line":"            # For large images, we need to supply the size of the"},{"line_number":214,"context_line":"            # image file. See LP Bugs #827660 and #845788."},{"line_number":215,"context_line":"            image_size \u003d utils.get_file_size(image_data)"},{"line_number":216,"context_line":"            if image_size is not None:"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2F6lw%3D","line":213,"updated":"2013-06-18 11:30:55.000000000","message":"could you please add NOTE(...) ?","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"90954649d91f3babc3ace43633c3b7cd1ba19911","unresolved":false,"context_lines":[{"line_number":210,"context_line":"        \"\"\""},{"line_number":211,"context_line":"        image_data \u003d kwargs.pop(\u0027data\u0027, None)"},{"line_number":212,"context_line":"        if image_data is not None:"},{"line_number":213,"context_line":"            # For large images, we need to supply the size of the"},{"line_number":214,"context_line":"            # image file. See LP Bugs #827660 and #845788."},{"line_number":215,"context_line":"            image_size \u003d utils.get_file_size(image_data)"},{"line_number":216,"context_line":"            if image_size is not None:"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2F6kc%3D","line":213,"in_reply_to":"AAAAPn%2F%2F6lw%3D","updated":"2013-06-18 11:36:25.000000000","message":"Comment is not mine i moved it from _get_file_size, so is it ok if i add NOTE(\u003cmy name\u003e) ?","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"d9c1fcb7ffbdd7ddd4af0b3f5f3a339843ef5894","unresolved":false,"context_lines":[{"line_number":211,"context_line":"        image_data \u003d kwargs.pop(\u0027data\u0027, None)"},{"line_number":212,"context_line":"        if image_data is not None:"},{"line_number":213,"context_line":"            # For large images, we need to supply the size of the"},{"line_number":214,"context_line":"            # image file. See LP Bugs #827660 and #845788."},{"line_number":215,"context_line":"            image_size \u003d utils.get_file_size(image_data)"},{"line_number":216,"context_line":"            if image_size is not None:"},{"line_number":217,"context_line":"                kwargs.setdefault(\u0027size\u0027, image_size)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2FqZE%3D","line":214,"updated":"2013-06-25 18:27:26.000000000","message":"I think you can actually remove that comment. The bug was found in the Diablo release.","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"cb355f1fbd2ef9dc2c46d3e89a7f7fa3f38ab3fe","unresolved":false,"context_lines":[{"line_number":211,"context_line":"        image_data \u003d kwargs.pop(\u0027data\u0027, None)"},{"line_number":212,"context_line":"        if image_data is not None:"},{"line_number":213,"context_line":"            # For large images, we need to supply the size of the"},{"line_number":214,"context_line":"            # image file. See LP Bugs #827660 and #845788."},{"line_number":215,"context_line":"            image_size \u003d utils.get_file_size(image_data)"},{"line_number":216,"context_line":"            if image_size is not None:"},{"line_number":217,"context_line":"                kwargs.setdefault(\u0027size\u0027, image_size)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2FoyM%3D","line":214,"in_reply_to":"AAAAPn%2F%2FqZE%3D","updated":"2013-06-26 08:06:16.000000000","message":"Done","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"}],"glanceclient/v2/images.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"40773e3f6056e1132234a1e0535bcabb0d2baf34","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fy7U%3D","line":73,"updated":"2013-05-22 21:15:06.000000000","message":"I really do not like the idea of changing the return type based on a parameter.  Can you have it always return the size and modify the other places where it is called?  Or perhaps wrap this function with another?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"95c4b07f1acf7a1d66502d730780903dd7777bb4","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fdzg%3D","line":73,"in_reply_to":"AAAAPH%2F%2Fd5w%3D","updated":"2013-06-03 10:18:23.000000000","message":"Hi :)\n\nSorry but i still can\u0027t understand why this is needed ? I still can\u0027t understand why you don\u0027t like the following code ? Is it that bad that all the changes that you have suggested are needed ? sorry but i don\u0027t see it that way, because the way i see it is that this \"pull request\" is starting to become a lot more than \"show user a progress bar\".\n\nFWIW having return type of a function depend on argument is something used numerous time in OpenStack code (i can give you example if you want to), and it also take advantage of dynamic typing of Python and it also doesn\u0027t break the API and backward compatibility (not as much as always returning a (data, size) tuple), i am not saying that my code is perfect because there is always a room for improvement.\n\nI understand that everyone has an opinion on how to do things, and it\u0027s good to have diversity of opinions but what is better is to understand that \"Beauty is in the eye of the beholder\", if you don\u0027t like something other may like it :). \n\nSo IMHO and if my opinion matter, this is good enough for the time being, it doesn\u0027t have to be perfect, if refactoring is needed we can do it later, i guess.\n\nAnd one last advice for core developers if i may, please don\u0027t be too picky about code, because you\u0027re making it harder on people that want to contribute and this may drive them away, code can be made \"more beautiful\" (whatever that mean to you) easily after if needed, but re-gaining contributor is not that easy.\n\nHope this make sense to you.","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"2d6f0f7a96060641bd306fda6789e90964f71f2a","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPX%2F%2F%2Fb0%3D","line":73,"in_reply_to":"AAAAPH%2F%2Fdzg%3D","updated":"2013-06-04 11:42:33.000000000","message":"Hey,\n\nThere are many reasons why reviews are open and everybody can chime in, one of them is the fact that when a reviewer is being too nitpicky / nonsense, others can just say what they think and help both the reviewer and the contributor find an agreement on whats best for the project. I don\u0027t think our comments in this patch should be classified as \"too nitpicky\" or oriented to make code \"beautiful\", instead, they try to keep the API clean and reasonable so it keeps backward compatibility and its stability and hopefully make future implementations easier.\n\nI can ensure that perfection is not our goal but doing things that make sense is. It\u0027s all about doing what it\u0027s best for the project not for the reviewer / contributor. \n\nBased on what I have seen, things *never* are revisited once they land unless a bug is found or new features come. That\u0027s why tests, APIs and implementations are always reviewed \u0027til the last bit before they are approved.\n\nNow, back to the patch:\n\nI still think this is a good feature and I\u0027d like to see it landing, if you still want to contribute to it - and I really hope you want - pls, consider the comments above and lets try to find a good solution that doesn\u0027t require changing the returned value based on the input parameters.","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"4b49eaba18f0e12df3862a571aa3fbcfcfa88189","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2FxOg%3D","line":73,"in_reply_to":"AAAAPH%2F%2Fx0s%3D","updated":"2013-05-23 14:04:39.000000000","message":"I agree with John, though.\n\nNot returning the same value breaks the consistency of the API. If it is data then it doesn\u0027t make sense to return size, ever. I think returning (data, size) is not that bad but, we could also change ResponseBodyIterator and add the size there.\n\nI guess modifying ResponseBodyIterator is less invasive and cleaner.\n\nthoughts?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"1e51416fc9ac2d966f7265ac9ddb47e23940bbc6","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fd5w%3D","line":73,"in_reply_to":"AAAAPH%2F%2FxK8%3D","updated":"2013-06-03 09:00:09.000000000","message":"mmh, I guess we could move integrity_iter into ResponseBodyIterator (not the code but the call) and set the size, checksum in it.\n\nBasically, v[12]/images.py calls will always return a ResponseBodyIterator and do_checksum can be enforced in the shell code.\n\n    # Or similar\n    if do_checksum:\n        body.checksum_iter(checksum)","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"43b28bd2a9629223102f3855ad9f7f7c2ab8eba3","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2FxK8%3D","line":73,"in_reply_to":"AAAAPH%2F%2FxOg%3D","updated":"2013-05-23 14:19:49.000000000","message":"The body is wrapped in a generator function when utils.integrity_iter is called ! so i am not sure how modifying  ResponseBodyIterator will help us !?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"d29cf1944358bf6c44d68abeeae7e80e0cf88aa7","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fx0s%3D","line":73,"in_reply_to":"AAAAPH%2F%2Fy7U%3D","updated":"2013-05-23 13:35:57.000000000","message":"IMHO i don\u0027t think making images.data() always returning (data, size) make sense, because it\u0027s data and second we don\u0027t always need the size, that\u0027s why the size was made in demand, and i didn\u0027t understand why do you mean by \"wrap this function with another\", example maybe ? \n\nBTW what the reason of disliking this ?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"f5e4fba3e43cc10ca215b17c2d68f715f9a72710","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPX%2F%2F9KI%3D","line":73,"in_reply_to":"AAAAPX%2F%2F%2BvY%3D","updated":"2013-06-05 08:37:25.000000000","message":"Good point :)","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"2678686b95e0538a4b5d152c8fe6b68cef1c8761","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPX%2F%2F%2BvY%3D","line":73,"in_reply_to":"AAAAPX%2F%2F%2FYA%3D","updated":"2013-06-04 17:19:21.000000000","message":"In general, people expect that a function returns the same type of response no matter what inputs are provided. This is in part a carry-over from strongly typed languages, but it is a *good* practice nevertheless. Varying return types based on input parameters makes the function harder to use in a variety of contexts. For example, suppose I want to wrap the data function you have provided. If I write:\n\n  def cool_wrapper(self, *args, **kwargs):\n      return cool_iterator_transform(self.data(*args, **kwargs)\n\nFirst off, this is going to work much of the time--maybe I won\u0027t even catch that it doesn\u0027t work when kwargs[\u0027return_size\u0027] \u003d\u003d True. Second, suppose I do catch that, now I have to rewrite as\n\n  def cool_wrapper(self, *args, **kwargs):\n      if kwargs.get(\u0027return_size\u0027):\n          data, size \u003d self.data(*args, **kwargs)\n          return cool_iterator_transform(data), size\n      return cool_iterator_transform(self.data(*args, **kwargs)\n\nSo you can see that the additional complexity of the \"if return_size\" switch now propagates infinitely upward in the decoration space of this function. Also, any tools that I already have for dealing with functions that return iterators of strings cannot be reused with this function.","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"0477bae27a86047c3989dd454e87b5d0c9eddd35","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        body.pop(\u0027self\u0027, None)"},{"line_number":71,"context_line":"        return self.model(**body)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def data(self, image_id, do_checksum\u003dTrue, return_size\u003dFalse):"},{"line_number":74,"context_line":"        \"\"\""},{"line_number":75,"context_line":"        Retrieve data of an image."},{"line_number":76,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPX%2F%2F%2FYA%3D","line":73,"in_reply_to":"AAAAPX%2F%2F%2Fb0%3D","updated":"2013-06-04 12:50:42.000000000","message":"Hi,\n\nI guess i just made a fool of my self like always by writing the above comment, excepting that something will change, but well it\u0027s not my first time :), but i just want to say one last thing before we go back to the code, what still bother me is that you didn\u0027t give me any reason why you don\u0027t like the following code except that you \"don\u0027t like it\" ?! A good reason will be in the form \"The design that you proposed can go wrong when ...\", \"It\u0027s cleaner to write this as .. because ...\", but well i guess you don\u0027t have to.\n\nNow my suggestion for changing this is to wrap the Image.data() returning value (it\u0027s iterator in both cases) into a new wrapper (an iterator too) that have an attribute \"size\" which we set inside the function ? this have as a benefit less code and transparency in other places that use the Image API.\n\nLet me know what you think, thanks :)","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"}],"glanceclient/v2/shell.py":[{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"2678686b95e0538a4b5d152c8fe6b68cef1c8761","unresolved":false,"context_lines":[{"line_number":126,"context_line":"@utils.arg(\u0027--progress\u0027, action\u003d\u0027store_true\u0027, default\u003dFalse,"},{"line_number":127,"context_line":"           help\u003d\u0027Show download progress bar.\u0027)"},{"line_number":128,"context_line":"def do_image_download(gc, args):"},{"line_number":129,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":130,"context_line":"    body, image_size \u003d gc.images.data(args.id, return_size\u003dTrue)"},{"line_number":131,"context_line":"    if args.progress:"},{"line_number":132,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPX%2F%2F%2Bzw%3D","line":129,"updated":"2013-06-04 17:19:21.000000000","message":"How about\n\n  image_size \u003d gc.images.get(args.id)[\u0027size\u0027]\n\nThat would work better in the case where the glance server decides to do a chunked encoding on the download for no good reason (which sometimes happens).","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"703450e705ffaabb689d99a808c43b16dd36435a","unresolved":false,"context_lines":[{"line_number":126,"context_line":"@utils.arg(\u0027--progress\u0027, action\u003d\u0027store_true\u0027, default\u003dFalse,"},{"line_number":127,"context_line":"           help\u003d\u0027Show download progress bar.\u0027)"},{"line_number":128,"context_line":"def do_image_download(gc, args):"},{"line_number":129,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":130,"context_line":"    body, image_size \u003d gc.images.data(args.id, return_size\u003dTrue)"},{"line_number":131,"context_line":"    if args.progress:"},{"line_number":132,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPX%2F%2F8yU%3D","line":129,"in_reply_to":"AAAAPX%2F%2F%2Bzw%3D","updated":"2013-06-05 13:14:06.000000000","message":"Good find, image.to_dict()[\u0027size\u0027] will work on the v1/shell.py but for v2/shell.py if we do this we will endup with two requests gc.images.data and gc.images.get, i am not sure if that can be a performance problem for anyone ! but IMHO i like your suggestion, thanks :)","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"c944a5418eea488886508391b04369ce860c9ecb","unresolved":false,"context_lines":[{"line_number":129,"context_line":"def do_image_download(gc, args):"},{"line_number":130,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":131,"context_line":"    body \u003d gc.images.data(args.id)"},{"line_number":132,"context_line":"    image_size \u003d gc.images.get(args.id)[\u0027size\u0027]"},{"line_number":133,"context_line":"    if args.progress:"},{"line_number":134,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"},{"line_number":135,"context_line":"    utils.save_image(body, args.file)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2F6k8%3D","line":132,"updated":"2013-06-18 11:30:55.000000000","message":"mmh, I\u0027m afraid this won\u0027t work if the response is gzip\u0027d. The size of the image will be higher than the size of the data being downloaded.\n\nWhat do we want in this case? Should we fill the progress bar? or should we hide it?\n\nI still think this approach is not good. We should get the size from the Content-length header and use that as reference. Doing this will help avoiding this kind of corner cases.","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"90954649d91f3babc3ace43633c3b7cd1ba19911","unresolved":false,"context_lines":[{"line_number":129,"context_line":"def do_image_download(gc, args):"},{"line_number":130,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":131,"context_line":"    body \u003d gc.images.data(args.id)"},{"line_number":132,"context_line":"    image_size \u003d gc.images.get(args.id)[\u0027size\u0027]"},{"line_number":133,"context_line":"    if args.progress:"},{"line_number":134,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"},{"line_number":135,"context_line":"    utils.save_image(body, args.file)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2F6kY%3D","line":132,"in_reply_to":"AAAAPn%2F%2F6k8%3D","updated":"2013-06-18 11:36:25.000000000","message":"Hmmm good point","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"41ff14e688c2b58c4a623cbe33d44e3ba0dc76da","unresolved":false,"context_lines":[{"line_number":129,"context_line":"def do_image_download(gc, args):"},{"line_number":130,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":131,"context_line":"    body \u003d gc.images.data(args.id)"},{"line_number":132,"context_line":"    image_size \u003d gc.images.get(args.id)[\u0027size\u0027]"},{"line_number":133,"context_line":"    if args.progress:"},{"line_number":134,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"},{"line_number":135,"context_line":"    utils.save_image(body, args.file)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2Fqes%3D","line":132,"in_reply_to":"AAAAPn%2F%2F6kY%3D","updated":"2013-06-25 17:57:00.000000000","message":"D\u0027oh. . .\n\nThis is my fault, then, since I suggested this approach. I guess we just need to change to having gc.images.data return an iterator or file-like object that optionally supports inspecting the length of the stream (which I\u0027m pretty sure somebody already proposed, I\u0027m just recycling that proposal here.)","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"a5bdacbeef3b815cee8d6fe79312715f8270075f","unresolved":false,"context_lines":[{"line_number":129,"context_line":"def do_image_download(gc, args):"},{"line_number":130,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":131,"context_line":"    body \u003d gc.images.data(args.id)"},{"line_number":132,"context_line":"    image_size \u003d gc.images.get(args.id)[\u0027size\u0027]"},{"line_number":133,"context_line":"    if args.progress:"},{"line_number":134,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"},{"line_number":135,"context_line":"    utils.save_image(body, args.file)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2Ffmc%3D","line":132,"in_reply_to":"AAAAPn%2F%2FoxM%3D","updated":"2013-06-29 15:55:08.000000000","message":"Thanks, Mouad!","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"cb355f1fbd2ef9dc2c46d3e89a7f7fa3f38ab3fe","unresolved":false,"context_lines":[{"line_number":129,"context_line":"def do_image_download(gc, args):"},{"line_number":130,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":131,"context_line":"    body \u003d gc.images.data(args.id)"},{"line_number":132,"context_line":"    image_size \u003d gc.images.get(args.id)[\u0027size\u0027]"},{"line_number":133,"context_line":"    if args.progress:"},{"line_number":134,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"},{"line_number":135,"context_line":"    utils.save_image(body, args.file)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2FoxM%3D","line":132,"in_reply_to":"AAAAPn%2F%2FqZc%3D","updated":"2013-06-26 08:06:16.000000000","message":"I think that could be done, i will try to do this in the next patch.","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"d9c1fcb7ffbdd7ddd4af0b3f5f3a339843ef5894","unresolved":false,"context_lines":[{"line_number":129,"context_line":"def do_image_download(gc, args):"},{"line_number":130,"context_line":"    \"\"\"Download a specific image.\"\"\""},{"line_number":131,"context_line":"    body \u003d gc.images.data(args.id)"},{"line_number":132,"context_line":"    image_size \u003d gc.images.get(args.id)[\u0027size\u0027]"},{"line_number":133,"context_line":"    if args.progress:"},{"line_number":134,"context_line":"        body \u003d progressbar.VerboseIteratorWrapper(body, image_size)"},{"line_number":135,"context_line":"    utils.save_image(body, args.file)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAPn%2F%2FqZc%3D","line":132,"in_reply_to":"AAAAPn%2F%2Fqes%3D","updated":"2013-06-25 18:27:26.000000000","message":"I think we should move the integrity_iter call into BodyResponseIterator and return that instead. We can also have there other data like the size, encoding or whatsoever.\n\nthoughts?","commit_id":"1bd7153c6560ccd1b40cd8a47d80acb2f9c708b5"}],"tests/test_utils.py":[{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"370c5b395b7776e37ba9261de6df5cf32e842ae6","unresolved":false,"context_lines":[{"line_number":129,"context_line":""},{"line_number":130,"context_line":"    def test_get_new_file_size(self):"},{"line_number":131,"context_line":"        size \u003d 98304"},{"line_number":132,"context_line":"        file_obj \u003d StringIO.StringIO()"},{"line_number":133,"context_line":"        file_obj.write(\u0027X\u0027 * size)"},{"line_number":134,"context_line":"        # Rewind to the start of the file."},{"line_number":135,"context_line":"        file_obj.seek(0)"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAOn%2F%2FrSY%3D","line":132,"updated":"2013-04-29 15:23:38.000000000","message":"Reminder for my self :) file_obj \u003d StringIO.StringIO(\u0027X\u0027 * size)","commit_id":"cb5e0966918b1c09247ba2cba67bd40be7d51757"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"370c5b395b7776e37ba9261de6df5cf32e842ae6","unresolved":false,"context_lines":[{"line_number":142,"context_line":""},{"line_number":143,"context_line":"    def test_get_consumed_file_size(self):"},{"line_number":144,"context_line":"        size, consumed \u003d 98304, 304"},{"line_number":145,"context_line":"        file_obj \u003d StringIO.StringIO()"},{"line_number":146,"context_line":"        file_obj.write(\u0027X\u0027 * size)"},{"line_number":147,"context_line":"        file_obj.seek(consumed)"},{"line_number":148,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAOn%2F%2FrSM%3D","line":145,"updated":"2013-04-29 15:23:38.000000000","message":"file_obj \u003d StringIO.StringIO(\u0027X\u0027 * size)","commit_id":"cb5e0966918b1c09247ba2cba67bd40be7d51757"}],"tests/utils.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"40773e3f6056e1132234a1e0535bcabb0d2baf34","unresolved":false,"context_lines":[{"line_number":104,"context_line":"        return True"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def write(self, data):"},{"line_number":107,"context_line":"        # When a CR (carriage return) is found reset file."},{"line_number":108,"context_line":"        if data.startswith(\u0027\\r\u0027):"},{"line_number":109,"context_line":"            self.seek(0)"},{"line_number":110,"context_line":"            data \u003d data[1:]"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fy8Q%3D","line":107,"updated":"2013-05-22 21:15:06.000000000","message":"please add #NOTE(username)","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"},{"author":{"_account_id":7073,"name":"mouad benchchaoui","email":"m.benchchaoui@x-ion.de","username":"mouad"},"change_message_id":"d29cf1944358bf6c44d68abeeae7e80e0cf88aa7","unresolved":false,"context_lines":[{"line_number":104,"context_line":"        return True"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def write(self, data):"},{"line_number":107,"context_line":"        # When a CR (carriage return) is found reset file."},{"line_number":108,"context_line":"        if data.startswith(\u0027\\r\u0027):"},{"line_number":109,"context_line":"            self.seek(0)"},{"line_number":110,"context_line":"            data \u003d data[1:]"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAPH%2F%2Fx0g%3D","line":107,"in_reply_to":"AAAAPH%2F%2Fy8Q%3D","updated":"2013-05-23 13:35:57.000000000","message":"What the rational of this ? does all the comment have to start with NOTE ?","commit_id":"e656c7c6dbff52c892bdf3dccbf2315927c9f57e"}]}
