)]}'
{"openstack/exceptions.py":[{"author":{"_account_id":8246,"name":"Qiming Teng","email":"tengqm@outlook.com","username":"tengqm"},"change_message_id":"c94946c9d5ffa599cc859afc92146f5e4e2cfdd4","unresolved":false,"context_lines":[{"line_number":114,"context_line":""},{"line_number":115,"context_line":"def from_exception(exc):"},{"line_number":116,"context_line":"    \"\"\"Return an instance of an HTTPException based on httplib response.\"\"\""},{"line_number":117,"context_line":"    cls \u003d NotFoundException if ("},{"line_number":118,"context_line":"        exc.response.status_code \u003d\u003d 404) else HttpException"},{"line_number":119,"context_line":"    details \u003d None"},{"line_number":120,"context_line":"    resp \u003d exc.response"},{"line_number":121,"context_line":"    resp_body \u003d exc.response.content"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a3c09a3_2fe1d69a","line":118,"range":{"start_line":117,"start_character":0,"end_line":118,"end_character":59},"updated":"2017-01-17 02:42:23.000000000","message":"this code reads very strange, can we just do:\n\n  if exc.response.status_code \u003d\u003d 404:\n     cls \u003d NotFoundException\n  else:\n     cls \u003d HttpException","commit_id":"ea366b2e938fe372bff85d9465255d3379034f0f"},{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"7adaa808705a53ed96cff457dccb753cd3838412","unresolved":false,"context_lines":[{"line_number":114,"context_line":""},{"line_number":115,"context_line":"def from_exception(exc):"},{"line_number":116,"context_line":"    \"\"\"Return an instance of an HTTPException based on httplib response.\"\"\""},{"line_number":117,"context_line":"    cls \u003d NotFoundException if ("},{"line_number":118,"context_line":"        exc.response.status_code \u003d\u003d 404) else HttpException"},{"line_number":119,"context_line":"    details \u003d None"},{"line_number":120,"context_line":"    resp \u003d exc.response"},{"line_number":121,"context_line":"    resp_body \u003d exc.response.content"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a3c09a3_16b42080","line":118,"range":{"start_line":117,"start_character":0,"end_line":118,"end_character":59},"in_reply_to":"7a3c09a3_2fe1d69a","updated":"2017-01-17 12:51:54.000000000","message":"Agreed. This would be fine as a true one-liner but doesn\u0027t work as well being split.","commit_id":"ea366b2e938fe372bff85d9465255d3379034f0f"},{"author":{"_account_id":8246,"name":"Qiming Teng","email":"tengqm@outlook.com","username":"tengqm"},"change_message_id":"c94946c9d5ffa599cc859afc92146f5e4e2cfdd4","unresolved":false,"context_lines":[{"line_number":120,"context_line":"    resp \u003d exc.response"},{"line_number":121,"context_line":"    resp_body \u003d exc.response.content"},{"line_number":122,"context_line":"    content_type \u003d resp.headers.get(\u0027content-type\u0027, \u0027\u0027)"},{"line_number":123,"context_line":"    if resp_body and \u0027json\u0027 in content_type:"},{"line_number":124,"context_line":"        # Iterate over the nested objects and retrieve the \"message\" attribute."},{"line_number":125,"context_line":"        messages \u003d [obj.get(\u0027message\u0027) for obj in resp.json().values()]"},{"line_number":126,"context_line":"        # Join all of the messages together nicely and filter out any objects"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a3c09a3_2f8f16cd","line":123,"range":{"start_line":123,"start_character":20,"end_line":123,"end_character":43},"updated":"2017-01-17 02:42:23.000000000","message":"just curious why don\u0027t we just check \u0027application/json\u0027? Would this leave a hole for something unexpected?","commit_id":"ea366b2e938fe372bff85d9465255d3379034f0f"},{"author":{"_account_id":8246,"name":"Qiming Teng","email":"tengqm@outlook.com","username":"tengqm"},"change_message_id":"c94946c9d5ffa599cc859afc92146f5e4e2cfdd4","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # that don\u0027t have a \"message\" attr."},{"line_number":128,"context_line":"        details \u003d \u0027\\n\u0027.join(i for i in messages if i is not None)"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"    elif resp_body and \u0027html\u0027 in content_type:"},{"line_number":131,"context_line":"        # Split the lines, strip whitespace and inline HTML from the response."},{"line_number":132,"context_line":"        details \u003d [re.sub(r\u0027\u003c.+?\u003e\u0027, \u0027\u0027, i.strip())"},{"line_number":133,"context_line":"                   for i in resp.text.splitlines()]"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a3c09a3_ef76eed5","line":130,"range":{"start_line":130,"start_character":23,"end_line":130,"end_character":46},"updated":"2017-01-17 02:42:23.000000000","message":"can we be stricter about this?\n\n   \u0027application/html\u0027 in content_type","commit_id":"ea366b2e938fe372bff85d9465255d3379034f0f"},{"author":{"_account_id":8246,"name":"Qiming Teng","email":"tengqm@outlook.com","username":"tengqm"},"change_message_id":"c94946c9d5ffa599cc859afc92146f5e4e2cfdd4","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            if i not in details_temp:"},{"line_number":139,"context_line":"                details_temp.append(i)"},{"line_number":140,"context_line":"        # Return joined string separated by colons."},{"line_number":141,"context_line":"        details \u003d \u0027: \u0027.join(details_temp)"},{"line_number":142,"context_line":"    return cls(details\u003ddetails, message\u003dexc.message, response\u003dexc.response,"},{"line_number":143,"context_line":"               request_id\u003dexc.request_id, url\u003dexc.url, method\u003dexc.method,"},{"line_number":144,"context_line":"               http_status\u003dexc.http_status, cause\u003dexc)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a3c09a3_cf2772c8","line":141,"range":{"start_line":141,"start_character":17,"end_line":141,"end_character":22},"updated":"2017-01-17 02:42:23.000000000","message":"using colons as separator is terrible, but anyway, if it works that way...","commit_id":"ea366b2e938fe372bff85d9465255d3379034f0f"},{"author":{"_account_id":8246,"name":"Qiming Teng","email":"tengqm@outlook.com","username":"tengqm"},"change_message_id":"c94946c9d5ffa599cc859afc92146f5e4e2cfdd4","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                details_temp.append(i)"},{"line_number":140,"context_line":"        # Return joined string separated by colons."},{"line_number":141,"context_line":"        details \u003d \u0027: \u0027.join(details_temp)"},{"line_number":142,"context_line":"    return cls(details\u003ddetails, message\u003dexc.message, response\u003dexc.response,"},{"line_number":143,"context_line":"               request_id\u003dexc.request_id, url\u003dexc.url, method\u003dexc.method,"},{"line_number":144,"context_line":"               http_status\u003dexc.http_status, cause\u003dexc)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a3c09a3_ca6a00b3","line":142,"range":{"start_line":142,"start_character":23,"end_line":142,"end_character":30},"updated":"2017-01-17 02:42:23.000000000","message":"the above logic only handles the case that resp_body is not None and the content-type is either JSON or HTML. In all other cases, we are swallowing the \u0027details\u0027.\n\nCan we just simply copy the resp.text directly into details if so?","commit_id":"ea366b2e938fe372bff85d9465255d3379034f0f"}]}
