Aggressively cleans up things that look empty.
345790
def _recursive_cleanup(foo):
    
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]
435392
function cleanup(a) {
      return _.filter(a, function (a) {
        var field = a[0];
        return attr[field];
      });
    }
257387
static function cleanup()
    {
        $handlers = eZExecution::cleanupHandlers();
        foreach ( $handlers as $handler )
        {
            if ( is_callable( $handler ) )
                call_user_func( $handler );
            else
                eZDebug::writeError('Could not call cleanup handler, is it a static public function?', __METHOD__ );
        }
    }
1306978
def cleanup():
    """"""
    lib_dir = os.path.join(os.environ['CONTAINER_DIR'], '_lib')
    if os.path.exists(lib_dir):
        shutil.rmtree(lib_dir)
    os.mkdir(lib_dir)
1321095
function clean (callback) {
  if (this._clobber) {
    rimraf(path.join(destination, this._clobberGlob), callback);
  }
  else {
    callback(null);
  }
}
747576
public function cleanup(): void
    {
        foreach ($this->getStore() as $key => $value)
        {
            $this->remove($key);
        }
    }
592042
protected function cleanup()
    {
        // if $this->fs is an object, the Filesystem has been used, clean it up.
        if (is_object($this->fs)) {
            if ($this->fs->isDirectory($this->tempPath)) {
                $this->fs->deleteDirectory($this->tempPath, false);
            }
        }
    }
467423
function clean(args) {
	return Array.prototype.filter.call(args, v => v !== INVALIDATE);
}
912940
function cleanup (dirs) {
  return function (mode, pass, callback) {
    var done = after(dirs.length, callback)

    dirs.forEach(function (dir) {
      rimraf(dir, done)
    })
  }
}
803836
function cleanup () {
    if (!ctrl.hidden) {
      $mdUtil.enableScrolling();
    }

    angular.element($window).off('resize', debouncedOnResize);

    if (elements){
      var items = ['ul', 'scroller', 'scrollContainer', 'input'];
      angular.forEach(items, function(key){
        elements.$[key].remove();
      });
    }
  }
1093599
public function clean()
    {
        $this->canvas = [];

        for($y=0; $y < $this->height; $y++) {
            array_push($this->canvas, []);

            for($x=0; $x < $this->width; $x++) {
                $this->canvas[$y][$x] = $this->bgcolor;
            }
        }
    }
1155820
public void cleanup() {
        List<String> keys = new ArrayList<>(created.keySet());
        keys.sort(String::compareTo);
        for (String key : keys) {
            created.remove(key)
                .stream()
                .sorted(Comparator.comparing(HasMetadata::getKind))
                .forEach(metadata -> {
                    log.info(String.format("Deleting %s : %s", key, metadata.getKind()));
                    deleteWithRetries(metadata);
                });
        }
    }
1183616
private void clean(Instances cleanAgainst, Instances toClean, boolean onlyLast) {
		if (cleanAgainst.numInstances() > this.kOption.getValue() && toClean.numInstances() > 0){
			if (onlyLast){
				cleanSingle(cleanAgainst, (cleanAgainst.numInstances()-1), toClean);
			}else{
				for (int i=0; i < cleanAgainst.numInstances(); i++){
					cleanSingle(cleanAgainst, i, toClean);
				}
			}
		}
	}
673385
public function cleanup()
    {
        // unlock everything
        foreach ($this->locks as $lock) {
            flock($lock, LOCK_UN);
            fclose($lock);
        }

        $this->locks = [];
    }
1204059
public function cleanUp()
    {
        $this->filesystem->remove($this->compressedArchivePath);
        $this->filesystem->remove($this->outputPath);
    }
242292
def clean_up(self):
        """"""
        self.action_buffer = []
        self.sources = {}
        self.doc_to_get = {}
        self.doc_to_update = []
622488
function cleanup(cleanups, start = 0) {
    for(let i = start; i < cleanups.length; ++i) {
        const res = cleanups[i]();
        if(res && res.then)
            return res.then(() => cleanup(cleanups, i+1));
    }
}