trim off basepath
970979
def _rel_path(self, path, basepath=None):
        
        basepath = basepath or self.src_dir
        return path[len(basepath) + 1:]
838286
def trim(self, positions):
        """"""
        self.command.append("trim")
        for position in positions:
            # TODO: check if the position means something
            self.command.append(position)
        return self
991592
def cleanup(output_root):
    """"""
    if os.path.exists(output_root):
        if os.path.isdir(output_root):
            rmtree(output_root)
        else:
            os.remove(output_root)
537273
function removeTrailingDirectorySeparator(path) {
        if (path.charAt(path.length - 1) === ts.directorySeparator) {
            return path.substr(0, path.length - 1);
        }
        return path;
    }
1057755
function trimTrailingWhitespacesForRemainingRange() {
                var startPosition = previousRange ? previousRange.end : originalRange.pos;
                var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line;
                var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line;
                trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);
            }
1231531
function(path, base)
        {
            base = base ? base + "/" : "/";
            if(
                !hasProtocol(base, base.substr(0, 2))
            ) {
                base = location.origin + base;
            }
            var url = new URL(path, base);
            path = url.origin + url.pathname;
            path = path.replace(location.origin, "");
            // path = new URL(path, base).href.replace(location.origin, "");
            // if it has a trailing slash i.e. a directory, remove the trailing slash
            var len = path.length - 1;
            return path[len] === "/" ? path.substr(0, len) : path;
        }
388118
function removeExtension(file) {
  let parts = path.parse(file);
  delete parts.ext;
  delete parts.base;
  return path.format(parts);
}
79778
function eraseFromPath(obj, path){
		var parts = path.split('.'),
			clone = obj;
		
		for(var i = 0, l = parts.length; i < l; i++){
			if (!obj.hasOwnProperty(parts[i])){
				break;
			
			} else if (i < l - 1){
				obj = obj[parts[i]];
				
			} else if(i == l - 1){
				delete obj[parts[i]];
				break;
			}
		}
		
		return clone;
	}
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
29756
protected function trimBasePath($path)
    {
        $base_path = $this->getConfig('base_path');

        if (!$base_path || $base_path === '/') {
            return $path;
        }

        if (stripos($path, $base_path) !== 0) {
            throw \Owl\Http\Exception::factory(404);
        }

        return '/' . substr($path, strlen($base_path));
    }
907564
private void removePath( Collection<InternalWorkingMemory> wms, RuleRemovalContext context, Map<Integer, BaseNode> stillInUse, Collection<ObjectSource> alphas, PathEndNode endNode ) {
        LeftTupleNode[] nodes = endNode.getPathNodes();
        for (int i = endNode.getPositionInPath(); i >= 0; i--) {
            BaseNode node = (BaseNode) nodes[i];

            boolean removed = false;
            if ( NodeTypeEnums.isLeftTupleNode( node ) ) {
                removed = removeLeftTupleNode(wms, context, stillInUse, node);
            }

            if ( removed ) {
                // reteoo requires to call remove on the OTN for tuples cleanup
                if (NodeTypeEnums.isBetaNode(node) && !((BetaNode) node).isRightInputIsRiaNode()) {
                    alphas.add(((BetaNode) node).getRightInput());
                } else if (node.getType() == NodeTypeEnums.LeftInputAdapterNode) {
                    alphas.add(((LeftInputAdapterNode) node).getObjectSource());
                }
            }

            if (NodeTypeEnums.isBetaNode(node) && ((BetaNode) node).isRightInputIsRiaNode()) {
                endNode = (PathEndNode) ((BetaNode) node).getRightInput();
                removePath(wms, context, stillInUse, alphas, endNode);
                return;
            }
        }
    }
699022
def _pruned(self, path):
    """"""
    if path[0] == '/':
      path = path[1:]
    for rule in reversed(self.pruneRules):
      if isinstance(rule, six.string_types):
        if fnmatch(path, rule):
          return True
      elif rule(path):
        return True
    return False
673205
private String getBasePath(String path1, String path2) {

        StringBuffer base = new StringBuffer();
        path1 = path1.replace('\\', '/');
        path2 = path2.replace('\\', '/');

        String[] parts1 = path1.split("/");
        String[] parts2 = path2.split("/");

        for (int i = 0; i < parts1.length; i++) {
            if (i >= parts2.length) {
                break;
            }
            if (parts1[i].equals(parts2[i])) {
                base.append(parts1[i] + "/");
            }
        }

        return base.toString();
    }
399733
function (path, ext) {
            var result = path.match(splitPathRe) || [],
                basename;
            basename = result[3] || '';
            if (ext && basename && basename.slice(-1 * ext.length) == ext) {
                basename = basename.slice(0, -1 * ext.length);
            }
            return basename;
        }
445991
function removeExtension(path) {
  let leadingDot, endSlash = path.lastIndexOf('/');

  if (endSlash > -1) {
    leadingDot = path.indexOf('.', endSlash);
  } else {
    leadingDot = path.indexOf('.');
  }

  if (leadingDot > -1) {
    path = path.substr(0, leadingDot);
  }
  return path;
}
527417
function removeCommonPrefix(basedir, filedir) {
  var baseparts = basedir.split(path.sep);
  var fileparts = filedir.split(path.sep);

  var i = 0;
  while (i < fileparts.length && fileparts[i] === baseparts[i]) {
    i++;
  }
  return fileparts.slice(i).join(path.sep);
}
707825
public static function removeBasepath($uri, $path)
    {
        $uri = self::normalizePath(self::filterUri($uri));
        $basepath = (new HierarchicalPath($path))->withLeadingSlash();
        if ('/' === (string) $basepath) {
            return $uri;
        }

        $currentpath = $uri->getPath();
        if (0 !== strpos($currentpath, (string) $basepath)) {
            return $uri;
        }

        return $uri->withPath(
            (string) (new HierarchicalPath($currentpath))->withoutSegment(...range(0, count($basepath) - 1))
        );
    }