Cleanup rebus instance.
163480
function close() {
    if (watcher && !closed) {
      if (options.persistent) {
        // Close handle only if watcher was created persistent.
        watcher.close();
      }
      else {
        // Stop handling change events.
        watcher.removeAllListeners();
        // Leave watcher on error events that may come from unclosed handle.
        watcher.on('error', function (err) { });
      }
      closed = true;
    }
  }
790177
def cleanup(connector_manager, red_data, tmp_dir):
    
    for key, arg in red_data['inputs'].items():
        val = arg

        if isinstance(arg, list):
            for index, i in enumerate(arg):
                if not isinstance(i, dict):
                    continue

                # connector_class should be one of 'File' or 'Directory'
                connector_class = i['class']
                input_key = '{}_{}'.format(key, index)
                path = os.path.join(tmp_dir, input_key)
                connector_data = i['connector']
                internal = {URL_SCHEME_IDENTIFIER: path}

                if connector_class == 'File':
                    connector_manager.receive_cleanup(connector_data, input_key, internal)
                elif connector_class == 'Directory':
                    connector_manager.receive_directory_cleanup(connector_data, input_key, internal)

        elif isinstance(arg, dict):
            # connector_class should be one of 'File' or 'Directory'
            connector_class = arg['class']
            input_key = key
            path = os.path.join(tmp_dir, input_key)
            connector_data = val['connector']
            internal = {URL_SCHEME_IDENTIFIER: path}

            if connector_class == 'File':
                connector_manager.receive_cleanup(connector_data, input_key, internal)
            elif connector_class == 'Directory':
                connector_manager.receive_directory_cleanup(connector_data, input_key, internal)

    try:
        os.rmdir(tmp_dir)
    except (OSError, FileNotFoundError):
        # Maybe, raise a warning here, because not all connectors have cleaned up their contents correctly.
        pass
558849
def _cleanup_resources(self, initialized_resources):
        """"""

        cleanup_errors = []

        # Make sure we clean up all resources that we can and don't error out at the
        # first one.
        for name, res in initialized_resources.items():
            try:
                if res.opened:
                    res.close()
            except Exception:
                _type, value, traceback = sys.exc_info()
                cleanup_errors.append((name, value, traceback))

        if len(cleanup_errors) > 0:
            raise RecipeResourceManagementError(operation="resource cleanup", errors=cleanup_errors)
325388
public function cleanup()
    {
        $this->cleaned = true;
        $this->remoteMethods = [];
        $this->localMethods = [];
        $this->persistentCallbacks = [];
        $this->callbacks = [];
    }
1212182
def cleanup_storage(*args):
    """"""
    ShardedClusters().cleanup()
    ReplicaSets().cleanup()
    Servers().cleanup()
    sys.exit(0)
635252
def cleanup(self):
        """"""
        for path in self.paths:
            if isinstance(path, tuple):
                os.close(path[0])
                os.unlink(path[1])
            else:
                shutil.rmtree(path)
        self.paths = []
1165946
public void cleanUp() {
    if (outSocket != null) {
      try {
        outSocket.close();
      } catch (Exception e) {
        LogLog.error("Could not close outSocket.", e);
      }

      outSocket = null;
    }
  }
805656
def cleanup(self):
        
        if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
            if os.path.exists(self.path):
                try:
                    rmtree(self.path)
                except OSError:
                    pass
                else:
                    self.path = None
284995
def _clean(self):
        """"""
        if self._workers:
            for url in self._workers.copy():
                w = self._workers[url]
                if w.is_finished():
                    self._workers.pop(url)
                    self._paths.pop(url)
                    if url in self._get_requests:
                        self._get_requests.pop(url)

        else:
            self._timer.stop()
1142653
def _cleanup(self):
        '''
        
        '''
        self._pending_consumers = None
        self._consumer_cb = None
        self._get_cb = None
        self._recover_cb = None
        self._cancel_cb = None
        self._return_listener = None
        super(BasicClass, self)._cleanup()
459893
public void cleanup(boolean reuse, boolean wasInsert)
    {
        if(currentImage != null)
        {
            performImageCleanup(currentImage, reuse);
        }
        if(beforeImage != null)
        {
            // we always free all resources of the old image
            performImageCleanup(beforeImage, false);
        }
        if(reuse)
        {
            refreshObjectImage(wasInsert);
        }
        else
        {
            myObj = null;
        }
    }
1080741
def cleanup(self):
        """"""
        self.parser = None
        self.request = None
        self.url = None
        self.headers = None
        self._request_handler_task = None
        self._request_stream_task = None
        self._total_request_size = 0
        self._is_stream_handler = False
788195
public void cleanUp() {
	int nI;
	for (nI = 0; nI < PBOX_ENTRIES; nI++)
	    m_pbox[nI] = 0;
	for (nI = 0; nI < SBOX_ENTRIES; nI++)
	    m_sbox1[nI] = m_sbox2[nI] = m_sbox3[nI] = m_sbox4[nI] = 0;
    }
1283855
def _cleanup(self):
        
        self.device = None
        self.doc = None
        self.parser = None
        self.resmgr = None
        self.interpreter = None
171222
public void cleanup() {
        synchronized (_sslMap) {
            for (SslRelayOdo relay : _sslMap.values()) {
                if (relay.getHttpServer() != null && relay.isStarted()) {
                    relay.getHttpServer().removeListener(relay);
                }
            }

            sslRelays.clear();
        }
    }
182661
def _cleanup(path: str) -> None:
    """"""
    if os.path.isdir(path):
        shutil.rmtree(path)
378178
def clean_jobs(self, recursive=False):
        """"""
        self._interface.clean_jobs(self.scatter_link,
                                   clean_all=recursive)