MCPcopy Create free account
hub / github.com/modelscope/modelscope / remove_plugins_from_file

Method remove_plugins_from_file

modelscope/utils/plugins.py:1183–1207  ·  view source on GitHub ↗

remove the plugins from file Args: package_names: package name Returns: local_plugins_info_json: the json version of updated plugins info

(
        self,
        package_names: Union[str, list],
    )

Source from the content-addressed store, hash-verified

1181 return local_plugins_info_json
1182
1183 def remove_plugins_from_file(
1184 self,
1185 package_names: Union[str, list],
1186 ):
1187 """remove the plugins from file
1188 Args:
1189 package_names: package name
1190
1191 Returns:
1192 local_plugins_info_json: the json version of updated plugins info
1193
1194 """
1195 local_plugins_info = self._get_plugins_from_file()
1196
1197 if type(package_names) is str:
1198 package_names = list(package_names)
1199
1200 for item in package_names:
1201 if item in local_plugins_info:
1202 local_plugins_info.pop(item)
1203
1204 local_plugins_info_json = json.dumps(local_plugins_info)
1205 storage.write(local_plugins_info_json.encode(), self.file_path)
1206
1207 return local_plugins_info_json
1208
1209
1210class EnvsManager(object):

Callers 1

uninstall_pluginsMethod · 0.95

Calls 4

dumpsMethod · 0.45
writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected