)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"902edee57e9e41041dfde2360aad36f154916875","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"130163dc_84a08b3f","updated":"2025-05-28 06:32:54.000000000","message":"Question inline regarding OrderedDict, but I guess that isn\u0027t really a blocker, so +1 for now. But seems like a cleaner way of using newer things.. so also happy to squash it.\n\nBe nice to finally start using some more python modern classes, and this is the first time \u003e 3.6.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"d70dd65997a5b46f3aae792c6247e0d3c2d7aa20","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"4341a9b2_26467706","updated":"2025-05-29 04:56:13.000000000","message":"yup, fair point 😊","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"}],"swift/common/ring/io.py":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"9dfe98d53fcd018501c87a6e0407deb4d658a826","unresolved":true,"context_lines":[{"line_number":234,"context_line":"        self.close()"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"@dataclasses.dataclass(order\u003dTrue, frozen\u003dTrue)"},{"line_number":238,"context_line":"class IndexEntry:"},{"line_number":239,"context_line":"    compressed_start: Optional[int]"},{"line_number":240,"context_line":"    uncompressed_start: Optional[int]"}],"source_content_type":"text/x-python","patch_set":1,"id":"faf42bd8_cd19f1c5","line":237,"range":{"start_line":237,"start_character":23,"end_line":237,"end_character":33},"updated":"2025-05-28 01:01:22.000000000","message":"Alternatively, explicitly say during the sorting that we\u0027re going off the `compressed_start`.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"a85b33a84be3537cb17b51e65435614cee1f4109","unresolved":false,"context_lines":[{"line_number":234,"context_line":"        self.close()"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"@dataclasses.dataclass(order\u003dTrue, frozen\u003dTrue)"},{"line_number":238,"context_line":"class IndexEntry:"},{"line_number":239,"context_line":"    compressed_start: Optional[int]"},{"line_number":240,"context_line":"    uncompressed_start: Optional[int]"}],"source_content_type":"text/x-python","patch_set":1,"id":"4abd76f1_566134a8","line":237,"range":{"start_line":237,"start_character":23,"end_line":237,"end_character":33},"in_reply_to":"faf42bd8_cd19f1c5","updated":"2025-05-28 03:26:03.000000000","message":"Done","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"ae6f7577423166540441d7c33e0405355b2cf524","unresolved":true,"context_lines":[{"line_number":236,"context_line":""},{"line_number":237,"context_line":"@dataclasses.dataclass(order\u003dTrue, frozen\u003dTrue)"},{"line_number":238,"context_line":"class IndexEntry:"},{"line_number":239,"context_line":"    compressed_start: Optional[int]"},{"line_number":240,"context_line":"    uncompressed_start: Optional[int]"},{"line_number":241,"context_line":"    compressed_end: Optional[int]"},{"line_number":242,"context_line":"    uncompressed_end: Optional[int]"},{"line_number":243,"context_line":"    checksum_method: Optional[str]"}],"source_content_type":"text/x-python","patch_set":1,"id":"4870eaca_33886045","line":240,"range":{"start_line":239,"start_character":4,"end_line":240,"end_character":37},"updated":"2025-05-28 01:23:18.000000000","message":"Actually, these two aren\u0027t really optional.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"a85b33a84be3537cb17b51e65435614cee1f4109","unresolved":false,"context_lines":[{"line_number":236,"context_line":""},{"line_number":237,"context_line":"@dataclasses.dataclass(order\u003dTrue, frozen\u003dTrue)"},{"line_number":238,"context_line":"class IndexEntry:"},{"line_number":239,"context_line":"    compressed_start: Optional[int]"},{"line_number":240,"context_line":"    uncompressed_start: Optional[int]"},{"line_number":241,"context_line":"    compressed_end: Optional[int]"},{"line_number":242,"context_line":"    uncompressed_end: Optional[int]"},{"line_number":243,"context_line":"    checksum_method: Optional[str]"}],"source_content_type":"text/x-python","patch_set":1,"id":"42b1131d_605a89ff","line":240,"range":{"start_line":239,"start_character":4,"end_line":240,"end_character":37},"in_reply_to":"4870eaca_33886045","updated":"2025-05-28 03:26:03.000000000","message":"Done","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"ae6f7577423166540441d7c33e0405355b2cf524","unresolved":true,"context_lines":[{"line_number":530,"context_line":"        self.flush()"},{"line_number":531,"context_line":"        self.current_section \u003d name"},{"line_number":532,"context_line":"        self.index[name] \u003d IndexEntry("},{"line_number":533,"context_line":"            self.tell(), self.pos, None, None, None, None)"},{"line_number":534,"context_line":"        self.checksum \u003d getattr(hashlib, self.checksum_method)()"},{"line_number":535,"context_line":"        try:"},{"line_number":536,"context_line":"            yield self"}],"source_content_type":"text/x-python","patch_set":1,"id":"cd163604_a57ccbab","line":533,"range":{"start_line":533,"start_character":35,"end_line":533,"end_character":57},"updated":"2025-05-28 01:23:18.000000000","message":"Could clean up the defaults in the dataclass to make this not necessary.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"a85b33a84be3537cb17b51e65435614cee1f4109","unresolved":false,"context_lines":[{"line_number":530,"context_line":"        self.flush()"},{"line_number":531,"context_line":"        self.current_section \u003d name"},{"line_number":532,"context_line":"        self.index[name] \u003d IndexEntry("},{"line_number":533,"context_line":"            self.tell(), self.pos, None, None, None, None)"},{"line_number":534,"context_line":"        self.checksum \u003d getattr(hashlib, self.checksum_method)()"},{"line_number":535,"context_line":"        try:"},{"line_number":536,"context_line":"            yield self"}],"source_content_type":"text/x-python","patch_set":1,"id":"b57810d1_3ecc4f42","line":533,"range":{"start_line":533,"start_character":35,"end_line":533,"end_character":57},"in_reply_to":"cd163604_a57ccbab","updated":"2025-05-28 03:26:03.000000000","message":"Done","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"ae6f7577423166540441d7c33e0405355b2cf524","unresolved":true,"context_lines":[{"line_number":535,"context_line":"        try:"},{"line_number":536,"context_line":"            yield self"},{"line_number":537,"context_line":"            self.flush()"},{"line_number":538,"context_line":"            self.index[name] \u003d IndexEntry("},{"line_number":539,"context_line":"                self.index[name].compressed_start,"},{"line_number":540,"context_line":"                self.index[name].uncompressed_start,"},{"line_number":541,"context_line":"                self.tell(), self.pos,"}],"source_content_type":"text/x-python","patch_set":1,"id":"6497ca32_32bcbcec","line":538,"updated":"2025-05-28 01:23:18.000000000","message":"Could use `dataclasses.replace` to maybe make it more obvious what\u0027s going on.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"a85b33a84be3537cb17b51e65435614cee1f4109","unresolved":false,"context_lines":[{"line_number":535,"context_line":"        try:"},{"line_number":536,"context_line":"            yield self"},{"line_number":537,"context_line":"            self.flush()"},{"line_number":538,"context_line":"            self.index[name] \u003d IndexEntry("},{"line_number":539,"context_line":"                self.index[name].compressed_start,"},{"line_number":540,"context_line":"                self.index[name].uncompressed_start,"},{"line_number":541,"context_line":"                self.tell(), self.pos,"}],"source_content_type":"text/x-python","patch_set":1,"id":"a4b00fee_10548359","line":538,"in_reply_to":"6497ca32_32bcbcec","updated":"2025-05-28 03:26:03.000000000","message":"Done","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"9dfe98d53fcd018501c87a6e0407deb4d658a826","unresolved":true,"context_lines":[{"line_number":623,"context_line":"        automatically when using the writer as a context manager."},{"line_number":624,"context_line":"        \"\"\""},{"line_number":625,"context_line":"        with self.section(\u0027swift/index\u0027):"},{"line_number":626,"context_line":"            self.write_json({k: list(v) for k, v in self.index.items()})"},{"line_number":627,"context_line":"        # switch to uncompressed"},{"line_number":628,"context_line":"        self._set_compression_level(0)"},{"line_number":629,"context_line":"        # ... which allows us to know that this will be exactly 18 bytes"}],"source_content_type":"text/x-python","patch_set":1,"id":"a3f2b79d_80ab03cd","line":626,"updated":"2025-05-28 01:01:22.000000000","message":"This bit (and the associated `__iter__`) is a little unfortunate/non-obvious. It was rather nice how we could just `json.dumps(self.index)` before.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"ae6f7577423166540441d7c33e0405355b2cf524","unresolved":true,"context_lines":[{"line_number":623,"context_line":"        automatically when using the writer as a context manager."},{"line_number":624,"context_line":"        \"\"\""},{"line_number":625,"context_line":"        with self.section(\u0027swift/index\u0027):"},{"line_number":626,"context_line":"            self.write_json({k: list(v) for k, v in self.index.items()})"},{"line_number":627,"context_line":"        # switch to uncompressed"},{"line_number":628,"context_line":"        self._set_compression_level(0)"},{"line_number":629,"context_line":"        # ... which allows us to know that this will be exactly 18 bytes"}],"source_content_type":"text/x-python","patch_set":1,"id":"334d53e6_f33f7d11","line":626,"in_reply_to":"a3f2b79d_80ab03cd","updated":"2025-05-28 01:23:18.000000000","message":"I suppose I could at least get rid of the `__iter__` by making this\n```\nself.write_json({k: dataclasses.astuple(v) for k, v in self.index.items()})\n```\ndirectly.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"9dfe98d53fcd018501c87a6e0407deb4d658a826","unresolved":true,"context_lines":[{"line_number":627,"context_line":"        # switch to uncompressed"},{"line_number":628,"context_line":"        self._set_compression_level(0)"},{"line_number":629,"context_line":"        # ... which allows us to know that this will be exactly 18 bytes"},{"line_number":630,"context_line":"        self.write_size(self.index[\u0027swift/index\u0027].compressed_start)"},{"line_number":631,"context_line":"        self.flush()"}],"source_content_type":"text/x-python","patch_set":1,"id":"81ec8e21_16d2e931","line":630,"updated":"2025-05-28 01:01:22.000000000","message":"This probably should happen regardless. `[0]` smells like something from before I bothered with the `namedtuple`.","commit_id":"64df5fa8501445b18a03726998ea7e1f17fb20b9"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"902edee57e9e41041dfde2360aad36f154916875","unresolved":true,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import collections"},{"line_number":17,"context_line":"import contextlib"},{"line_number":18,"context_line":"import dataclasses"},{"line_number":19,"context_line":"import gzip"},{"line_number":20,"context_line":"import hashlib"},{"line_number":21,"context_line":"import json"}],"source_content_type":"text/x-python","patch_set":2,"id":"b4833711_ceb66370","line":18,"updated":"2025-05-28 06:32:54.000000000","message":"Probably looks better with:\n```\nfrom dataclasses import dataclass, replace\n...\n@dataclass(frozen\u003dTrue)\n```\n\nBut I guess the replace might suddently mean less.. so maybe it\u0027s ok as it is.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e15334765827967e2d1a641caf0775be9e539f7b","unresolved":true,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import collections"},{"line_number":17,"context_line":"import contextlib"},{"line_number":18,"context_line":"import dataclasses"},{"line_number":19,"context_line":"import gzip"},{"line_number":20,"context_line":"import hashlib"},{"line_number":21,"context_line":"import json"}],"source_content_type":"text/x-python","patch_set":2,"id":"3ce13ef7_8b11d4a2","line":18,"in_reply_to":"b4833711_ceb66370","updated":"2025-05-28 15:13:14.000000000","message":"I mean, I could do\n```\nimport dataclasses\nfrom dataclasses import dataclass\n```\nand still be able to do `@dataclass` *and* `dataclasses.replace`... meh, either way.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"902edee57e9e41041dfde2360aad36f154916875","unresolved":true,"context_lines":[{"line_number":234,"context_line":"        self.close()"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"@dataclasses.dataclass(frozen\u003dTrue)"},{"line_number":238,"context_line":"class IndexEntry:"},{"line_number":239,"context_line":"    compressed_start: int"},{"line_number":240,"context_line":"    uncompressed_start: int"}],"source_content_type":"text/x-python","patch_set":2,"id":"41cfcd7b_7a0bb3c2","line":237,"updated":"2025-05-28 06:32:54.000000000","message":"Would we also like `order\u003dTrue`. So these can be ordered easily. I guess that might always be added in the right order but still.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"902edee57e9e41041dfde2360aad36f154916875","unresolved":true,"context_lines":[{"line_number":247,"context_line":"    def uncompressed_length(self) -\u003e Optional[int]:"},{"line_number":248,"context_line":"        if self.uncompressed_end is None:"},{"line_number":249,"context_line":"            return None"},{"line_number":250,"context_line":"        return self.uncompressed_end - self.uncompressed_start"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"class RingReader(GzipReader):"}],"source_content_type":"text/x-python","patch_set":2,"id":"c3884692_53cc54fd","line":250,"updated":"2025-05-28 06:32:54.000000000","message":"Oh cool, so you can do properties in dataclasses. I guess that makes sense, the decorator is just auto creating the dunder methods.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e15334765827967e2d1a641caf0775be9e539f7b","unresolved":true,"context_lines":[{"line_number":247,"context_line":"    def uncompressed_length(self) -\u003e Optional[int]:"},{"line_number":248,"context_line":"        if self.uncompressed_end is None:"},{"line_number":249,"context_line":"            return None"},{"line_number":250,"context_line":"        return self.uncompressed_end - self.uncompressed_start"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"class RingReader(GzipReader):"}],"source_content_type":"text/x-python","patch_set":2,"id":"9d9bdac2_089a3e80","line":250,"in_reply_to":"c3884692_53cc54fd","updated":"2025-05-28 15:13:14.000000000","message":"Yup, and namedtuples for that matter. The subclassing needed was kind of awkward before, though.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"902edee57e9e41041dfde2360aad36f154916875","unresolved":true,"context_lines":[{"line_number":301,"context_line":"        self.seek(index_start)"},{"line_number":302,"context_line":"        # ensure index entries are sorted by position"},{"line_number":303,"context_line":"        self.index \u003d collections.OrderedDict(sorted("},{"line_number":304,"context_line":"            ((section, IndexEntry(*entry))"},{"line_number":305,"context_line":"             for section, entry in json.loads(self.read_blob()).items()),"},{"line_number":306,"context_line":"            key\u003dlambda x: x[1].compressed_start))"},{"line_number":307,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"a4271dd4_24970aa3","line":304,"updated":"2025-05-28 06:32:54.000000000","message":"Oh I guess its sorted here by section name so maybe adding order bits to the class is redundant.\n\nOn a side note, aren\u0027t dicts from py3.7+ ordered now anyway? Might be something else we can drop.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"e15334765827967e2d1a641caf0775be9e539f7b","unresolved":true,"context_lines":[{"line_number":301,"context_line":"        self.seek(index_start)"},{"line_number":302,"context_line":"        # ensure index entries are sorted by position"},{"line_number":303,"context_line":"        self.index \u003d collections.OrderedDict(sorted("},{"line_number":304,"context_line":"            ((section, IndexEntry(*entry))"},{"line_number":305,"context_line":"             for section, entry in json.loads(self.read_blob()).items()),"},{"line_number":306,"context_line":"            key\u003dlambda x: x[1].compressed_start))"},{"line_number":307,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"da017a02_4236a716","line":304,"in_reply_to":"a4271dd4_24970aa3","updated":"2025-05-28 15:13:14.000000000","message":"\u003e Oh I guess its sorted here by section name\n\nNo, by order in the compressed stream (`key\u003dlambda x: x[1].compressed_start`).\n\nAnd yeah, since this is the *one* spot where we try to sort `IndexEntries` I figured the general ordering wasn\u0027t really needed.\n\n\u003e On a side note, aren\u0027t dicts from py3.7+ ordered now anyway? Might be something else we can drop.\n\nTrue -- I debated about that when we dropped py27 (since the insertion-order preservation was present in py36 even if it wasn\u0027t guaranteed per language spec until py37). I mainly stuck with `OrderedDict` to make it very explicit that *there is an intentional order to the entries* and users should be able to rely upon it.","commit_id":"2147b26c11f0bb1f0ea58ecb102ccaf153350532"}]}
