)]}'
{"swift/common/utils.py":[{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"1155db62494177db7acedafafe23395c6bd4c80f","unresolved":false,"context_lines":[{"line_number":264,"context_line":"            raise ValueError(\u0027I/O operation on closed file\u0027)"},{"line_number":265,"context_line":"        data \u003d \u0027\u0027"},{"line_number":266,"context_line":"        while \u0027\\n\u0027 not in data and (size \u003c 1 or len(data) \u003c size):"},{"line_number":267,"context_line":"            chunk \u003d self.read(size)"},{"line_number":268,"context_line":"            if not chunk:"},{"line_number":269,"context_line":"                break"},{"line_number":270,"context_line":"            data +\u003d chunk"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAPn%2F%2F3B0%3D","line":267,"updated":"2013-06-19 17:02:56.000000000","message":"What the docstring says is not true: this method may return more than a specified non-negative size argument number of bytes.  I think this would fix it:\n\n  chunk \u003d self.read(size - len(data))\n\nExample breakage:\n\n  \u003e\u003e\u003e i \u003d [\u0027abc\u0027, \u0027def\\n\u0027, \u0027ghij\\n\u0027, \u0027klmn\u0027, \u0027opqrs\u0027, \u0027tuv\u0027]\n  \u003e\u003e\u003e f \u003d swift.common.utils.FileLikeIter(i)\n  \u003e\u003e\u003e f.readline(4)\n  \u0027abcdef\\n\u0027\n  \u003e\u003e\u003e len(_)\n  7\n  \u003e\u003e\u003e","commit_id":"630c252865d448c11e32e200a69ee62a3479c134"},{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"1155db62494177db7acedafafe23395c6bd4c80f","unresolved":false,"context_lines":[{"line_number":283,"context_line":""},{"line_number":284,"context_line":"        Call readline() repeatedly and return a list of the lines so read."},{"line_number":285,"context_line":"        The optional size argument, if given, is an approximate bound on the"},{"line_number":286,"context_line":"        total number of bytes in the lines returned."},{"line_number":287,"context_line":"        \"\"\""},{"line_number":288,"context_line":"        if self.closed:"},{"line_number":289,"context_line":"            raise ValueError(\u0027I/O operation on closed file\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAPn%2F%2F2%2F4%3D","line":286,"updated":"2013-06-19 17:02:56.000000000","message":"It looks like the implementation only worries about the length of each line.  The docstring should probably read like this if the above suggestion re: readlines() is taken:\n\n  The optional size argument, if given, is a bound on the number\n  of bytes in each line returned.\n\nOr this, if readline() is left alone and only its docstring fixed:\n\n  The optional size argument, if given, is an approximate bound on\n  the number of bytes in each line returned.\n\nOr if what this docstring says is intended, the implementation could be changed to something like:\n\n  total_bytes \u003d 0\n  lines \u003d []\n  while sizehint \u003c 0 or total_bytes \u003c sizehint:\n      line \u003d self.readline(sizehint)\n      if not line:\n          break\n      lines.append(line)\n      total_bytes +\u003d len(line)\n  return lines\n\nAnd if you wanted to drop the \"approximate\" bit, you could make the call to readline look like\n\n      line \u003d self.readline(sizehint - total_bytes)","commit_id":"630c252865d448c11e32e200a69ee62a3479c134"},{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"93e3b8ad3f7b53dca428b291a6c43fd355ff8776","unresolved":false,"context_lines":[{"line_number":267,"context_line":"            if size \u003c 0:"},{"line_number":268,"context_line":"                chunk \u003d self.read(1024)"},{"line_number":269,"context_line":"            else:"},{"line_number":270,"context_line":"                chunk \u003d self.read(max(0, size - len(data)))"},{"line_number":271,"context_line":"            if not chunk:"},{"line_number":272,"context_line":"                break"},{"line_number":273,"context_line":"            data +\u003d chunk"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAPn%2F%2F2w8%3D","line":270,"updated":"2013-06-19 18:10:48.000000000","message":"If you get here, size \u003e\u003d 0 so the while loop predicate guarantees you a size - len(data) value \u003e 0.  This seems simpler:\n\n  ...\n  if size \u003c 0:\n      chunk \u003d self.read(1024)\n  else:\n      chunk \u003d self.read(size - len(data))","commit_id":"455c703deea5f46f8d5e08a9969de0e21b69ae46"}],"test/unit/common/test_utils.py":[{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"93e3b8ad3f7b53dca428b291a6c43fd355ff8776","unresolved":false,"context_lines":[{"line_number":1412,"context_line":"                break"},{"line_number":1413,"context_line":"            lines.append(line)"},{"line_number":1414,"context_line":"        self.assertEquals("},{"line_number":1415,"context_line":"            lines, list(self._splitby2ornewline(\u0027\u0027.join(in_iter))))"},{"line_number":1416,"context_line":""},{"line_number":1417,"context_line":"    def test_readlines(self):"},{"line_number":1418,"context_line":"        in_iter \u003d [\u0027abc\\n\u0027, \u0027d\u0027, \u0027\\nef\u0027, \u0027g\\nh\u0027, \u0027\\nij\\n\\nk\\n\u0027, \u0027trailing.\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAPn%2F%2F2wQ%3D","line":1415,"updated":"2013-06-19 18:10:48.000000000","message":"I think this would read more clearly if the expected was just inlined (like test_readlines_with_size does below).","commit_id":"455c703deea5f46f8d5e08a9969de0e21b69ae46"}]}
