)]}'
{"swiftclient/multithreading.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"bafe0fd05441f617b0391816b64a30122dbd5b0f","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        if six.PY2:"},{"line_number":78,"context_line":"            stream.write(data)"},{"line_number":79,"context_line":"            stream.flush()"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def print_msg(self, msg, *fmt_args):"},{"line_number":82,"context_line":"        if fmt_args:"},{"line_number":83,"context_line":"            msg \u003d msg % fmt_args"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_505ef745","line":80,"updated":"2015-01-16 15:21:00.000000000","message":"could you add unit tests for above?","commit_id":"7c05fc3be6c478878576fff908c02a76271830ad"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3fc8299354acbe0570fc7b84f8f7d37da3ccc71","unresolved":false,"context_lines":[{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def _write(self, data, stream):"},{"line_number":74,"context_line":"        if six.PY3:"},{"line_number":75,"context_line":"            stream.buffer.write(data)"},{"line_number":76,"context_line":"            stream.flush()"},{"line_number":77,"context_line":"        if six.PY2:"},{"line_number":78,"context_line":"            stream.write(data)"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_8ad1b5fd","line":75,"updated":"2015-01-22 03:21:14.000000000","message":"idk, seems janky\n\nhttps://docs.python.org/2/library/io.html#io.TextIOBase.buffer\n\nI guess by \"not part of the api\" they\u0027re just saying for example a StringIO that replaced sys.stdout may not have a .buffer (which you ran into with the CaptureOutput mocks).\n\nBut it gets even worse:\n\nhttp://bugs.python.org/issue18512\n\nI guess sys.stdout doesn\u0027t really have a good interface to just spew out bytes in python3.\n\nHowever I am pretty sure that having a multithread output manager writing to the buffer out of band and also using print is gunna have a bad time - maybe if you flush after you write but also *right* before?  gah threads :\\\n\nMaybe it helps that we only allow this interface to happen when there\u0027s a single object download?  Maybe the output manager needs a thing where you can just\n\n    with OutputManager.give_me_exclusive_access_to_write():\n        os.write(1, bytes_from_the_wire)","commit_id":"63fee89c22f85bc25171b14d23fe9552d95159be"}],"swiftclient/service.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"bafe0fd05441f617b0391816b64a30122dbd5b0f","unresolved":false,"context_lines":[{"line_number":324,"context_line":"        return self"},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":327,"context_line":"        self._check_contents()"},{"line_number":328,"context_line":""},{"line_number":329,"context_line":"    def _check_contents(self):"},{"line_number":330,"context_line":"        if self._actual_md5 and self._expected_etag:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_433ab3cd","line":327,"updated":"2015-01-16 15:21:00.000000000","message":"Can we do this check at the end of iteration? - as it is, any exception during iteration of the response body is squashed because this check is done as the context exits and fails (when the full body failed to download) informing the user that there\u0027s and etag mismatch but obscuring the actual cause of failure.\n\nSeveral times I have needed to comment out check_contents in order to debug other problems.\n\nIf we can move the check to end of body iteration, then __iter__() and buffer() become the same.\n\nSee e.g. http://paste.openstack.org/show/158267/","commit_id":"7c05fc3be6c478878576fff908c02a76271830ad"}],"swiftclient/shell.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3fc8299354acbe0570fc7b84f8f7d37da3ccc71","unresolved":false,"context_lines":[{"line_number":262,"context_line":"            for down in down_iter:"},{"line_number":263,"context_line":"                if options.out_file \u003d\u003d \u0027-\u0027 and \u0027contents\u0027 in down:"},{"line_number":264,"context_line":"                    contents \u003d down[\u0027contents\u0027]"},{"line_number":265,"context_line":"                    for chunk in contents:"},{"line_number":266,"context_line":"                        output_manager.print_raw(chunk)"},{"line_number":267,"context_line":"                else:"},{"line_number":268,"context_line":"                    if down[\u0027success\u0027]:"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_4a834d04","line":265,"updated":"2015-01-22 03:21:14.000000000","message":"I was going to ask why you don\u0027t have to __enter__ contents before you iter it like _download_object_job does - but then I looked at _SwiftReader\u0027s context manager implementation...\n\nStill... seem like unless you\u0027re going to pull off the interface leaving this guy around as the only place not using it is a bit of a landmine.","commit_id":"63fee89c22f85bc25171b14d23fe9552d95159be"}],"tests/unit/test_shell.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"bafe0fd05441f617b0391816b64a30122dbd5b0f","unresolved":false,"context_lines":[{"line_number":324,"context_line":"            mock_open.assert_called_once_with(\u0027object\u0027, \u0027wb\u0027)"},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"        # Test downloading single object"},{"line_number":327,"context_line":"        objcontent \u003d six.BytesIO(b\u0027objcontent\u0027)"},{"line_number":328,"context_line":"        connection.return_value.get_object.side_effect \u003d ["},{"line_number":329,"context_line":"            ({\u0027content-type\u0027: \u0027text/plain\u0027,"},{"line_number":330,"context_line":"              \u0027etag\u0027: \u00272cbbfe139a744d6abbe695e17f3c1991\u0027},"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_10daaf4a","line":327,"updated":"2015-01-16 15:21:00.000000000","message":"nit: unnecessary reassignment","commit_id":"7c05fc3be6c478878576fff908c02a76271830ad"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"bafe0fd05441f617b0391816b64a30122dbd5b0f","unresolved":false,"context_lines":[{"line_number":339,"context_line":"            mock_open.assert_called_with(\u0027object\u0027, \u0027wb\u0027)"},{"line_number":340,"context_line":""},{"line_number":341,"context_line":"        # Test downloading single object to stdout"},{"line_number":342,"context_line":"        objcontent \u003d six.BytesIO(b\u0027objcontent\u0027)"},{"line_number":343,"context_line":"        connection.return_value.get_object.side_effect \u003d ["},{"line_number":344,"context_line":"            ({\u0027content-type\u0027: \u0027text/plain\u0027,"},{"line_number":345,"context_line":"              \u0027etag\u0027: \u00272cbbfe139a744d6abbe695e17f3c1991\u0027},"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_b0e8fbdf","line":342,"updated":"2015-01-16 15:21:00.000000000","message":"nit ditto","commit_id":"7c05fc3be6c478878576fff908c02a76271830ad"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"bafe0fd05441f617b0391816b64a30122dbd5b0f","unresolved":false,"context_lines":[{"line_number":346,"context_line":"             objcontent)"},{"line_number":347,"context_line":"        ]"},{"line_number":348,"context_line":"        with mock.patch("},{"line_number":349,"context_line":"                \u0027swiftclient.multithreading.OutputManager._write\u0027) as mock_w:"},{"line_number":350,"context_line":"            argv \u003d [\"\", \"download\", \"--output\", \"-\", \"container\", \"object\"]"},{"line_number":351,"context_line":"            swiftclient.shell.main(argv)"},{"line_number":352,"context_line":"            mock_w.assert_called_once_with(b\u0027objcontent\u0027, sys.stdout)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_83b57b33","line":349,"updated":"2015-01-16 15:21:00.000000000","message":"I think CaptureOutput() could be used here (see http://paste.openstack.org/show/158267/)","commit_id":"7c05fc3be6c478878576fff908c02a76271830ad"}],"tests/unit/utils.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3fc8299354acbe0570fc7b84f8f7d37da3ccc71","unresolved":false,"context_lines":[{"line_number":343,"context_line":"class CaptureStreamBuffer(object):"},{"line_number":344,"context_line":"    \"\"\""},{"line_number":345,"context_line":"    CaptureStreamBuffer is used for testing raw byte writing for PY3. Anything"},{"line_number":346,"context_line":"    written here is decoded as utf-8 and written to the parent CaptureStream"},{"line_number":347,"context_line":"    \"\"\""},{"line_number":348,"context_line":"    def __init__(self, captured_stream):"},{"line_number":349,"context_line":"        self._captured_stream \u003d captured_stream"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_2a660152","line":346,"updated":"2015-01-22 03:21:14.000000000","message":"Isn\u0027t the whole point that *anything* could be in the object body - and it may not decode utf-8?  I sorta liked it better maybe as just capturing the raw bytes in the raw BytesIO without writing anything back out to StringIO guy maybe...","commit_id":"63fee89c22f85bc25171b14d23fe9552d95159be"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"a0884b892fa104ebea57f62c28af5438fba2fc84","unresolved":false,"context_lines":[{"line_number":347,"context_line":"    \"\"\""},{"line_number":348,"context_line":"    def __init__(self, captured_stream):"},{"line_number":349,"context_line":"        self._captured_stream \u003d captured_stream"},{"line_number":350,"context_line":"        self._buffer \u003d six.BytesIO()"},{"line_number":351,"context_line":""},{"line_number":352,"context_line":"    def write(self, bytes_data):"},{"line_number":353,"context_line":"        self._buffer.write(bytes_data)"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_66eea1ee","line":350,"updated":"2015-01-21 12:57:25.000000000","message":"nit: looks like _buffer is never read so is redundant but no need to change unless making other changes","commit_id":"63fee89c22f85bc25171b14d23fe9552d95159be"}]}
