)]}'
{"swift/common/constraints.py":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"667ebb373a716678f538735577ac56f481a0b08a","unresolved":false,"context_lines":[{"line_number":145,"context_line":"            return HTTPBadRequest(body\u003d\u0027Metadata name cannot be empty\u0027,"},{"line_number":146,"context_line":"                                  request\u003dreq, content_type\u003d\u0027text/plain\u0027)"},{"line_number":147,"context_line":"        bad_key \u003d not check_utf8(key)"},{"line_number":148,"context_line":"        bad_value \u003d value and not check_utf8(value)"},{"line_number":149,"context_line":"        if target_type in (\u0027account\u0027, \u0027container\u0027) and (bad_key or bad_value):"},{"line_number":150,"context_line":"            return HTTPBadRequest(body\u003d\u0027Metadata must be valid UTF-8\u0027,"},{"line_number":151,"context_line":"                                  request\u003dreq, content_type\u003d\u0027text/plain\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_48f80f7b","line":148,"updated":"2018-06-20 23:53:36.000000000","message":"Under py3, headers and request lines are always decoded from latin1 -- can these ever check_utf8 ever return false?","commit_id":"7ba3b1518668f42e9e27380cbff80fc85d80406c"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"667ebb373a716678f538735577ac56f481a0b08a","unresolved":false,"context_lines":[{"line_number":198,"context_line":"                                         request\u003dreq,"},{"line_number":199,"context_line":"                                         content_type\u003d\u0027text/plain\u0027)"},{"line_number":200,"context_line":"    if req.content_length is None and \\"},{"line_number":201,"context_line":"            req.headers.get(\u0027transfer-encoding\u0027) !\u003d b\u0027chunked\u0027:"},{"line_number":202,"context_line":"        return HTTPLengthRequired(body\u003d\u0027Missing Content-Length header.\u0027,"},{"line_number":203,"context_line":"                                  request\u003dreq,"},{"line_number":204,"context_line":"                                  content_type\u003d\u0027text/plain\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_e2cfbdb0","line":201,"updated":"2018-06-20 23:53:36.000000000","message":"Hmm...\n\nWSGI strings should always be bytes on py2 and unicode on py3 -- how\u0027d we end up with bytes on py3?","commit_id":"7ba3b1518668f42e9e27380cbff80fc85d80406c"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"667ebb373a716678f538735577ac56f481a0b08a","unresolved":false,"context_lines":[{"line_number":362,"context_line":"        return False"},{"line_number":363,"context_line":"    try:"},{"line_number":364,"context_line":"        if isinstance(string, six.text_type):"},{"line_number":365,"context_line":"            encoded \u003d string.encode(\u0027utf-8\u0027)"},{"line_number":366,"context_line":"        else:"},{"line_number":367,"context_line":"            encoded \u003d string"},{"line_number":368,"context_line":"            decoded \u003d string.decode(\u0027UTF-8\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_e5bfc6cd","line":365,"updated":"2018-06-20 23:53:36.000000000","message":"We never use string again after this -- we could just do\n\n string \u003d string.encode(\u0027utf8\u0027)\n\nand keep comparing against string below... but maybe there\u0027s something to be said for being more explicit.","commit_id":"7ba3b1518668f42e9e27380cbff80fc85d80406c"}],"swift/common/swob.py":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"667ebb373a716678f538735577ac56f481a0b08a","unresolved":false,"context_lines":[{"line_number":218,"context_line":"                    doc\u003d\"Retrieve and set the %s header as an int\" % header)"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"def convert_string(is_binary, string):"},{"line_number":222,"context_line":"    if is_binary:"},{"line_number":223,"context_line":"        return string.encode(\u0027utf8\u0027)"},{"line_number":224,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_0543e2b1","line":221,"updated":"2018-06-20 23:53:36.000000000","message":"Seems like we always use this with functools.partial -- better to have something like\n\n def make_string_matcher(reference_string):\n     is_binary \u003d isinstance(reference_string, six.binary_type)\n     def convert_string(string):\n         if is_binary:\n             return string.encode(\u0027utf8\u0027)\n         else:\n             return string\n     return convert_string\n\n?\n\nSeparately, I\u0027m a little nervous about what happens when our reference string is unicode but our string to convert is binary... but maybe that never comes up in practice?\n\nFWIW, in messing around with it, I came up with an alternate (pair of) helpers:\n\n def str_from_wsgi(wsgi_str):\n     if six.PY2:\n         return wsgi_str\n     return wsgi_str.encode(\u0027latin1\u0027).decode(\u0027utf8\u0027, errors\u003d\u0027surrogateescape\u0027)\n\n def str_to_wsgi(native_str):\n     if six.PY2:\n         return native_str\n     return native_str.encode(\u0027utf8\u0027, errors\u003d\u0027surrogateescape\u0027).decode(\u0027latin1\u0027)\n\nThe more I\u0027ve played with py3, the more I\u0027ve come to think there\u0027s value in thinking about *four* string types:\n\n- byte strings,\n- unicode strings,\n- native strings (so, bytes on py2, unicode on py3), and\n- \"wsgi strings\", which are a funny way to map bytes on the wire to native strings.\n\nI *think* having explicit functions for flopping back and forth works out pretty well?","commit_id":"7ba3b1518668f42e9e27380cbff80fc85d80406c"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"667ebb373a716678f538735577ac56f481a0b08a","unresolved":false,"context_lines":[{"line_number":267,"context_line":"        elif isinstance(value, six.text_type):"},{"line_number":268,"context_line":"            self.environ[header_to_environ_key(key)] \u003d value.encode(\u0027utf-8\u0027)"},{"line_number":269,"context_line":"        elif isinstance(value, six.binary_type):"},{"line_number":270,"context_line":"            self.environ[header_to_environ_key(key)] \u003d value"},{"line_number":271,"context_line":"        else:"},{"line_number":272,"context_line":"            self.environ[header_to_environ_key(key)] \u003d str(value)"},{"line_number":273,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_683aab34","line":270,"updated":"2018-06-20 23:53:36.000000000","message":"I don\u0027t think this is the right thing to do on py3...","commit_id":"7ba3b1518668f42e9e27380cbff80fc85d80406c"}]}
