)]}'
{"swift/common/storage_policy.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        except ValueError as err:"},{"line_number":147,"context_line":"            # make the message a little more useful"},{"line_number":148,"context_line":"            raise ValueError(\"Invalid read_affinity value: %r (%s)\" %"},{"line_number":149,"context_line":"                             (read_affinity, err.message))"},{"line_number":150,"context_line":"        self.ring_name \u003d _get_policy_string(\u0027object\u0027, self.idx)"},{"line_number":151,"context_line":"        self.object_ring \u003d object_ring"},{"line_number":152,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_09e730b1","line":149,"updated":"2015-04-22 01:02:57.000000000","message":"If you use a PolicyError you can include the self.idx arg - which is helpful when you have multiple storage policies sections that might be raising the error.","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        except ValueError as err:"},{"line_number":147,"context_line":"            # make the message a little more useful"},{"line_number":148,"context_line":"            raise ValueError(\"Invalid read_affinity value: %r (%s)\" %"},{"line_number":149,"context_line":"                             (read_affinity, err.message))"},{"line_number":150,"context_line":"        self.ring_name \u003d _get_policy_string(\u0027object\u0027, self.idx)"},{"line_number":151,"context_line":"        self.object_ring \u003d object_ring"},{"line_number":152,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_edabd6d4","line":149,"in_reply_to":"dac4157f_09e730b1","updated":"2015-04-22 18:34:41.000000000","message":"Done","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":162,"context_line":"                \"sorting_method\u003d%s, read_affinity\u003d%s)\") % \\"},{"line_number":163,"context_line":"            (self.__class__.__name__, self.idx, self.name,"},{"line_number":164,"context_line":"             self.is_default, self.is_deprecated, self.policy_type,"},{"line_number":165,"context_line":"             self.sorting_method, self.read_affinity)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    @classmethod"},{"line_number":168,"context_line":"    def register(cls, policy_type):"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_895b4087","line":165,"updated":"2015-04-22 01:02:57.000000000","message":"meh, i\u0027m not sure as we continue to add options here how much we\u0027re going to be able to keep sticking in the __repr__","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":162,"context_line":"                \"sorting_method\u003d%s, read_affinity\u003d%s)\") % \\"},{"line_number":163,"context_line":"            (self.__class__.__name__, self.idx, self.name,"},{"line_number":164,"context_line":"             self.is_default, self.is_deprecated, self.policy_type,"},{"line_number":165,"context_line":"             self.sorting_method, self.read_affinity)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    @classmethod"},{"line_number":168,"context_line":"    def register(cls, policy_type):"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab921fb_1ebb4d10","line":165,"in_reply_to":"dac4157f_895b4087","updated":"2015-04-22 18:34:41.000000000","message":"You\u0027re right, I\u0027m trying to think a better option. For the next patch, it continues.","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":233,"context_line":"        if not self.sorting_method:"},{"line_number":234,"context_line":"            info.pop(\"sorting_method\", None)"},{"line_number":235,"context_line":"        if not self.read_affinity:"},{"line_number":236,"context_line":"            info.pop(\"read_affinity\", None)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"        return info"},{"line_number":239,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_298674b9","line":236,"updated":"2015-04-22 01:02:57.000000000","message":"so this is mostly for the case when config is True (otherwise these options would have already been popped).\n\nSo but I don\u0027t understand why we wouldn\u0027t want to include the False-y values?  I mean in other cases we include the explicit options even if they happen to be the default?","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":233,"context_line":"        if not self.sorting_method:"},{"line_number":234,"context_line":"            info.pop(\"sorting_method\", None)"},{"line_number":235,"context_line":"        if not self.read_affinity:"},{"line_number":236,"context_line":"            info.pop(\"read_affinity\", None)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"        return info"},{"line_number":239,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_9e723910","line":236,"in_reply_to":"dac4157f_298674b9","updated":"2015-04-22 18:34:41.000000000","message":"Done. It would be cool if it could return the sorting_method and affinity values set at proxy.conf as the default. For now I can change it to include the False-y values (in this case  empty strings).","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":305,"context_line":""},{"line_number":306,"context_line":"        super(ECStoragePolicy, self).__init__("},{"line_number":307,"context_line":"            idx, name, is_default, is_deprecated, object_ring,"},{"line_number":308,"context_line":"            sorting_method, read_affinity)"},{"line_number":309,"context_line":""},{"line_number":310,"context_line":"        # Validate erasure_coding policy specific members"},{"line_number":311,"context_line":"        # ec_type is one of the EC implementations supported by PyEClib"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_496f682b","line":308,"updated":"2015-04-22 01:02:57.000000000","message":"let\u0027s **kwargs these?","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":305,"context_line":""},{"line_number":306,"context_line":"        super(ECStoragePolicy, self).__init__("},{"line_number":307,"context_line":"            idx, name, is_default, is_deprecated, object_ring,"},{"line_number":308,"context_line":"            sorting_method, read_affinity)"},{"line_number":309,"context_line":""},{"line_number":310,"context_line":"        # Validate erasure_coding policy specific members"},{"line_number":311,"context_line":"        # ec_type is one of the EC implementations supported by PyEClib"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_6d86a666","line":308,"in_reply_to":"dac4157f_496f682b","updated":"2015-04-22 18:34:41.000000000","message":"Done","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"ff4d600d177da0b1a664974b668d8902a0505377","unresolved":false,"context_lines":[{"line_number":139,"context_line":"            raise PolicyError(\u0027Deprecated policy can not be default.  \u0027"},{"line_number":140,"context_line":"                              \u0027Invalid config\u0027, self.idx)"},{"line_number":141,"context_line":"        self.sorting_method \u003d kwargs.get(\u0027sorting_method\u0027, \u0027\u0027)"},{"line_number":142,"context_line":"        self.read_affinity \u003d kwargs.get(\u0027read_affinity\u0027, \u0027\u0027)"},{"line_number":143,"context_line":"        try:"},{"line_number":144,"context_line":"            self.read_affinity_sort_key \u003d\\"},{"line_number":145,"context_line":"                check_sorting_config(self.sorting_method, self.read_affinity)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bab921fb_2f9c48bf","line":142,"updated":"2015-04-24 10:29:57.000000000","message":"Perhaps I am the only man to think so, I would like to use default keyword arguments rather than kwargs to prevent any other unexpected arguments.\n\ni.e.:\ndef __init__(self, idx, name\u003d\u0027\u0027, is_default\u003dFalse,\n             is_deprecated\u003dFalse, object_ring\u003dNone,\n             sorting_method\u003d\u0027\u0027, read_affinity\u003d\u0027\u0027):","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"70b9317e89a7da33764df1dca4b5141644b3f7f5","unresolved":false,"context_lines":[{"line_number":139,"context_line":"            raise PolicyError(\u0027Deprecated policy can not be default.  \u0027"},{"line_number":140,"context_line":"                              \u0027Invalid config\u0027, self.idx)"},{"line_number":141,"context_line":"        self.sorting_method \u003d kwargs.get(\u0027sorting_method\u0027, \u0027\u0027)"},{"line_number":142,"context_line":"        self.read_affinity \u003d kwargs.get(\u0027read_affinity\u0027, \u0027\u0027)"},{"line_number":143,"context_line":"        try:"},{"line_number":144,"context_line":"            self.read_affinity_sort_key \u003d\\"},{"line_number":145,"context_line":"                check_sorting_config(self.sorting_method, self.read_affinity)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bab921fb_86b1efe3","line":142,"in_reply_to":"bab921fb_2f9c48bf","updated":"2015-04-24 16:42:10.000000000","message":"I have tried this approach before, but I can change easily in case we reach a consensus.","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"b2de7bb4c4fd726b62f693c16f78fc60df413c64","unresolved":false,"context_lines":[{"line_number":139,"context_line":"            raise PolicyError(\u0027Deprecated policy can not be default.  \u0027"},{"line_number":140,"context_line":"                              \u0027Invalid config\u0027, self.idx)"},{"line_number":141,"context_line":"        self.sorting_method \u003d kwargs.get(\u0027sorting_method\u0027, \u0027\u0027)"},{"line_number":142,"context_line":"        self.read_affinity \u003d kwargs.get(\u0027read_affinity\u0027, \u0027\u0027)"},{"line_number":143,"context_line":"        try:"},{"line_number":144,"context_line":"            self.read_affinity_sort_key \u003d\\"},{"line_number":145,"context_line":"                check_sorting_config(self.sorting_method, self.read_affinity)"}],"source_content_type":"text/x-python","patch_set":11,"id":"9abe1de1_b43a39cc","line":142,"in_reply_to":"bab921fb_86b1efe3","updated":"2015-04-27 13:38:38.000000000","message":"Ah, OK. I noticed the discussion we\u0027ll try to change this after copy/versioning middleware stuff landed.","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"}],"swift/proxy/controllers/obj.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"d99f69289f411fe7dca4ac7bbfd9839e996b1246","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        policy_index \u003d req.headers.get(\u0027X-Backend-Storage-Policy-Index\u0027,"},{"line_number":183,"context_line":"                                       container_info[\u0027storage_policy\u0027])"},{"line_number":184,"context_line":"        obj_ring \u003d self.app.get_object_ring(policy_index)"},{"line_number":185,"context_line":"        self.policy \u003d self.app.get_policy(policy_index)"},{"line_number":186,"context_line":"        req.headers[\u0027X-Backend-Storage-Policy-Index\u0027] \u003d policy_index"},{"line_number":187,"context_line":"        if \u0027swift.authorize\u0027 in req.environ:"},{"line_number":188,"context_line":"            aresp \u003d req.environ[\u0027swift.authorize\u0027](req)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a80dd14_f3697b8d","line":185,"updated":"2015-03-16 20:06:36.000000000","message":"oic, you can\u0027t set the policy attribute when you create the controller because you don\u0027t know what the container_info will say until after the method routing.\n\nfeature/ec\u0027s per-policy controller\u0027s would actually clean this up.","commit_id":"a1aef00c83ef48ae0e59ca8ed73c2ed869990687"}],"swift/proxy/server.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"156a6d1f31898efe63e9f3f6f2ca5ac224c879c7","unresolved":false,"context_lines":[{"line_number":391,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":392,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/)"},{"line_number":393,"context_line":"        current_sorting_method \u003d getattr("},{"line_number":394,"context_line":"            POLICIES.get_by_index(policy_index), \u0027sorting_method\u0027, None)"},{"line_number":395,"context_line":"        if not current_sorting_method:"},{"line_number":396,"context_line":"            current_sorting_method \u003d self.sorting_method"},{"line_number":397,"context_line":"        shuffle(nodes)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba7be1f8_e0656a1e","line":394,"updated":"2015-03-03 21:41:16.000000000","message":"I think it\u0027d be better to pass in policy instead of policy_index and on the container and account paths it would default to None.\n\n    current_sorting_method \u003d policy.sorting_method if policy else self.sorting_method","commit_id":"be717cd128f0e581cd712c350419387f8afd04f1"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"d99f69289f411fe7dca4ac7bbfd9839e996b1246","unresolved":false,"context_lines":[{"line_number":243,"context_line":""},{"line_number":244,"context_line":"        :returns: appropriate Policy object"},{"line_number":245,"context_line":"        \"\"\""},{"line_number":246,"context_line":"        return POLICIES.get_by_index(policy_idx)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def get_controller(self, path):"},{"line_number":249,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"9a80dd14_50ecfd29","line":246,"updated":"2015-03-16 20:06:36.000000000","message":"everyone does this :\\\n\nthis can return None\n\nI think it just sorta sucks for the controller\u0027s to have this attribute that might be None called policy.","commit_id":"a1aef00c83ef48ae0e59ca8ed73c2ed869990687"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":429,"context_line":"        if policy and policy.sorting_method:"},{"line_number":430,"context_line":"            sorting_method \u003d policy.sorting_method"},{"line_number":431,"context_line":"            if policy.sorting_method \u003d\u003d \u0027affinity\u0027:"},{"line_number":432,"context_line":"                read_affinity_sort_key \u003d policy.read_affinity_sort_key"},{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":435,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_89458071","line":432,"updated":"2015-04-22 01:02:57.000000000","message":"proxy.server\u0027s app_factory calls check_config to raise a warning when you have a read_affinity option set and your sorting_method isn\u0027t affinity :\\","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":429,"context_line":"        if policy and policy.sorting_method:"},{"line_number":430,"context_line":"            sorting_method \u003d policy.sorting_method"},{"line_number":431,"context_line":"            if policy.sorting_method \u003d\u003d \u0027affinity\u0027:"},{"line_number":432,"context_line":"                read_affinity_sort_key \u003d policy.read_affinity_sort_key"},{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":435,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_e88504ad","line":432,"in_reply_to":"dac4157f_89458071","updated":"2015-04-22 18:34:41.000000000","message":"oic thanks for check_config note, I\u0027ll update it and try to avoid duplicated code.","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":435,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":436,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/i)"},{"line_number":437,"context_line":"        shuffle(nodes)"},{"line_number":438,"context_line":"        if sorting_method \u003d\u003d \u0027timing\u0027:"},{"line_number":439,"context_line":"            now \u003d time()"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_09acd032","line":436,"updated":"2015-04-22 01:02:57.000000000","message":"typo?  that link doesn\u0027t work for me.","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":435,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":436,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/i)"},{"line_number":437,"context_line":"        shuffle(nodes)"},{"line_number":438,"context_line":"        if sorting_method \u003d\u003d \u0027timing\u0027:"},{"line_number":439,"context_line":"            now \u003d time()"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_ad9b9e71","line":436,"in_reply_to":"dac4157f_09acd032","updated":"2015-04-22 18:34:41.000000000","message":"Done","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"ff4d600d177da0b1a664974b668d8902a0505377","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        if policy and policy.sorting_method:"},{"line_number":417,"context_line":"            sorting_method \u003d policy.sorting_method"},{"line_number":418,"context_line":"            read_affinity_sort_key \u003d policy.read_affinity_sort_key"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":421,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":422,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bab921fb_d2cd6fb8","line":419,"updated":"2015-04-24 10:29:57.000000000","message":"Nits: if/else would be better?\n\nif policy and policy.sorting_method:\n    sorting_method \u003d self.sorting_method\n    read_affinity_sort_key \u003d self.read_affinity_sort_key\nelse:\n    sorting_method \u003d policy.sorting_method\n    read_affinity_sort_key \u003d policy.read_affinity_sort_key","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"24c96dacf119775ed11f5c29de0166e174d984f5","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        if policy and policy.sorting_method:"},{"line_number":417,"context_line":"            sorting_method \u003d policy.sorting_method"},{"line_number":418,"context_line":"            read_affinity_sort_key \u003d policy.read_affinity_sort_key"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":421,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":422,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7ad32947_eb78d191","line":419,"in_reply_to":"9abe1de1_5981d68e","updated":"2015-04-27 15:47:48.000000000","message":"Yes, nice reason, I\u0027ll change it, thanks. Done.","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"b2de7bb4c4fd726b62f693c16f78fc60df413c64","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        if policy and policy.sorting_method:"},{"line_number":417,"context_line":"            sorting_method \u003d policy.sorting_method"},{"line_number":418,"context_line":"            read_affinity_sort_key \u003d policy.read_affinity_sort_key"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":421,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":422,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/)"}],"source_content_type":"text/x-python","patch_set":11,"id":"9abe1de1_5981d68e","line":419,"in_reply_to":"bab921fb_6821fd9e","updated":"2015-04-27 13:38:38.000000000","message":"Oops, I misspelled.\n\nWe don\u0027t have to assign the empty string in the out of if/else so, just as:\n\nif policy and policy.sorting_method:\n    sorting_method \u003d policy.sorting_method\n    read_affinity_sort_key \u003d policy.read_affinity_sort_key\nelse:\n    sorting_method \u003d self.sorting_method\n    read_affinity_sort_key \u003d self.read_affinity_sort_key\n\nIt\u0027s python\u0027s magic.\n\nThe reason I\u0027d prefer using if/else rather than using only if is to catch unexpected wrong behavior.\n\nFor example,  if we used if condition to overwrite some variables but we forgot to assign a variable like as:\n\nsorting_method \u003d self.sorting_method\nread_affinity_sort_key \u003d self.read_affinity_sort_key\nif policy and policy.sorting_method:\n    sorting_method \u003d policy.sorting_method\n    # Oh no, I forgot to assing read_affinity_sort_key\n    # read_affinity_sort_key \u003d policy.read_affinity_sort_key\n\nThat would work but would behave bad silently.\n\nIf we use if/else syntax instead of above like as:\n\nif policy and policy.sorting_method:\n    sorting_method \u003d policy.sorting_method\n    read_affinity_sort_key \u003d policy.read_affinity_sort_key\nelse:\n    sorting_method \u003d self.sorting_method\n    # Oh no, I forgot to assing read_affinity_sort_key\n    # read_affinity_sort_key \u003d self.read_affinity_sort_key\n\nWe absolutely can see an error in the invalid case and it will be able to remove silent error. \n\nDoes it make you sense?","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"70b9317e89a7da33764df1dca4b5141644b3f7f5","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        if policy and policy.sorting_method:"},{"line_number":417,"context_line":"            sorting_method \u003d policy.sorting_method"},{"line_number":418,"context_line":"            read_affinity_sort_key \u003d policy.read_affinity_sort_key"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        # In the case of timing sorting, shuffling ensures that close timings"},{"line_number":421,"context_line":"        # (ie within the rounding resolution) won\u0027t prefer one over another."},{"line_number":422,"context_line":"        # Python\u0027s sort is stable (http://wiki.python.org/moin/HowTo/Sorting/)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bab921fb_6821fd9e","line":419,"in_reply_to":"bab921fb_d2cd6fb8","updated":"2015-04-24 16:42:10.000000000","message":"You meant the following below? I think it would require more lines, but we can wait more people to try a consensus.\n\n    sorting_method \u003d \u0027\u0027\n    read_affinity_sort_key \u003d \u0027\u0027\nif policy and policy.sorting_method:\n    sorting_method \u003d policy.sorting_method\n    read_affinity_sort_key \u003d policy.read_affinity_sort_key\nelse:\n    sorting_method \u003d self.sorting_method\n    read_affinity_sort_key \u003d self.read_affinity_sort_key","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"}],"test/unit/proxy/test_server.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":885,"context_line":"                 {\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027},"},{"line_number":886,"context_line":"                 {\u0027region\u0027: 3, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.3\u0027}]"},{"line_number":887,"context_line":"        with mock.patch(\u0027swift.proxy.server.shuffle\u0027, lambda x: x):"},{"line_number":888,"context_line":"            app_sorted \u003d baseapp.sort_nodes(nodes, POLICIES.get_by_index(1))"},{"line_number":889,"context_line":"            exp_sorted \u003d [{\u0027region\u0027: 3, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.3\u0027},"},{"line_number":890,"context_line":"                          {\u0027region\u0027: 2, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.1\u0027},"},{"line_number":891,"context_line":"                          {\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027}]"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_5c5ba82e","line":888,"updated":"2015-04-22 01:02:57.000000000","message":"I think mosts tests go for the shorter POLICIES[2], but the get_by_index case might be interesting if you wanted to test the situation when sort_nodes got None instead of a policy instance.","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":885,"context_line":"                 {\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027},"},{"line_number":886,"context_line":"                 {\u0027region\u0027: 3, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.3\u0027}]"},{"line_number":887,"context_line":"        with mock.patch(\u0027swift.proxy.server.shuffle\u0027, lambda x: x):"},{"line_number":888,"context_line":"            app_sorted \u003d baseapp.sort_nodes(nodes, POLICIES.get_by_index(1))"},{"line_number":889,"context_line":"            exp_sorted \u003d [{\u0027region\u0027: 3, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.3\u0027},"},{"line_number":890,"context_line":"                          {\u0027region\u0027: 2, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.1\u0027},"},{"line_number":891,"context_line":"                          {\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027}]"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_e353de69","line":888,"in_reply_to":"dac4157f_5c5ba82e","updated":"2015-04-22 18:34:41.000000000","message":"Done","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"11fccfb1774c80423773e23f46bad8a468edc27d","unresolved":false,"context_lines":[{"line_number":895,"context_line":"                 {\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027}]"},{"line_number":896,"context_line":""},{"line_number":897,"context_line":"        with mock.patch(\u0027swift.proxy.server.shuffle\u0027, lambda x: x):"},{"line_number":898,"context_line":"            app_sorted \u003d baseapp.sort_nodes(nodes, POLICIES.get_by_index(2))"},{"line_number":899,"context_line":"            exp_sorted \u003d [{\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027},"},{"line_number":900,"context_line":"                          {\u0027region\u0027: 2, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.1\u0027}]"},{"line_number":901,"context_line":"            self.assertEquals(exp_sorted, app_sorted)"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_dc47b849","line":898,"updated":"2015-04-22 01:02:57.000000000","message":"this parts seems to be re-hashing the same ground as the earlier test with policy\u003dNone\n\nI think this test would be be a lot more interesting if it showed the same nodes produce different results based on policy param - not just different nodes giving different results - or the same nodes giving the same results.","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"8934348f699c8b3bd496d9e0c8d2af0920af617b","unresolved":false,"context_lines":[{"line_number":895,"context_line":"                 {\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027}]"},{"line_number":896,"context_line":""},{"line_number":897,"context_line":"        with mock.patch(\u0027swift.proxy.server.shuffle\u0027, lambda x: x):"},{"line_number":898,"context_line":"            app_sorted \u003d baseapp.sort_nodes(nodes, POLICIES.get_by_index(2))"},{"line_number":899,"context_line":"            exp_sorted \u003d [{\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027},"},{"line_number":900,"context_line":"                          {\u0027region\u0027: 2, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.1\u0027}]"},{"line_number":901,"context_line":"            self.assertEquals(exp_sorted, app_sorted)"}],"source_content_type":"text/x-python","patch_set":8,"id":"dac4157f_c31b3a72","line":898,"in_reply_to":"dac4157f_dc47b849","updated":"2015-04-22 18:34:41.000000000","message":"Done, \"The same nodes produce different results based on policy param\".","commit_id":"584e225120bb63d3d6e7bfaf216a4eb63f63902d"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"ff4d600d177da0b1a664974b668d8902a0505377","unresolved":false,"context_lines":[{"line_number":887,"context_line":"            self.assertEquals(exp_sorted, app_sorted)"},{"line_number":888,"context_line":""},{"line_number":889,"context_line":"        with mock.patch(\u0027swift.proxy.server.shuffle\u0027, lambda x: x):"},{"line_number":890,"context_line":"            app_sorted \u003d baseapp.sort_nodes(nodes, POLICIES.get_by_index(2))"},{"line_number":891,"context_line":"            exp_sorted \u003d [{\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027},"},{"line_number":892,"context_line":"                          {\u0027region\u0027: 2, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.1\u0027}]"},{"line_number":893,"context_line":"            self.assertEquals(exp_sorted, app_sorted)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bab921fb_ad97408f","line":890,"updated":"2015-04-24 10:29:57.000000000","message":"By the patch_policies decorator, we don\u0027t have policy 2 for this test so POLICIES.get_by_index(2) will return None and basically such a situation should be validated somewhere in other place...so I guess this for policy 2 seems not necessary...\n\nOr you want to assert something others?","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"},{"author":{"_account_id":14966,"name":"Denis Cavalcante","email":"dencaval@gmail.com","username":"denis.cavalcante"},"change_message_id":"70b9317e89a7da33764df1dca4b5141644b3f7f5","unresolved":false,"context_lines":[{"line_number":887,"context_line":"            self.assertEquals(exp_sorted, app_sorted)"},{"line_number":888,"context_line":""},{"line_number":889,"context_line":"        with mock.patch(\u0027swift.proxy.server.shuffle\u0027, lambda x: x):"},{"line_number":890,"context_line":"            app_sorted \u003d baseapp.sort_nodes(nodes, POLICIES.get_by_index(2))"},{"line_number":891,"context_line":"            exp_sorted \u003d [{\u0027region\u0027: 1, \u0027zone\u0027: 2, \u0027ip\u0027: \u0027127.0.0.2\u0027},"},{"line_number":892,"context_line":"                          {\u0027region\u0027: 2, \u0027zone\u0027: 1, \u0027ip\u0027: \u0027127.0.0.1\u0027}]"},{"line_number":893,"context_line":"            self.assertEquals(exp_sorted, app_sorted)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bab921fb_0823a106","line":890,"in_reply_to":"bab921fb_ad97408f","updated":"2015-04-24 16:42:10.000000000","message":"I agree, you\u0027re right and the first mock.patch uses sort_nodes(nodes, policy\u003dNone) due sort_nodes method signature. Done.","commit_id":"8509495cbc51dd54a5f12bcc5f74732f13bd3c8d"}]}
