)]}'
{"openstack/common/jsonutils.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"c981c1916b92ad13bf80c9bb0dbf05e06b496aab","unresolved":false,"context_lines":[{"line_number":92,"context_line":"        return value"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    value_type \u003d type(value)"},{"line_number":95,"context_line":"    if value_type is int:"},{"line_number":96,"context_line":"        return value"},{"line_number":97,"context_line":"    elif value_type is unicode:"},{"line_number":98,"context_line":"        return value"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2B0uk%3D","line":95,"updated":"2013-02-18 14:56:40.000000000","message":"Since the result for None, int, unicode, str, bool, float, and long are all the same you could combine those tests and eliminate some opcodes:\n\n  if isinstance(value, (types.NoneType, int, basestring, bool, float, long)):\n    return value","commit_id":"e1816c660b23de2c65b7cea75276c71589d02b79"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"374ad81e27cdb68fa60662d6439b97a78dbd51ae","unresolved":false,"context_lines":[{"line_number":92,"context_line":"        return value"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    value_type \u003d type(value)"},{"line_number":95,"context_line":"    if value_type is int:"},{"line_number":96,"context_line":"        return value"},{"line_number":97,"context_line":"    elif value_type is unicode:"},{"line_number":98,"context_line":"        return value"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2B0i4%3D","line":95,"in_reply_to":"AAAAM3%2F%2B0uk%3D","updated":"2013-02-18 16:14:08.000000000","message":"I tried to optimise this aggressively for probable results. I\u0027ll check if there\u0027s any difference in execution times (isinstance will try to expand all parent classes and compare against them... which should be a NOOP for base types, but it\u0027s better to check)","commit_id":"e1816c660b23de2c65b7cea75276c71589d02b79"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"c981c1916b92ad13bf80c9bb0dbf05e06b496aab","unresolved":false,"context_lines":[{"line_number":157,"context_line":"            # Ignore class member vars."},{"line_number":158,"context_line":"            return recursive(value.__dict__, level\u003dlevel + 1)"},{"line_number":159,"context_line":"        else:"},{"line_number":160,"context_line":"            for test in nasty_type_tests:"},{"line_number":161,"context_line":"                if test(value):"},{"line_number":162,"context_line":"                    return unicode(value)"},{"line_number":163,"context_line":"            return value"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2B0tA%3D","line":160,"updated":"2013-02-18 14:56:40.000000000","message":"if any(test(value) for test in nasty_type_tests):\n    return unicode(value)","commit_id":"e1816c660b23de2c65b7cea75276c71589d02b79"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"5d00f1c831e855fd3a4b00d0855d4bb259d677b4","unresolved":false,"context_lines":[{"line_number":157,"context_line":"            # Ignore class member vars."},{"line_number":158,"context_line":"            return recursive(value.__dict__, level\u003dlevel + 1)"},{"line_number":159,"context_line":"        else:"},{"line_number":160,"context_line":"            for test in nasty_type_tests:"},{"line_number":161,"context_line":"                if test(value):"},{"line_number":162,"context_line":"                    return unicode(value)"},{"line_number":163,"context_line":"            return value"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2B0c0%3D","line":160,"in_reply_to":"AAAAM3%2F%2B0jg%3D","updated":"2013-02-18 16:35:57.000000000","message":"I think any() will be a tiny bit faster because the iteration will happen in C instead of the for loop.","commit_id":"e1816c660b23de2c65b7cea75276c71589d02b79"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"374ad81e27cdb68fa60662d6439b97a78dbd51ae","unresolved":false,"context_lines":[{"line_number":157,"context_line":"            # Ignore class member vars."},{"line_number":158,"context_line":"            return recursive(value.__dict__, level\u003dlevel + 1)"},{"line_number":159,"context_line":"        else:"},{"line_number":160,"context_line":"            for test in nasty_type_tests:"},{"line_number":161,"context_line":"                if test(value):"},{"line_number":162,"context_line":"                    return unicode(value)"},{"line_number":163,"context_line":"            return value"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2B0jg%3D","line":160,"in_reply_to":"AAAAM3%2F%2B0tA%3D","updated":"2013-02-18 16:14:08.000000000","message":"True. I just copied from previous version, but it could be nicer.","commit_id":"e1816c660b23de2c65b7cea75276c71589d02b79"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"37744ffca5b6fa0e5fc0b2362a4ee8bd2a7aa410","unresolved":false,"context_lines":[{"line_number":50,"context_line":"                    inspect.iscode, inspect.isbuiltin, inspect.isroutine,"},{"line_number":51,"context_line":"                    inspect.isabstract]"},{"line_number":52,"context_line":""},{"line_number":53,"context_line":"simple_types \u003d (types.NoneType, int, basestring, bool, float, long)"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2Fls%3D","line":53,"updated":"2013-04-08 21:43:38.000000000","message":"If you do another go-round of this patch, please underscore prefix these variable names - they\u0027re not part of the public API of this module","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"0e520c9f2d11931e17d7f7714cc79bc4861b73c0","unresolved":false,"context_lines":[{"line_number":50,"context_line":"                    inspect.iscode, inspect.isbuiltin, inspect.isroutine,"},{"line_number":51,"context_line":"                    inspect.isabstract]"},{"line_number":52,"context_line":""},{"line_number":53,"context_line":"simple_types \u003d (types.NoneType, int, basestring, bool, float, long)"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2Ffw%3D","line":53,"in_reply_to":"AAAAOn%2F%2F%2Fls%3D","updated":"2013-04-08 22:32:09.000000000","message":"Will do.","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"37744ffca5b6fa0e5fc0b2362a4ee8bd2a7aa410","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    \"\"\""},{"line_number":71,"context_line":"    if level \u003e max_depth:"},{"line_number":72,"context_line":"        return \u0027?\u0027"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    # handle obvious types first - order of basic types determined by running"},{"line_number":75,"context_line":"    # full tests on nova project, resulting in the following counts:"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2FlQ%3D","line":72,"updated":"2013-04-08 21:43:38.000000000","message":"Hmm, moving this isn\u0027t a non-functional change and doesn\u0027t seem like an optimization\n\nWhat\u0027s the idea with doing this?","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"0e520c9f2d11931e17d7f7714cc79bc4861b73c0","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    \"\"\""},{"line_number":71,"context_line":"    if level \u003e max_depth:"},{"line_number":72,"context_line":"        return \u0027?\u0027"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    # handle obvious types first - order of basic types determined by running"},{"line_number":75,"context_line":"    # full tests on nova project, resulting in the following counts:"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2Ff4%3D","line":72,"in_reply_to":"AAAAOn%2F%2F%2FlQ%3D","updated":"2013-04-08 22:32:09.000000000","message":"This was supposed to be moved between the simple types and dicts/lists actually - thanks for catching it. Recursive types happen earlier so this check had to be moved too.","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"change_message_id":"595bcc39a34024bec36edc9285f5dc8b904b63b9","unresolved":false,"context_lines":[{"line_number":87,"context_line":"    if isinstance(value, simple_types):"},{"line_number":88,"context_line":"        return value"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"    value_type \u003d type(value)"},{"line_number":91,"context_line":"    if value_type is datetime.datetime:"},{"line_number":92,"context_line":"        if convert_datetime:"},{"line_number":93,"context_line":"            return timeutils.strtime(value)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2FRI%3D","line":90,"updated":"2013-04-09 00:15:50.000000000","message":"Do we need this value_type? Is there a case where isinstance cannot be used?","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"},{"author":{"_account_id":1247,"name":"Mark McLoughlin","email":"markmc@redhat.com","username":"markmc"},"change_message_id":"37744ffca5b6fa0e5fc0b2362a4ee8bd2a7aa410","unresolved":false,"context_lines":[{"line_number":101,"context_line":"                                  max_depth\u003dmax_depth)"},{"line_number":102,"context_line":"    if value_type is dict:"},{"line_number":103,"context_line":"        return dict((k, recursive(dv)) for k, dv in value.iteritems())"},{"line_number":104,"context_line":"    if value_type is list or value_type is tuple:"},{"line_number":105,"context_line":"        return [recursive(lv) for lv in value]"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"    # value of itertools.count doesn\u0027t get caught by inspects"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2FlA%3D","line":104,"updated":"2013-04-08 21:43:38.000000000","message":"Looks like Doug\u0027s comment applies here too, could be:\n\n  isinstance(value, (list, tuple))","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"},{"author":{"_account_id":1528,"name":"Stanislaw Pitucha","email":"viraptor@gmail.com","username":"stanislaw-pitucha"},"change_message_id":"0e520c9f2d11931e17d7f7714cc79bc4861b73c0","unresolved":false,"context_lines":[{"line_number":101,"context_line":"                                  max_depth\u003dmax_depth)"},{"line_number":102,"context_line":"    if value_type is dict:"},{"line_number":103,"context_line":"        return dict((k, recursive(dv)) for k, dv in value.iteritems())"},{"line_number":104,"context_line":"    if value_type is list or value_type is tuple:"},{"line_number":105,"context_line":"        return [recursive(lv) for lv in value]"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"    # value of itertools.count doesn\u0027t get caught by inspects"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2F%2Fd8%3D","line":104,"in_reply_to":"AAAAOn%2F%2F%2FlA%3D","updated":"2013-04-08 22:32:09.000000000","message":"I was worried about types that inherit dict, but don\u0027t behave nicely when iterated for example. This code can live outside of the \"try\" block because the types are exactly list/tuple/dict.\n\nBut this is a good point actually - since (list, tuple) and dict are already handled below and checks before are \"cheap\", I\u0027ll just remove these special cases and reorder the first 3 checks below to be \"dict, (list,tuple), DateTime\".","commit_id":"88c2e93afd4e4044a214daa38a8fa26501b143cc"}]}
