)]}'
{"smaug/services/protection/protectable_plugin.py":[{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"@six.add_metaclass(abc.ABCMeta)"},{"line_number":18,"context_line":"class ProtectablePlugin(object):"},{"line_number":19,"context_line":"    \"\"\"Base abstract class for protectable plugin."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_1713afb9","line":18,"range":{"start_line":18,"start_character":6,"end_line":18,"end_character":23},"updated":"2016-05-09 06:30:11.000000000","message":"All the interfaces of ProtectablePlugin should be classmethod, because class method is more appropriate than instance method, there are not attributes to keep in the instance, including the context which can be passed by arguments.\nMiss the declaring of function \u0027show_resource\u0027","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"    \"\"\""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"    def __init__(self, context\u003dNone):"},{"line_number":24,"context_line":"        self._context \u003d context"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    def instance(self, context):"}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_bddd6116","line":23,"range":{"start_line":23,"start_character":8,"end_line":23,"end_character":16},"updated":"2016-05-09 06:30:11.000000000","message":"delete __init__","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    def __init__(self, context\u003dNone):"},{"line_number":24,"context_line":"        self._context \u003d context"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    def instance(self, context):"},{"line_number":27,"context_line":"        return self.__class__(context)"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_9d921d4a","line":26,"range":{"start_line":26,"start_character":8,"end_line":26,"end_character":16},"updated":"2016-05-09 06:30:11.000000000","message":"delete this function","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        pass"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    @abc.abstractmethod"},{"line_number":48,"context_line":"    def list_resources(self):"},{"line_number":49,"context_line":"        \"\"\"List resource instances of type this plugin supported."},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        :return: The list of resource instance."}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_57a09743","line":48,"range":{"start_line":48,"start_character":8,"end_line":48,"end_character":22},"updated":"2016-05-09 06:30:11.000000000","message":"Declare it like this:\n@classmethod\n@abc.abstractmethod\ndef list_resources(cls, context):","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        pass"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"    @abc.abstractmethod"},{"line_number":56,"context_line":"    def get_dependent_resources(self, parent_resource):"},{"line_number":57,"context_line":"        \"\"\"List dependent resource instances."},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        The listed resource instances are of type this plugin supported,"}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_7785dbab","line":56,"range":{"start_line":56,"start_character":8,"end_line":56,"end_character":31},"updated":"2016-05-09 06:30:11.000000000","message":"Declare it like this:\n@classmethod\n@abc.abstractmethod\ndef get_dependent_resources(cls, context, parent_resource):","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"}],"smaug/services/protection/protectable_registry.py":[{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":47,"context_line":"    def register_plugin(self, plugin):"},{"line_number":48,"context_line":"        self._plugin_map[plugin.get_resource_type()] \u003d plugin"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def _get_protectable(self, context, resource_type):"},{"line_number":51,"context_line":"        if resource_type not in self._plugin_map:"},{"line_number":52,"context_line":"            raise exception.ProtectableTypeNotFound("},{"line_number":53,"context_line":"                protectable_type\u003dresource_type"}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_b7e1039d","line":50,"range":{"start_line":50,"start_character":8,"end_line":50,"end_character":24},"updated":"2016-05-09 06:30:11.000000000","message":"No need to create instance of plugin, just return plugin, because all the interface of it are classmethod.","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        :return: The list of resource instance."},{"line_number":73,"context_line":"        \"\"\""},{"line_number":74,"context_line":"        protectable \u003d self._get_protectable(context, resource_type)"},{"line_number":75,"context_line":"        return protectable.list_resources()"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    def show_resource(self, context, resource_type, resource_id):"},{"line_number":78,"context_line":"        \"\"\"List resource instances of given type."}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_b782a250","line":75,"range":{"start_line":75,"start_character":27,"end_line":75,"end_character":41},"updated":"2016-05-09 06:30:11.000000000","message":"Pass context:list_resources(context)","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        :return: The show of resource instance."},{"line_number":83,"context_line":"        \"\"\""},{"line_number":84,"context_line":"        protectable \u003d self._get_protectable(context, resource_type)"},{"line_number":85,"context_line":"        return protectable.show_resource(resource_id)"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"    def fetch_dependent_resources(self, context, resource):"},{"line_number":88,"context_line":"        \"\"\"List dependent resources under given parent resource."}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_17644ee3","line":85,"range":{"start_line":85,"start_character":27,"end_line":85,"end_character":40},"updated":"2016-05-09 06:30:11.000000000","message":"Pass context:show_resource(context, resource_id)","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"cadede9b80631e690e6a0d44ce081d3b1630426d","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        protectable \u003d self._get_protectable(context, resource_type)"},{"line_number":85,"context_line":"        return protectable.show_resource(resource_id)"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"    def fetch_dependent_resources(self, context, resource):"},{"line_number":88,"context_line":"        \"\"\"List dependent resources under given parent resource."},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        :param resource: The parent resource to list dependent resources."}],"source_content_type":"text/x-python","patch_set":1,"id":"dab17558_3716b355","line":87,"range":{"start_line":87,"start_character":8,"end_line":87,"end_character":33},"updated":"2016-05-09 06:30:11.000000000","message":"We can implement it like this:\n\nresult \u003d []\nfor plugin in six.itervalues(self._plugin_map):\n    if resource.type in plugin.get_parent_resource_types():   \n        result.extend(plugin.get_dependent_resources(\n            context, resource))\n\nreturn result","commit_id":"4905202437d788b4d350c22304b3289adac71cb7"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"946e79314203a115e5a2bff8e591248073838fbc","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        result \u003d []"},{"line_number":95,"context_line":"        for plugin in six.itervalues(self._plugin_map):"},{"line_number":96,"context_line":"            if resource.type in plugin.get_parent_resource_types():"},{"line_number":97,"context_line":"                protectable \u003d self._get_protectable(plugin.get_resource_type())"},{"line_number":98,"context_line":"                result.extend(protectable.get_dependent_resources(context,"},{"line_number":99,"context_line":"                                                                  resource))"},{"line_number":100,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"bab6814e_193d1d8f","line":97,"range":{"start_line":97,"start_character":16,"end_line":97,"end_character":79},"updated":"2016-05-23 07:05:19.000000000","message":"self._get_protectable returns the plugin in self._plugin_map and here you traverse self._plugin_map, so there is no need to get plugin itself again.","commit_id":"168c52765928effcb40eb5d8a69d4df90f2de167"},{"author":{"_account_id":18266,"name":"zengchen","email":"chenzeng2@huawei.com","username":"zengchen"},"change_message_id":"f9fb5b15defea1a431b9629624c900276a5fc0a7","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        :param resource: The parent resource to list dependent resources."},{"line_number":92,"context_line":"        :return: The list of dependent resources."},{"line_number":93,"context_line":"        \"\"\""},{"line_number":94,"context_line":"        result \u003d []"},{"line_number":95,"context_line":"        protectable \u003d self._get_protectable(resource.type)"},{"line_number":96,"context_line":"        for parent_type in protectable.get_parent_resource_types():"},{"line_number":97,"context_line":"            parent_protectable \u003d self._get_protectable(parent_type)"},{"line_number":98,"context_line":"            result.extend(parent_protectable.get_dependent_resources(context,"},{"line_number":99,"context_line":"                                                                     resource))"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        return result"},{"line_number":102,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"bab6814e_166cbf9a","line":99,"range":{"start_line":94,"start_character":0,"end_line":99,"end_character":79},"updated":"2016-05-23 10:17:06.000000000","message":"If you compare with the old codes, the logic of your new codes is wrong. This method is used to get the child resources of specified resource. For example, the param resource is \u0027server\u0027, then new codes will return [], but the result should be volume list.","commit_id":"e600542301fcc1d2a741e6eec540102d2315f8dd"},{"author":{"_account_id":20883,"name":"Yuval Brik","email":"yuval@brik.org.il","username":"yuvalbr"},"change_message_id":"43a920fc3a7d5e60f662d1da55464396f72c6a37","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        :param resource: The parent resource to list dependent resources."},{"line_number":92,"context_line":"        :return: The list of dependent resources."},{"line_number":93,"context_line":"        \"\"\""},{"line_number":94,"context_line":"        result \u003d []"},{"line_number":95,"context_line":"        protectable \u003d self._get_protectable(resource.type)"},{"line_number":96,"context_line":"        for parent_type in protectable.get_parent_resource_types():"},{"line_number":97,"context_line":"            parent_protectable \u003d self._get_protectable(parent_type)"},{"line_number":98,"context_line":"            result.extend(parent_protectable.get_dependent_resources(context,"},{"line_number":99,"context_line":"                                                                     resource))"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        return result"},{"line_number":102,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"bab6814e_1a8b4120","line":99,"range":{"start_line":94,"start_character":0,"end_line":99,"end_character":79},"in_reply_to":"bab6814e_166cbf9a","updated":"2016-05-23 11:06:17.000000000","message":"Thanks!","commit_id":"e600542301fcc1d2a741e6eec540102d2315f8dd"},{"author":{"_account_id":2023,"name":"Saggi Mizrahi","email":"ficoos+osreview@gmail.com","username":"ficoos"},"change_message_id":"330a5be169f0b1099b45ffadd50e40fa4153d291","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class ProtectableRegistry(object):"},{"line_number":35,"context_line":"    _plugin_map \u003d {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def load_plugins(self):"},{"line_number":38,"context_line":"        \"\"\"Load all protectable plugins configured and register them."}],"source_content_type":"text/x-python","patch_set":4,"id":"bab6814e_9647c51c","line":35,"range":{"start_line":35,"start_character":0,"end_line":35,"end_character":20},"updated":"2016-05-24 13:08:23.000000000","message":"This obscures from the user the state of the object. Please use conventional singleton pattern.","commit_id":"3229932b04c3695dfe62cedbeff22c166162d1c1"}]}
