Cleanup translations of specific records in a module.

    :param module: module name
    :param xml_ids: a tuple or list of xml record IDs
196830
def delete_record_translations(cr, module, xml_ids):
    
    if not isinstance(xml_ids, (list, tuple)):
        do_raise("XML IDs %s must be a tuple or list!" % (xml_ids))

    cr.execute("""
        SELECT model, res_id
        FROM ir_model_data
        WHERE module = %s AND name in %s
    """, (module, tuple(xml_ids),))
    for row in cr.fetchall():
        query = ("""
            DELETE FROM ir_translation
            WHERE module = %s AND name LIKE %s AND res_id = %s;
        """)
        logged_query(cr, query, (module, row[0] + ',%', row[1],))
1096832
public void clearRegisteredModules()
    {
        ServletContext servletContext = getServletContext();
        
        for ( Iterator ii = _registeredModules.keySet().iterator(); ii.hasNext(); )  
        {
            String modulePrefix = ( String ) ii.next();
            servletContext.removeAttribute( Globals.MODULE_KEY + modulePrefix );
            servletContext.removeAttribute( Globals.REQUEST_PROCESSOR_KEY + modulePrefix );
        }
        
        _registeredModules.clear();
    }
1231997
def verboselogs_module_transform(mod):
    """"""
    if mod.name == 'logging':
        for const in ['NOTICE', 'SPAM', 'SUCCESS', 'VERBOSE']:
            mod.locals[const] = [nodes.Const(const)]
1093657
def rt_update_module(self, xmldict, module):
        
        #This keeps track of how many character were added/removed by
        #updating the docstrings in xmldict.
        delta = 0
        for kdecor in xmldict:
            if "." in kdecor:
                modname, memname = kdecor.split(".")
            else:
                modname, memname = module.name, None

            if module.name == modname:
                #This tag is relevant to the specified module. Continue
                xlist, docstart, docend = xmldict[kdecor]

                #We only need to check the members, types and executables
                #For executables and types, we need to update the docstart and
                #docend attributes since their docstrings must come as a single
                #block immediately preceding the signature, so that our values
                #from the updater will be correct.
                if memname in module.types:
                    member = module.types[memname]
                    docs = self.to_doc(xlist, memname)
                    member.docstring = docs
                    delta += self._rt_update_docindices(member, docstart, docend)
                elif memname in module.executables:
                    member = module.executables[memname]
                    docs = self.to_doc(xlist, memname)
                    self.process_execdocs(docs, member, kdecor, False)
                    delta += self._rt_update_docindices(member, docstart, docend)
                else:
                    #Since it didn't point to anything else, it must be for the
                    #members of the module.
                    docs = self.to_doc(xlist, modname)
                    self.process_memberdocs(docs, module, False)               
                
        return delta
89569
def get_all_db_ids(language=DEFAULT_LANG):
        
        _ids = []
        json_path = DBVuln.get_json_path(language=language)

        for _file in os.listdir(json_path):

            if not _file.endswith('.json'):
                continue

            _id = _file.split('-')[0]
            _ids.append(_id)

        return _ids
763409
def _update_loaded_modules(self):
        
        system_modules = sys.modules.keys()
        for module in list(self.loaded_modules):
            if module not in system_modules:
                self.processed_filepaths.pop(module)
                self.loaded_modules.remove(module)
615132
def remove_module_docstring(app, what, name, obj, options, lines):
    
    if what == "module" and name == "clusterpolate":
        del lines[:]
1052441
def dashes_cleanup(records, prune_chars='.:?~'):
    
    logging.info(
        "Applying _dashes_cleanup: converting any of '{}' to '-'.".format(prune_chars))
    translation_table = {ord(c): '-' for c in prune_chars}
    for record in records:
        record.seq = Seq(str(record.seq).translate(translation_table),
                         record.seq.alphabet)
        yield record
827748
def _xml_update_modules(self, xmldict, modules):
        """"""
        for kdecor in xmldict:
            modname, memname = kdecor.split(".")
            if modname in modules:
                module = modules[modname]
                #We only need to check the members, types and executables
                memname = memname.lower()
                if memname in module.members:
                    docs = self.to_doc(xmldict[kdecor], modname)
                    self.process_memberdocs(docs, module)
                elif memname in module.types:
                    member = module.types[memname]
                    docs = self.to_doc(xmldict[kdecor], memname)
                    member.docstring.extend(docs)
                elif memname in module.executables:
                    member = module.executables[memname]
                    docs = self.to_doc(xmldict[kdecor], memname)
                    self.process_execdocs(docs, member, kdecor)
                else:
                    msg.warn("orphaned docstring. No member {} in module {}.".format(
                        memname, modname))
            else:
                msg.warn("orphaned docstring from XML docfile for {}".format(kdecor))
728472
public function cleanup()
    {
        $aDeletedModules = $this->getDeletedExtensions();

        //collecting deleted extension IDs
        $aDeletedModuleIds = array_keys($aDeletedModules);

        // removing from aModules config array
        $this->_removeExtensions($aDeletedModuleIds);

        // removing from aDisabledModules array
        $this->_removeFromDisabledModulesArray($aDeletedModuleIds);

        // removing from aModulePaths array
        $this->removeFromModulesArray(static::MODULE_KEY_PATHS, $aDeletedModuleIds);

        // removing from aModuleEvents array
        $this->removeFromModulesArray(static::MODULE_KEY_EVENTS, $aDeletedModuleIds);

        // removing from aModuleVersions array
        $this->removeFromModulesArray(static::MODULE_KEY_VERSIONS, $aDeletedModuleIds);

        // removing from aModuleExtensions array
        $this->removeFromModulesArray(static::MODULE_KEY_EXTENSIONS, $aDeletedModuleIds);

        // removing from aModuleFiles array
        $this->removeFromModulesArray(static::MODULE_KEY_FILES, $aDeletedModuleIds);

        // removing from aModuleTemplates array
        $this->removeFromModulesArray(static::MODULE_KEY_TEMPLATES, $aDeletedModuleIds);

        // removing from aModuleControllers array
        $this->removeFromModulesArray(static::MODULE_KEY_CONTROLLERS, $aDeletedModuleIds);

        //removing from config tables and templates blocks table
        $this->_removeFromDatabase($aDeletedModuleIds);

        //Remove from caches.
        \OxidEsales\Eshop\Core\Module\ModuleVariablesLocator::resetModuleVariables();
    }
1080089
function cleanupLevelIds($levelIds, $mode)
    {
        foreach ($this->schema->getLevels() as $level) {
            if (isset($levelIds[$level . '_id'])) {
                $levelIds[$level] = $levelIds[$level . '_id'];
                unset($levelIds[$level . '_id']);
            }
        }
        return $levelIds;
    }
496899
def update_ids(connection, xmldoc, verbose = False):
	
	# NOTE:  it's critical that the xmldoc object be retrieved *before*
	# the rows whose IDs need to be updated are inserted.  The xml
	# retrieval resets the "last max row ID" values inside the table
	# objects, so if retrieval of the xmldoc is deferred until after
	# the rows are inserted, nothing will get updated.  therefore, the
	# connection and xmldoc need to be passed separately to this
	# function, even though it seems this function could reconstruct
	# the xmldoc itself from the connection.
	table_elems = xmldoc.getElementsByTagName(ligolw.Table.tagName)
	for i, tbl in enumerate(table_elems):
		if verbose:
			print >>sys.stderr, "updating IDs: %d%%\r" % (100.0 * i / len(table_elems)),
		tbl.applyKeyMapping()
	if verbose:
		print >>sys.stderr, "updating IDs: 100%"

	# reset ID mapping for next document
	dbtables.idmap_reset(connection)
829083
def delete_module(modname):
    
    try:
        _ = sys.modules[modname]
    except KeyError:
        raise ValueError("Module not found in sys.modules: '{}'".format(modname))

    for module in list(sys.modules.keys()):
        if module and module.startswith(modname):
            del sys.modules[module]
1138697
def linkify_s_by_module(self, modules):
        
        for i in self:

            links_list = strip_and_uniq(i.modules)
            new = []
            for name in [e for e in links_list if e]:
                module = modules.find_by_name(name)
                if module is not None and module.uuid not in new:
                    new.append(module)
                else:
                    i.add_error("Error: the module %s is unknown for %s" % (name, i.get_name()))

            i.modules = new
802869
def database_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)
619061
def clean_translated_locales(configuration, langs=None):
    
    if not langs:
        langs = configuration.translated_locales
    for locale in langs:
        clean_locale(configuration, locale)
1142167
public static function cleanModuleList($modules)
    {
        $app = \JFactory::getApplication();

        // Apply negative selections and eliminate duplicates
        $Itemid = \JFactory::getApplication()->input->getInt('Itemid');
        $negId = $Itemid ? -(int) $Itemid : false;
        $clean = array();
        $dupes = array();

        foreach ($modules as $i => $module)
        {
            // The module is excluded if there is an explicit prohibition
            $negHit = ($negId === (int) $module->menuid);

            if (isset($dupes[$module->id]))
            {
                // If this item has been excluded, keep the duplicate flag set,
                // but remove any item from the modules array.
                if ($negHit)
                {
                    unset($clean[$module->id]);
                }

                continue;
            }

            $dupes[$module->id] = true;

            // Only accept modules without explicit exclusions.
            if ($negHit)
            {
                continue;
            }

            $module->name = substr($module->module, 4);
            $module->style = null;
            $module->position = strtolower($module->position);

            $clean[$module->id] = $module;
        }

        unset($dupes);

        // Do 3rd party stuff to manipulate module array.
        // Any plugins using this architecture may make alterations to the referenced $modules array.
        // To remove items you can do unset($modules[n]) or $modules[n]->published = false.

        // "onPrepareModuleList" may alter or add $modules, and does not need to return anything.
        // This should be used for module addition/deletion that the user would expect to happen at an
        // early stage.
        $app->triggerEvent( 'onPrepareModuleList', array( &$clean ) );

        // "onAlterModuleList" may alter or add $modules, and does not need to return anything.
        $app->triggerEvent( 'onAlterModuleList', array( &$clean ) );

        // "onPostProcessModuleList" allows a plugin to perform actions like parameter changes
        // on the completed list of modules and is guaranteed to occur *after*
        // the earlier plugins.
        $app->triggerEvent( 'onPostProcessModuleList', array( &$clean ) );

        // Remove any that were marked as disabled during the preceding steps
        /*foreach ( $clean as $id => $module )
        {
            if ( !isset( $module->published ) || $module->published == 0 )
            {
                unset( $clean[$id] );
            }
        }*/

        // Return to simple indexing that matches the query order.
        return array_values($clean);
    }