Return the rootname of the given file.
543855
def findrootname(filename):
    

    puncloc = [filename.find(char) for char in string.punctuation]
    if sys.version_info[0] >= 3:
        val = sys.maxsize
    else:
        val = sys.maxint
    for num in puncloc:
        if num !=-1 and num < val:
            val = num
    return filename[0:val]
934402
def getFilename(name):
    """"""
    # first replace all illegal chars
    name = re.sub(r"[^0-9a-zA-Z_\-\.]", "_", name)
    # then remove double dots and underscores
    while ".." in name:
        name = name.replace('..', '.')
    while "__" in name:
        name = name.replace('__', '_')
    # remove a leading dot or minus
    if name.startswith((".", "-")):
        name = name[1:]
    return name
265455
def basename(self, suffix=''):
		''' '''
		return os.path.basename(self._file, suffix) if self._file else None
1179533
def extract_filename(self):
    """"""
    globals_gdbval = self._gdbval['f_globals'].cast(GdbCache.DICT)
    global_dict = libpython.PyDictObjectPtr(globals_gdbval)
    for key, value in global_dict.iteritems():
      if str(key.proxyval(set())) == '__file__':
        return str(value.proxyval(set()))
247502
public static String extName(File file) {
		if (null == file) {
			return null;
		}
		if (file.isDirectory()) {
			return null;
		}
		return extName(file.getName());
	}
1095047
def filename_from_path(path):
    
    head, tail = ntpath.split(path)
    return head, tail or ntpath.basename(head)
1125702
private static String basename(final File file) {
        final String name = file.getName();
        if(name.contains(".")) {
            return name.substring(0, name.lastIndexOf("."));
        }
        return name;
    }
1071086
def read_file_in_root_directory(*names, **kwargs):
    """"""
    return read_file(
        os.path.join(os.path.dirname(__file__), *names),
        encoding=kwargs.get("encoding", "utf-8"),
    )
507308
def parse(self, file_name):
        
        root = ET.parse(file_name).getroot()
        return self._parse(root)
189888
def funname(file):
    """"""
    if isinstance(file, str):
        files = [file]
    else:
        files = file
    bases = [os.path.basename(f) for f in files]
    names = [os.path.splitext(b)[0] for b in bases]
    if isinstance(file, str):
        return names[0]
    else:
        return names
619571
def get_file_name(url):
  """"""
  return os.path.basename(urllib.parse.urlparse(url).path) or 'unknown_name'
915914
def get_filename(self, index):
        """"""
        if index:
            return osp.normpath(to_text_string(self.fsmodel.filePath(index)))
601279
def parseFilename(self, filename):
        """"""
        match = self.filename_regex.match(filename)
        if match is None:
            # TODO?: Raise exception?
            '''print("Filename", filename, "unrecognized!")'''
            return None
        lat = int(match.group(2))
        lon = int(match.group(4))
        if match.group(1) == "S":
            lat = -lat
        if match.group(3) == "W":
            lon = -lon
        return lat, lon
207937
def _get_root_files(self, directory):
        """"""
        if len(self.filepaths) is 0:
            if self.filters:
                root_files = [(directory, f) for f in os.listdir(directory)
                              if os.path.isfile(os.path.join(directory, f))
                              and self.filters.validate(f)
                              and self.filters.get_level(f) == self.filters.max_level]
            else:
                root_files = [(directory, f) for f in os.listdir(directory)
                              if os.path.isfile(os.path.join(directory, f))]
            self.add_path(root_files)
709515
def print_filename(path):
    

    if os.path.basename(path):
        return os.path.basename(path)
    return path
231034
def basename(path, ext=""):
    """"""
    import os.path
    if ext is False:
        return os.path.basename(path).replace(extname(path), "")
    else:
        return os.path.basename(path).replace(ext, "")
935912
function isInRoot(root, filename) {
    filename = path.normalize(filename);
    return (filename.substr(0, root.length) === root);
}