MCPcopy Index your code
hub / github.com/modelscope/modelscope / update_plugins_file

Method update_plugins_file

modelscope/utils/plugins.py:1153–1181  ·  view source on GitHub ↗

update the plugins file in order to maintain the latest plugins information Args: plugins_list: The plugins list contain the information of plugins name, version, introduction, install url and the status of delete or update override: Override the file

(
        self,
        plugins_list,
        override=False,
    )

Source from the content-addressed store, hash-verified

1151 return local_plugins_info
1152
1153 def update_plugins_file(
1154 self,
1155 plugins_list,
1156 override=False,
1157 ):
1158 """update the plugins file in order to maintain the latest plugins information
1159
1160 Args:
1161 plugins_list: The plugins list contain the information of plugins
1162 name, version, introduction, install url and the status of delete or update
1163 override: Override the file by the list if True, else only update.
1164
1165 Returns:
1166 local_plugins_info_json: the json version of updated plugins info
1167
1168 """
1169 local_plugins_info = self._get_plugins_from_file()
1170
1171 # local_plugins_info is empty if first time loading, should add OFFICIAL_PLUGINS information
1172 if local_plugins_info == {}:
1173 plugins_list.extend(copy.deepcopy(OFFICIAL_PLUGINS))
1174
1175 local_plugins_info = self._update_plugins(plugins_list,
1176 local_plugins_info, override)
1177
1178 local_plugins_info_json = json.dumps(local_plugins_info)
1179 storage.write(local_plugins_info_json.encode(), self.file_path)
1180
1181 return local_plugins_info_json
1182
1183 def remove_plugins_from_file(
1184 self,

Callers 1

install_pluginsMethod · 0.95

Calls 6

_update_pluginsMethod · 0.95
extendMethod · 0.45
dumpsMethod · 0.45
writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected