Returns the final component of a pathname and None if the argument is None
19504
def basename(path: Optional[str]) -> Optional[str]:
    
    if path is not None:
        return os.path.basename(path)
931081
def _get_path_by_name(part, paths):
    
    for path in paths:
        if path.alias == part:
            return path
    raise ValueError
1036897
function (sName) {
			var iIndex = sName.indexOf("/");

			if (iIndex >= 0) {
				// consider only the first path segment
				sName = sName.slice(0, iIndex);
			}
			// now we have a qualified name, drop the last segment (the name)
			iIndex = sName.lastIndexOf(".");

			return iIndex < 0 ? "" : sName.slice(0, iIndex);
		}
178520
def file_name_without_extension(path):
    
    if path is None:
        return None
    return os.path.splitext(os.path.basename(path))[0]
1029408
function get_path(context, path) {
	var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

	var node = get_node_by_path(context, path, options);
	return node_type(node) == NodeTypes.NODE ? get_all_node_props(context, node, options) : node;
}
1346676
function getNameFromPath (path) {
  path = _(path).toString();
  let lastSlash = path.substring(0, path.length - 1).lastIndexOf("/");
  if (lastSlash === -1) {
    return normalizeName(path);
  }
  else {
    return normalizeName(path.substring(lastSlash));
  }
}
892708
def path_components(path):
    """"""

    def yield_components(path):
        # Iterate over each character and the next character
        chars = zip_longest(path, path[1:])
        try:
            # Iterate over components
            while True:
                c, n = next(chars)
                if c != '/':
                    raise ValueError("Invalid path, expected \"/\"")
                elif (n is not None and n != "'"):
                    raise ValueError("Invalid path, expected \"'\"")
                else:
                    # Consume "'" or raise StopIteration if at the end
                    next(chars)
                component = []
                # Iterate over characters in component name
                while True:
                    c, n = next(chars)
                    if c == "'" and n == "'":
                        component += "'"
                        # Consume second "'"
                        next(chars)
                    elif c == "'":
                        yield "".join(component)
                        break
                    else:
                        component += c
        except StopIteration:
            return

    return list(yield_components(path))
192158
function getPathDirectory(length, parts) {
  if (!parts) {
    return '';
  }
  return parts
    .slice(length)
    .filter(part => part !== '')
    .join(path.sep);
}
730838
def get_path(self, dir=None):
        """"""
        if not dir:
            dir = self.fs.getcwd()
        if self == dir:
            return '.'
        path_elems = self.get_path_elements()
        pathname = ''
        try: i = path_elems.index(dir)
        except ValueError:
            for p in path_elems[:-1]:
                pathname += p.dirname
        else:
            for p in path_elems[i+1:-1]:
                pathname += p.dirname
        return pathname + path_elems[-1].name
981684
def path(self):
        
        return "/".join([
            part
            for part in [
                self.version,
                self.qualifier,
            ]
            if part
        ])
165650
def get_path_components(directory):
    
    drive, dirs = os.path.splitdrive(directory)
    folders = []
    previous = ""
    while dirs != previous and dirs != "":
        previous = dirs
        dirs, folder = os.path.split(dirs)
        if folder != "":
            folders.append(folder)
    folders.reverse()
    return drive, folders
1109634
def get_command(self, *path):
        """"""
        path_str = ':'.join(path)

        if path_str in self.commands:
            return self.commands[path_str].load()

        return None
279930
function getNamespace (path, relative) {
  // ignore parent path
  let final = ''
  if (relative) {
    const s = path.split('/')
    final = s[s.length - 1]
  } else {
    final = path.startsWith('./') ? path.slice(2) : path
  }
  // remove '.js'
  return final.slice(0, final.length - 3)
}
494877
def split_none(self):
        ""
        val = self[[]]
        val.ignore_empty = True
        return self._split(self.path, self, val)
799699
def _get_component(filename, default="global"):
    """"""
    if hasattr(filename, "decode"):
        filename = filename.decode()
    parts = filename.split(os.path.sep)

    if len(parts) >= 3:
        if parts[1] in "modules legacy ext".split():
            return parts[2]
    if len(parts) >= 2:
        if parts[1] in "base celery utils".split():
            return parts[1]
    if len(parts) >= 1:
        if parts[0] in "grunt docs".split():
            return parts[0]
    return default
356916
function getPathVariableName() {
    // windows calls it's path 'Path' usually, but this is not guaranteed.
    if (process.platform === 'win32') {
        for (const key of Object.keys(process.env))
            if (key.match(/^PATH$/i))
                return key;
        return 'Path';
    }
    return "PATH";
}
1117283
def GetValueByPath(self, path_segments):
    
    key = self.root_key
    for path_segment in path_segments:
      if isinstance(key, dict):
        try:
          key = key[path_segment]
        except KeyError:
          return None

      elif isinstance(key, list):
        try:
          list_index = int(path_segment, 10)
        except ValueError:
          return None

        key = key[list_index]

      else:
        return None

      if not key:
        return None

    return key