)]}'
{"swift/cli/info.py":[{"author":{"_account_id":1216,"name":"gholt","email":"z-launchpad@brim.net","username":"gholt"},"change_message_id":"8af44cfccacc3cc3bb02547e034f6b164459a970","unresolved":false,"context_lines":[{"line_number":240,"context_line":"def print_obj_metadata(metadata):"},{"line_number":241,"context_line":"    \"\"\""},{"line_number":242,"context_line":"    print object metadata"},{"line_number":243,"context_line":"    \"\"\""},{"line_number":244,"context_line":"    if not metadata:"},{"line_number":245,"context_line":"        raise ValueError(\u0027Metadata is None\u0027)"},{"line_number":246,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_d902403d","line":243,"updated":"2014-06-12 15:53:09.000000000","message":"Useless docstring","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3cb3630baaa537d823d9d798951bd4327733661","unresolved":false,"context_lines":[{"line_number":240,"context_line":"def print_obj_metadata(metadata):"},{"line_number":241,"context_line":"    \"\"\""},{"line_number":242,"context_line":"    print object metadata"},{"line_number":243,"context_line":"    \"\"\""},{"line_number":244,"context_line":"    if not metadata:"},{"line_number":245,"context_line":"        raise ValueError(\u0027Metadata is None\u0027)"},{"line_number":246,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_a4bb76c2","line":243,"in_reply_to":"1ae5cdf2_d902403d","updated":"2014-06-13 09:03:17.000000000","message":"lol\n\nman i messed up the author on that commit - that was all Sam and Yuan, I\u0027ll try to make the doc string more useful.","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1216,"name":"gholt","email":"z-launchpad@brim.net","username":"gholt"},"change_message_id":"8133473cffe7ca7db2b574f02caa4f0d68c77819","unresolved":false,"context_lines":[{"line_number":268,"context_line":"            print \u0027Timestamp: Not found in metadata\u0027"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"        print \u0027User Metadata: %s\u0027 % metadata"},{"line_number":271,"context_line":"    except:"},{"line_number":272,"context_line":"        raise ValueError(\u0027object metadata error\u0027)"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_c37b2ef3","line":271,"updated":"2014-06-12 17:01:30.000000000","message":"Should not use bare excepts","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3cb3630baaa537d823d9d798951bd4327733661","unresolved":false,"context_lines":[{"line_number":268,"context_line":"            print \u0027Timestamp: Not found in metadata\u0027"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"        print \u0027User Metadata: %s\u0027 % metadata"},{"line_number":271,"context_line":"    except:"},{"line_number":272,"context_line":"        raise ValueError(\u0027object metadata error\u0027)"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_2aac8dec","line":271,"in_reply_to":"1ae5cdf2_c37b2ef3","updated":"2014-06-13 09:03:17.000000000","message":"Done","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1216,"name":"gholt","email":"z-launchpad@brim.net","username":"gholt"},"change_message_id":"8133473cffe7ca7db2b574f02caa4f0d68c77819","unresolved":false,"context_lines":[{"line_number":411,"context_line":"        try:"},{"line_number":412,"context_line":"            if ring_name !\u003d (POLICIES.get_by_name(policy_name)).ring_name:"},{"line_number":413,"context_line":"                print \u0027Attention! mismatch between ring and policy detected!\u0027"},{"line_number":414,"context_line":"        except:"},{"line_number":415,"context_line":"            print \u0027policy %s is not valid\u0027 % policy_name"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"    if ring is None and (obj or part):"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_436f1e2b","line":414,"updated":"2014-06-12 17:01:30.000000000","message":"Should not use bare excepts","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3cb3630baaa537d823d9d798951bd4327733661","unresolved":false,"context_lines":[{"line_number":411,"context_line":"        try:"},{"line_number":412,"context_line":"            if ring_name !\u003d (POLICIES.get_by_name(policy_name)).ring_name:"},{"line_number":413,"context_line":"                print \u0027Attention! mismatch between ring and policy detected!\u0027"},{"line_number":414,"context_line":"        except:"},{"line_number":415,"context_line":"            print \u0027policy %s is not valid\u0027 % policy_name"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"    if ring is None and (obj or part):"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_8a84c15e","line":414,"in_reply_to":"1ae5cdf2_436f1e2b","updated":"2014-06-13 09:03:17.000000000","message":"Done","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"}],"swift/common/utils.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"8edd6269889e8f5f9eb04ff629e34ed919376e0a","unresolved":false,"context_lines":[{"line_number":2713,"context_line":"    extract storage policy index from object path"},{"line_number":2714,"context_line":"    \"\"\""},{"line_number":2715,"context_line":"    #/srv/node/device/objects-dir/part/sufix/hash/timestamp.data"},{"line_number":2716,"context_line":"    datadir_path \u003d os.path.abspath(os.path.join(path, \u0027../../../../\u0027))"},{"line_number":2717,"context_line":"    datadir \u003d os.path.basename(datadir_path)"},{"line_number":2718,"context_line":""},{"line_number":2719,"context_line":"    if datadir \u003d\u003d \u0027objects\u0027:"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_b16f5f91","line":2716,"updated":"2014-06-12 04:41:26.000000000","message":"I see that this woks, but the joining with \"../../../../\" looks a little weird to me.\nWe could do something like: \"../\"*4 to make it easier to maintain. \n\nOR, add a function like the following to allow us to roll backwards through the directory structure a number of times or to look for a regex (like \"^objects\"):\n\nimport re\nfrom os.path import dirname, basename\n\ndef directory_reverse_walk(path, num\u003dNone, regex\u003dNone):\n    \"\"\"\n    Walk backward up a directory path based on the path given.\n  \n    NOTE: Either num or regex must be supplied, and they do not work\n          together. If they are both specified, num takes precedence.\n\n    :param path: string, the path to walk backwards up.\n    :param num: integer, if specified, walk backward this number of times.\n    :param regex: string, if specidied, walk backwards until the basename\n            matchees.\n    :raises DirectoryReverseException: If the num is higher then can be rolled\n            back or if the regex isn\u0027t matched.\n    \"\"\"\n    def check_base_regex(base_name, base_regex):\n        return re.compile(base_regex).match(base_name)\n\n    if num:\n        #NOTE: The dirname method will not error out once it gets to\n        # the base directory (\u0027/\u0027). Instead it keeps returning the base.\n        # So old path detects when it does.\n        old_path \u003d \"\"\n        for i in range(num):\n            old_path \u003d path\n            path \u003d dirname(path)\n            if old_path \u003d\u003d path:\n                raise DirectoryReverseException(\n                    \"%s cannot be rolled back %d times.\" % (\n                        path, num))\n        return path\n\n    if regex:\n        old_path \u003d \"\"\n        while path !\u003d old_path:\n            old_path \u003d path\n            path \u003d dirname(path)\n            if check_base_regex(basename(path), regex):\n                return path\n        raise DirectoryReverseException(\"Regex %s not matched\" % (regex))\n\nclass DirectoryReverseException(Exception):\n    pass","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":6198,"name":"Peter Portante","email":"peter.a.portante@gmail.com","username":"peter-a-portante"},"change_message_id":"e5dcb411084b8547f33f73ce67f7d86033e095a6","unresolved":false,"context_lines":[{"line_number":2713,"context_line":"    extract storage policy index from object path"},{"line_number":2714,"context_line":"    \"\"\""},{"line_number":2715,"context_line":"    #/srv/node/device/objects-dir/part/sufix/hash/timestamp.data"},{"line_number":2716,"context_line":"    datadir_path \u003d os.path.abspath(os.path.join(path, \u0027../../../../\u0027))"},{"line_number":2717,"context_line":"    datadir \u003d os.path.basename(datadir_path)"},{"line_number":2718,"context_line":""},{"line_number":2719,"context_line":"    if datadir \u003d\u003d \u0027objects\u0027:"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_d0d3fcd2","line":2716,"in_reply_to":"1ae5cdf2_b16f5f91","updated":"2014-06-12 11:08:43.000000000","message":"The suggested function does seem a bit more than what is needed, since we know the directory layout and do not have to discover it.  The x4 option seems simple enough.","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3cb3630baaa537d823d9d798951bd4327733661","unresolved":false,"context_lines":[{"line_number":2713,"context_line":"    extract storage policy index from object path"},{"line_number":2714,"context_line":"    \"\"\""},{"line_number":2715,"context_line":"    #/srv/node/device/objects-dir/part/sufix/hash/timestamp.data"},{"line_number":2716,"context_line":"    datadir_path \u003d os.path.abspath(os.path.join(path, \u0027../../../../\u0027))"},{"line_number":2717,"context_line":"    datadir \u003d os.path.basename(datadir_path)"},{"line_number":2718,"context_line":""},{"line_number":2719,"context_line":"    if datadir \u003d\u003d \u0027objects\u0027:"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_2a09ed30","line":2716,"in_reply_to":"1ae5cdf2_d0d3fcd2","updated":"2014-06-13 09:03:17.000000000","message":"There ended up being another function that does something similar in diskfile at the service of the quarantine renamer I believe.  I consolidated the functions and tests there.\n\nDone","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1216,"name":"gholt","email":"z-launchpad@brim.net","username":"gholt"},"change_message_id":"908631d8f142511cfa64b660af504588a55640d8","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"            _dir, index \u003d datadir.split(\u0027-\u0027, 1)"},{"line_number":2724,"context_line":"            if _dir \u003d\u003d \u0027objects\u0027:"},{"line_number":2725,"context_line":"                return int(index)"},{"line_number":2726,"context_line":"        except:"},{"line_number":2727,"context_line":"            pass"},{"line_number":2728,"context_line":"    raise ValueError"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_83a84621","line":2726,"updated":"2014-06-12 17:06:47.000000000","message":"Should not use bare excepts","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1216,"name":"gholt","email":"z-launchpad@brim.net","username":"gholt"},"change_message_id":"5627a4664b057fbb15fff5c3a97080aa2667d00e","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"            _dir, index \u003d datadir.split(\u0027-\u0027, 1)"},{"line_number":2724,"context_line":"            if _dir \u003d\u003d \u0027objects\u0027:"},{"line_number":2725,"context_line":"                return int(index)"},{"line_number":2726,"context_line":"        except:"},{"line_number":2727,"context_line":"            pass"},{"line_number":2728,"context_line":"    raise ValueError"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_ad65121f","line":2726,"in_reply_to":"1ae5cdf2_1e0b9224","updated":"2014-06-13 12:47:33.000000000","message":"Personally I don\u0027t mind except Exception though often with Swift it should be except (Timeout, Exception)\n\nI believe others prefer catching only specifically what you know about today; but actually prefer more general excepts for code that is obviously trying to make sure the program doesn\u0027t exit completely and keeps trying its best to run no matter what.\n\nBut, bare excepts catch things you almost never meant to, which is why it shouldn\u0027t have ever been the default in Python, but anyway: https://docs.python.org/3/howto/doanddont.html#except","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f3cb3630baaa537d823d9d798951bd4327733661","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"            _dir, index \u003d datadir.split(\u0027-\u0027, 1)"},{"line_number":2724,"context_line":"            if _dir \u003d\u003d \u0027objects\u0027:"},{"line_number":2725,"context_line":"                return int(index)"},{"line_number":2726,"context_line":"        except:"},{"line_number":2727,"context_line":"            pass"},{"line_number":2728,"context_line":"    raise ValueError"}],"source_content_type":"text/x-python","patch_set":11,"id":"1ae5cdf2_1e0b9224","line":2726,"in_reply_to":"1ae5cdf2_83a84621","updated":"2014-06-13 09:03:17.000000000","message":"obj.diskfile.extract_policy_index has an except Exception - just as bad?","commit_id":"3e4f5e6a27867ea0b15713d2feefc39ff9d19fce"}]}
