def loads(self, requirements_text):
        lines = re.findall(Requirement.spec_regex,
                           requirements_text,
                           re.MULTILINE)
        for line in lines:
            self.add(Requirement(line[0], "".join(line[1:])))
def uninstall_plugin(plugin):
    plugin = get_plugin_from_all(plugin)
    if plugin.uninstallable:
        plugin.uninstall()
        Setting.invalidate_cache()

        flash(_("Plugin has been uninstalled."), "success")
    else:
        flash(_("Cannot uninstall plugin."), "danger")

    return redirect(url_for("management.plugins"))