)]}'
{"rally/task/context.py":[{"author":{"_account_id":9545,"name":"Andriy Kurilin","email":"andr.kurilin@gmail.com","username":"akurilin"},"change_message_id":"16a1e96e31c7f7c028a4bb06d4a32ca74b75a2c4","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    CONFIG_SCHEMA \u003d {}"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def __init__(self, ctx):"},{"line_number":74,"context_line":"        self.config \u003d copy.deepcopy("},{"line_number":75,"context_line":"            ctx.get(\"config\", {}).get(self.get_name(), {}))"},{"line_number":76,"context_line":"        if hasattr(self, \"DEFAULT_CONFIG\"):"},{"line_number":77,"context_line":"            for key, value in self.DEFAULT_CONFIG.items():"},{"line_number":78,"context_line":"                self.config.setdefault(key, value)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a122d0e_abaa8f6e","line":75,"range":{"start_line":74,"start_character":8,"end_line":75,"end_character":59},"updated":"2016-04-15 15:29:48.000000000","message":"let\u0027s do it in engine.","commit_id":"e7df0c647d8a680a659cb0a096661f5114014b73"},{"author":{"_account_id":10475,"name":"Alexander Maretskiy","email":"amaretskiy@mirantis.com","username":"maretskiy"},"change_message_id":"b41e18d6e5445afb3991f49fe6f03184d8518e71","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    CONFIG_SCHEMA \u003d {}"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def __init__(self, ctx):"},{"line_number":74,"context_line":"        self.config \u003d copy.deepcopy("},{"line_number":75,"context_line":"            ctx.get(\"config\", {}).get(self.get_name(), {}))"},{"line_number":76,"context_line":"        if hasattr(self, \"DEFAULT_CONFIG\"):"},{"line_number":77,"context_line":"            for key, value in self.DEFAULT_CONFIG.items():"},{"line_number":78,"context_line":"                self.config.setdefault(key, value)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a122d0e_3b65b2b4","line":75,"range":{"start_line":74,"start_character":8,"end_line":75,"end_character":59},"in_reply_to":"1a122d0e_3d3cf392","updated":"2016-04-19 14:55:14.000000000","message":"@Andrey, freezing dict in engine gives zero benefits, because:\n\n* this dict can be easily unfrozen here\n\n* we have to actually modify this dict here in __init__() to apply setdefault for DEFAULT_CONFIG","commit_id":"e7df0c647d8a680a659cb0a096661f5114014b73"},{"author":{"_account_id":6172,"name":"Boris Pavlovic","email":"boris@pavlovic.me","username":"boris-42"},"change_message_id":"1fd856b19615bee19bc9297da36b1bef275c3a1e","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    CONFIG_SCHEMA \u003d {}"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def __init__(self, ctx):"},{"line_number":74,"context_line":"        self.config \u003d copy.deepcopy("},{"line_number":75,"context_line":"            ctx.get(\"config\", {}).get(self.get_name(), {}))"},{"line_number":76,"context_line":"        if hasattr(self, \"DEFAULT_CONFIG\"):"},{"line_number":77,"context_line":"            for key, value in self.DEFAULT_CONFIG.items():"},{"line_number":78,"context_line":"                self.config.setdefault(key, value)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a122d0e_c2e4053d","line":75,"range":{"start_line":74,"start_character":8,"end_line":75,"end_character":59},"in_reply_to":"1a122d0e_abaa8f6e","updated":"2016-04-15 18:41:02.000000000","message":"I would like to make this dict read only instead of just copying, people should get exceptions if they are trying to change it.","commit_id":"e7df0c647d8a680a659cb0a096661f5114014b73"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"c62301f2e93374d7769d09346bb6295e23769630","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    CONFIG_SCHEMA \u003d {}"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def __init__(self, ctx):"},{"line_number":74,"context_line":"        self.config \u003d copy.deepcopy("},{"line_number":75,"context_line":"            ctx.get(\"config\", {}).get(self.get_name(), {}))"},{"line_number":76,"context_line":"        if hasattr(self, \"DEFAULT_CONFIG\"):"},{"line_number":77,"context_line":"            for key, value in self.DEFAULT_CONFIG.items():"},{"line_number":78,"context_line":"                self.config.setdefault(key, value)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a122d0e_3d3cf392","line":75,"range":{"start_line":74,"start_character":8,"end_line":75,"end_character":59},"in_reply_to":"1a122d0e_c2e4053d","updated":"2016-04-15 22:11:51.000000000","message":"+1","commit_id":"e7df0c647d8a680a659cb0a096661f5114014b73"},{"author":{"_account_id":11748,"name":"Chris St. Pierre","email":"cstpierr@cisco.com","username":"stpierre"},"change_message_id":"9f9cb97a3f9853b5bab793a90d575e640d43b843","unresolved":false,"context_lines":[{"line_number":78,"context_line":"                    config.setdefault(key, value)"},{"line_number":79,"context_line":"            self.config \u003d utils.FrozenDict(config)"},{"line_number":80,"context_line":"        else:"},{"line_number":81,"context_line":"            self.config \u003d tuple(config)"},{"line_number":82,"context_line":"        self.context \u003d ctx"},{"line_number":83,"context_line":"        self.task \u003d self.context.get(\"task\", {})"},{"line_number":84,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"dab17558_d4805249","line":81,"updated":"2016-05-05 20:58:14.000000000","message":"There\u0027s a lot of logic wrapped up in this very concise (and not very pythonic) code. I\u0027d like to see a comment or two here explaining:\n\n1. What exactly that first line (\u0027config \u003d ...\u0027) is fetching, and the three defaults that are assigned. (Especially: under what circumstances is the final \u0027 or {}\u0027 used?)\n\n2. The various possible types that \u0027config\u0027 could be, and why it won\u0027t be anything else (i.e., why converting it to a tuple should always work if it\u0027s not a dict).\n\n3. Why we change \u0027config\u0027 to FrozenDict or tuple. You should just be able to copy that out of the commit message, but I think it\u0027d be good to have it inline to make better sense of this dense code.\n\nIf you wanted to rewrite this using a try-except instead of doing direct type comparison I think that\u0027d be nicer, but not strictly necessary.","commit_id":"18be82e154c635adbd5e26281feb902062c7966a"},{"author":{"_account_id":10475,"name":"Alexander Maretskiy","email":"amaretskiy@mirantis.com","username":"maretskiy"},"change_message_id":"44e12e452561d278d2165a6457161988fbb8682a","unresolved":false,"context_lines":[{"line_number":78,"context_line":"                    config.setdefault(key, value)"},{"line_number":79,"context_line":"            self.config \u003d utils.FrozenDict(config)"},{"line_number":80,"context_line":"        else:"},{"line_number":81,"context_line":"            self.config \u003d tuple(config)"},{"line_number":82,"context_line":"        self.context \u003d ctx"},{"line_number":83,"context_line":"        self.task \u003d self.context.get(\"task\", {})"},{"line_number":84,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"dab17558_b31dd268","line":81,"in_reply_to":"dab17558_d4805249","updated":"2016-05-06 09:09:50.000000000","message":"1)\n\n\n* \u0027config \u003d ...\u0027 obtains configuration data for this context, for example:\n https://goo.gl/5rcJNP (as dict) or https://goo.gl/ezRweI (as list)\n\n* \u0027 or {}\u0027 seems to be redundant. I will remove it.\n\n2) We currently use dict configuration in all context plugins except cleanup - it uses list (https://goo.gl/JCDUxT)\n\nAnother types - yes, theoretically possible, however very improbable - just imagine boolean or int configuration, even string type is not useful. Configuration types are limited by JSONSchema types - their number is limited.\n\nSince boolean, int and string types are immutable, I will just add a line of code that simply assigns this value to config without any transformation. However I think that this operation is rather redundant.\n\n3)\n\n* We discussed usage of FrozenDict for this purpose on our weekly meeting http://eavesdrop.openstack.org/meetings/rally/2016/rally.2016-04-25-14.04.log.html\n\n* try-except is more pythonic, however I would not prefer this approach right here, checking type is rather good","commit_id":"18be82e154c635adbd5e26281feb902062c7966a"}]}
