Uninstall this importer if possible and un-import any modules imported by it.
774770
def uninstall(self):
    """"""
    if not self._uninstallable:
      _tracer().log('Not uninstalling {}'.format(self), V=9)
      return

    if self in sys.meta_path:
      sys.meta_path.remove(self)
      maybe_exposed = frozenset(os.path.join(self._root, importable.path)
                                for importable in self._importables)
      sys.path[:] = [path_item for path_item in sys.path if path_item not in maybe_exposed]
      for loader in self._loaders:
        loader.unload()
      _tracer().log('Uninstalled {}'.format(self), V=3)
1168501
def del_module(self, module):
        """"""
        rev = util.get_latest_revision(module)
        del self.modules[(module.arg, rev)]
693733
def unregister_module(self, module):
        
        if module not in self._namespaces.values():
            raise NoRegisteredError("Module '{0}' is not registered on loader.".format(module))

        for ns, mod in list(self._namespaces.items()):
            if mod == module:
                self.unregister_namespace(ns)
669266
def _remove_non_methods():
  """"""
  cur_module = sys.modules[__name__]
  my_globals = dict(globals())
  # Import here so that it doesn't get added to the global namespace or deleted.
  # pylint: disable=g-import-not-at-top
  from prettytensor.pretty_tensor_class import PrettyTensor
  for name, _ in six.iteritems(my_globals):
    if not hasattr(PrettyTensor, name):
      delattr(cur_module, name)
  # Remove a couple of special ones....
  if hasattr(cur_module, 'bookkeeper'):
    delattr(cur_module, 'bookkeeper')
252655
def _cleanup(self):
        """"""
        self._expkg = None
        self._extmp = None
        self._flag_e = True
        self._ifile.close()
372891
void unregisterUse() {
		final int value = this.uses.decrementAndGet();
		if (value == 0) {
			uninstall(UninstallationStage.PRE_DESTROY_EVENT);
			uninstall(UninstallationStage.POST_DESTROY_EVENT);
		}
	}
543062
public static void uninstall() {
        synchronized (log()) {
            if (cInstalled) {
                cInstalled = false;
                System.setOut(cOriginalOut);
                System.setErr(cOriginalErr);
                cOriginalOut = null;
                cOriginalErr = null;
                cSystemOut = null;
                cSystemErr = null;
            }
        }
    }
1028668
public function unregister()
    {

        // query whether the cache is ready or if we aren't in production mode
        if (!$this->cacheIsReady || $this->environment !== 'production') {
            // If yes, unload the appropriate autoloader method
            spl_autoload_unregister(array($this, self::OUR_LOADER));
            return;
        }

        // the cache has been ready, so unregister the simple class loader
        spl_autoload_unregister(array($this, self::OUR_LOADER_PROD_NO_OMIT));
    }
87860
async def unloadmodule(self, module, ignoreDependencies = False):
        '''
        
        '''
        self._logger.debug('Try to unload module %r', module)
        if hasattr(module, '_instance'):
            self._logger.debug('Module %r is loaded, module state is %r', module, module._instance.state)
            inst = module._instance
            if inst.state == ModuleLoadStateChanged.LOADING or inst.state == ModuleLoadStateChanged.LOADED:
                # Wait for loading
                # Wait for succeeded or failed
                sm = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.SUCCEEDED)
                fm = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.FAILED)
                await M_(sm, fm)
            elif inst.state == ModuleLoadStateChanged.UNLOADING or inst.state == ModuleLoadStateChanged.UNLOADED:
                um = ModuleLoadStateChanged.createMatcher(module, ModuleLoadStateChanged.UNLOADED)
                await um
        if hasattr(module, '_instance') and (module._instance.state == ModuleLoadStateChanged.SUCCEEDED or
                                             module._instance.state == ModuleLoadStateChanged.FAILED):
            self._logger.info('Unloading module %r', module)
            inst = module._instance
            # Change state to unloading to prevent more dependencies
            await inst.changestate(ModuleLoadStateChanged.UNLOADING, self)
            if not ignoreDependencies:
                deps = [d for d in inst.dependedBy if hasattr(d, '_instance') and d._instance.state != ModuleLoadStateChanged.UNLOADED]
                ums = [ModuleLoadStateChanged.createMatcher(d, ModuleLoadStateChanged.UNLOADED) for d in deps]
                for d in deps:
                    self.subroutine(self.unloadmodule(d), False)
                await self.wait_for_all(*ums)
            await inst.unload(self)
            del self.activeModules[inst.getServiceName()]
            self._logger.info('Module %r is unloaded', module)
            if not ignoreDependencies:
                for d in module.depends:
                    if hasattr(d, '_instance') and module in d._instance.dependedBy:
                        self._removeDepend(module, d)
342880
def remove(cls, module_name):
        
        module_guards = cls._guards.get(module_name, False)
        if module_guards:
            module_guards.pop()
            cls._num_entries -= 1
            if cls._num_entries < 1:
                if cls._num_entries < 0:
                    raise Exception(
                        'Bug: ImportGuardHook._num_entries became negative!'
                    )
                cls._uninstall()
803067
public static function uninstall() {
		$cptp = CPTP::get_instance();

		foreach ( $cptp->modules as $module ) {
			$module->uninstall_hook();
		}
	}
18186
def pip_remove(self, name=None, prefix=None, pkgs=None):
        """"""
        logger.debug(str((prefix, pkgs)))

        if isinstance(pkgs, (list, tuple)):
            pkg = ' '.join(pkgs)
        else:
            pkg = pkgs

        extra_args = ['uninstall', '--yes', pkg]

        return self._call_pip(name=name, prefix=prefix, extra_args=extra_args)
1374868
public function cleanup()
    {
        try {
            $this->driver->flushdb();
        } catch (\Exception $e) {
            throw new ModuleException(
                __CLASS__,
                $e->getMessage()
            );
        }
    }
998843
def cleanup(self):
    
    # Move any existing errors to global errors
    self.global_errors.extend(self.errors)
    self.errors = []

    # Make the previous module's output available to the next module
    self.input = self.output
    self.output = []
802428
private void uninstallModule(ModuleIdentifier modID) {
    File modDir = new File(modRoot, modID.toString());
    if (modDir.exists()) {
      modDir.delete();
    }
  }
79757
def stop_all(self):
        
        logger.info('Shutting down modules...')
        # Ask internal to quit if they can
        for instance in self.get_internal_instances():
            if hasattr(instance, 'quit') and isinstance(instance.quit, collections.Callable):
                instance.quit()

        self.clear_instances([instance for instance in self.instances if instance.is_external])
319259
def drop(self):
        
        import os

        if self.path:
            if os.path.exists(self.path):
                os.remove(self.path)
        else:
            # Clear the in-memory data if there is no file path
            self._data = {}