Load upgrade modules.

        :param remove_applied: if True, already applied upgrades will not
            be included, if False the entire upgrade graph will be
            returned.
174737
def _load_upgrades(self, remove_applied=True):
        
        if remove_applied:
            self.load_history()

        for entry_point in iter_entry_points('invenio_upgrader.upgrades'):
            upgrade = entry_point.load()()
            self.__class__._upgrades[upgrade.name] = upgrade

        return self.__class__._upgrades
38325
def upgrade(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.upgrade(index=self._name, **kwargs)
422083
def refresh_index(meta, index) -> None:
    
    # All projections include model + index keys
    projection_keys = set.union(meta.keys, index.keys)

    proj = index.projection
    mode = proj["mode"]

    if mode == "keys":
        proj["included"] = projection_keys
    elif mode == "all":
        proj["included"] = meta.columns
    elif mode == "include":  # pragma: no branch
        if all(isinstance(p, str) for p in proj["included"]):
            proj["included"] = set(meta.columns_by_name[n] for n in proj["included"])
        else:
            proj["included"] = set(proj["included"])
        proj["included"].update(projection_keys)

    if proj["strict"]:
        proj["available"] = proj["included"]
    else:
        proj["available"] = meta.columns
311933
def bulk_remove(self, named_graph, add, size=DEFAULT_CHUNK_SIZE):
        
        return self.bulk_update(named_graph, add, size, is_add=False)
58131
def produce_upgrade_operations(
        ctx=None, metadata=None, include_symbol=None, include_object=None,
        **kwargs):
    """"""
    if metadata is None:
        # Note, all SQLAlchemy models must have been loaded to produce
        # accurate results.
        metadata = db.metadata
    if ctx is None:
        ctx = create_migration_ctx(target_metadata=metadata, **kwargs)

    template_args = {}
    imports = set()

    _produce_migration_diffs(
        ctx, template_args, imports,
        include_object=include_object,
        include_symbol=include_symbol,
        **kwargs
    )

    return template_args
1084717
def get_activations(self):
        """"""
        res = (self.added, self.removed)

        self.added = set()
        self.removed = set()

        return res
1306094
def untrace_modules(self, modules):
        

        for module in modules:
            foundations.trace.untrace_module(module)
        self.__model__refresh_attributes()
        return True
955192
def choose_upg(packages):
    
    selected_packages, data = [], []
    if packages:
        for pkg in packages:
            name = GetFromInstalled(pkg).name()
            ver = GetFromInstalled(pkg).version()
            binary = "{0}{1}".format(name, ver)
            installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0]
            data.append(installed)
        text = "Press 'spacebar' to unchoose packages from upgrade"
        title = " Upgrade "
        backtitle = "{0} {1}".format(_meta_.__all__, _meta_.__version__)
        status = True
        pkgs = DialogUtil(data, text, title, backtitle,
                          status).checklist()
        pkgs = [] if pkgs is None else pkgs
        for pkg in pkgs:
            name = split_package(pkg)[0]
            if name in packages:
                selected_packages.append(name)
        if not selected_packages:
            raise SystemExit()
        print("")
    return selected_packages
358659
def pending():
    """"""
    upgrader = InvenioUpgrader()
    logger = upgrader.get_logger()

    try:
        upgrades = upgrader.get_upgrades()

        if not upgrades:
            logger.info("All upgrades have been applied.")
            return

        logger.info("Following upgrade(s) are ready to be applied:")

        for u in upgrades:
            logger.info(
                " * {0} {1}".format(u.name, u.info))
    except RuntimeError as e:
        for msg in e.args:
            logger.error(unicode(msg))
        raise
557470
def changes(self):
        
        try:
            return self.added, self.removed
        finally:
            self.added = list()
            self.removed = list()
712873
def remove_armstrong():
    """"""

    from pip.util import get_installed_distributions
    pkgs = get_installed_distributions(local_only=True, include_editables=True)
    apps = [pkg for pkg in pkgs
            if pkg.key.startswith('armstrong') and pkg.key != 'armstrong.dev']

    for app in apps:
        run("pip uninstall -y %s" % app.key)

    if apps:
        print(
            "Note: this hasn't removed other dependencies installed by "
            "these components. There's no substitute for a fresh virtualenv.")
    else:
        print("No Armstrong components to remove.")
866687
def upgrade_available(name, **kwargs):
    '''
    
    '''
    version = None
    cmd = ['pkg', 'list', '-Huv', name]
    lines = __salt__['cmd.run_stdout'](cmd).splitlines()
    if not lines:
        return {}
    ret = {}
    for line in lines:
        ret[_ips_get_pkgname(line)] = _ips_get_pkgversion(line)
    return ret
1014021
def changed(self):
        
        # Not installed modules cannot issue a change to save
        if not self.installed:
            return False

        # Check if module status changed
        if self._info._changed:
            return True

        # Check model changes
        for model in self.models():
            if model.objects.changed().count() or \
               model.objects.deleted().count():
                return True

        # Nothing passed, module not changed
        return False
1225130
def registerDeletionUpgrader(itemType, fromVersion, toVersion):
    
    # XXX This should actually do something more special so that a new table is
    # not created and such.
    def upgrader(old):
        old.deleteFromStore()
        return None
    registerUpgrader(upgrader, itemType.typeName, fromVersion, toVersion)
613741
def upgrade(yes, dry_run, patches):
    
    patcher = _get_mongopatcher()
    if dry_run:
        patcher.discover_and_apply(directory=patches, dry_run=dry_run)
    else:
        if (yes or prompt_bool("Are you sure you want to alter %s" %
                               green(patcher.db))):
            patcher.discover_and_apply(patches)
        else:
            raise SystemExit('You changed your mind, exiting...')
989509
def load_dynamic(self, matches):
        '''
        
        '''
        if not self.opts['autoload_dynamic_modules']:
            return
        syncd = self.state.functions['saltutil.sync_all'](list(matches),
                                                          refresh=False)
        if syncd['grains']:
            self.opts['grains'] = salt.loader.grains(self.opts)
            self.state.opts['pillar'] = self.state._gather_pillar()
        self.state.module_refresh()
1088956
def list_upgrades(refresh=True, **kwargs):  # pylint: disable=W0613
    '''
    
    '''
    if salt.utils.data.is_true(refresh):
        refresh_db()
    upgrades = {}
    lines = __salt__['cmd.run_stdout'](
        '/opt/csw/bin/pkgutil -A --parse').splitlines()
    for line in lines:
        comps = line.split('\t')
        if comps[2] == "SAME":
            continue
        if comps[2] == "not installed":
            continue
        upgrades[comps[0]] = comps[1]
    return upgrades