@type  pathname: str
        @param pathname: Pathname to a module.

        @rtype:  str
        @return: Module name.
962906
def __filename_to_modname(self, pathname):
        
        filename = PathOperations.pathname_to_filename(pathname)
        if filename:
            filename = filename.lower()
            filepart, extpart = PathOperations.split_extension(filename)
            if filepart and extpart:
                modName = filepart
            else:
                modName = filename
        else:
            modName = pathname
        return modName
1359628
def expandPath (pathname, prefix=None):
    
    if prefix is None:
        prefix = ''

    expanded = pathname

    if pathname[0] == '~':
        expanded = os.path.expanduser(pathname)
    elif pathname[0] != '/':
        expanded = os.path.join(prefix, pathname)

    return os.path.abspath(expanded)
19504
def basename(path: Optional[str]) -> Optional[str]:
    
    if path is not None:
        return os.path.basename(path)
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));
  }
}
548796
def get_modules(modulename=None):
    
    modulename = compat.ensure_not_unicode(modulename)
    if not modulename:
        try:
            return ([modname for (importer, modname, ispkg)
                     in iter_modules()
                     if not modname.startswith("_")] +
                    list(sys.builtin_module_names))
        except OSError:
            # Bug in Python 2.6, see #275
            return list(sys.builtin_module_names)
    try:
        module = safeimport(modulename)
    except ErrorDuringImport:
        return []
    if module is None:
        return []
    if hasattr(module, "__path__"):
        return [modname for (importer, modname, ispkg)
                in iter_modules(module.__path__)
                if not modname.startswith("_")]
    return []
1227149
def _plugin_name(self, path):
        ""
        base = os.path.basename(path)
        name, ext = os.path.splitext(base)
        return name
712483
def _get_package_name(module):
    
    try:
        # if __package__ is defined, use it
        package_name = module.__package__
    except AttributeError:
        package_name = None  
        
    if package_name is None:
        # if __path__ is defined, the package name is the module name
        package_name = module.__name__
        if not hasattr(module, '__path__'):
            # if __path__ is not defined, the package name is the
            # string before the last "." of the fully-qualified module name
            package_name = package_name.rpartition('.')[0]
           
    return package_name
129536
private static String normalize( String pathName )
    {
        // replaces multiple '/' by one unique '/'
        pathName = pathName.replaceAll( "/+", "/" );

        // removes a '/' if it finishes a path and is not root
        pathName = pathName.replaceAll( "(.+)/$", "$1" );

        if ( !pathName.startsWith( "/" ) ) {
            pathName = "/" + pathName;
        }
        return pathName;
    }
1095047
def filename_from_path(path):
    
    head, tail = ntpath.split(path)
    return head, tail or ntpath.basename(head)
586152
def pathname(self):
        
        slug = self.name
        slug = unidecode.unidecode(slug)
        slug = slug.replace("-", "")
        slug = re.sub(r"[^\w\.]+", "-", slug).strip("-")
        return os.path.join(*slug.split("."))
1003952
def dirname(path: Optional[str]) -> Optional[str]:
    
    if path is not None:
        return os.path.dirname(path)
41631
def _get_codename(self, pathname, basename):
        
        def _compile(file, optimize=-1):
            import py_compile
            if self.debug:
                print("Compiling", file)
            try:
                py_compile.compile(file, doraise=True, optimize=optimize)
            except py_compile.PyCompileError as err:
                print(err.msg)
                return False
            return True

        file_py = pathname + ".py"
        file_pyc = pathname + ".pyc"
        pycache_opt0 = importlib.util.cache_from_source(
            file_py, optimization='')
        pycache_opt1 = importlib.util.cache_from_source(
            file_py, optimization=1)
        pycache_opt2 = importlib.util.cache_from_source(
            file_py, optimization=2)
        if self._optimize == -1:
            # legacy mode: use whatever file is present
            if (os.path.isfile(file_pyc) and
                    os.stat(file_pyc).st_mtime >= os.stat(file_py).st_mtime):
                # Use .pyc file.
                arcname = fname = file_pyc
            elif (os.path.isfile(pycache_opt0) and
                  os.stat(pycache_opt0).st_mtime >= os.stat(file_py).st_mtime):
                # Use the __pycache__/*.pyc file, but write it to the legacy pyc
                # file name in the archive.
                fname = pycache_opt0
                arcname = file_pyc
            elif (os.path.isfile(pycache_opt1) and
                  os.stat(pycache_opt1).st_mtime >= os.stat(file_py).st_mtime):
                # Use the __pycache__/*.pyc file, but write it to the legacy pyc
                # file name in the archive.
                fname = pycache_opt1
                arcname = file_pyc
            elif (os.path.isfile(pycache_opt2) and
                  os.stat(pycache_opt2).st_mtime >= os.stat(file_py).st_mtime):
                # Use the __pycache__/*.pyc file, but write it to the legacy pyc
                # file name in the archive.
                fname = pycache_opt2
                arcname = file_pyc
            else:
                # Compile py into PEP 3147 pyc file.
                if _compile(file_py):
                    if sys.flags.optimize == 0:
                        fname = pycache_opt0
                    elif sys.flags.optimize == 1:
                        fname = pycache_opt1
                    else:
                        fname = pycache_opt2
                    arcname = file_pyc
                else:
                    fname = arcname = file_py
        else:
            # new mode: use given optimization level
            if self._optimize == 0:
                fname = pycache_opt0
                arcname = file_pyc
            else:
                arcname = file_pyc
                if self._optimize == 1:
                    fname = pycache_opt1
                elif self._optimize == 2:
                    fname = pycache_opt2
                else:
                    msg = "invalid value for 'optimize': {!r}".format(
                        self._optimize)
                    raise ValueError(msg)
            if not (os.path.isfile(fname) and
                    os.stat(fname).st_mtime >= os.stat(file_py).st_mtime):
                if not _compile(file_py, optimize=self._optimize):
                    fname = arcname = file_py
        archivename = os.path.split(arcname)[1]
        if basename:
            archivename = "%s/%s" % (basename, archivename)
        return (fname, archivename)
1068942
@Requires("pathName != null")
  @Ensures("result != null")
  public static String getRelativeName(String pathName) {
    int lastSep = pathName.lastIndexOf('.');
    if (lastSep == -1) {
      return pathName;
    } else {
      return pathName.substring(lastSep + 1);
    }
  }
1209836
def name(self):
        """"""
        if self.path:
            # follow h5py convention: add leading slash
            name = self.path
            if name[0] != '/':
                name = '/' + name
            return name
        return None
1296111
def _get_path(fname: str) -> str:
    
    path = get_corpus_path(fname)
    if not path:
        download(fname)
        path = get_corpus_path(fname)
    return path
909366
function getName () {
    const pathname = url.parse(parts[parts.length - 1]).pathname;

    return pathname ? pathname.replace('/', '') : pathname;
  }
893172
def _get_module_name(module):
    
    name = module.__name__[:-6] if module.__name__.endswith('Module') else module.__name__
    return name.lower()