猜测文件类型, 根据它的文件扩展名
541763
def get_mime(self, path, isdir):
        ''''''
        if isdir:
            file_type = FOLDER
        else:
            file_type = mimetypes.guess_type(path)[0]
            if not file_type:
                file_type = UNKNOWN
        return file_type
1171058
static String parseAttachmentFilename(Header header) throws UnsupportedEncodingException {
    if (header == null) {
      return null;
    }
    String value = header.getValue();
    String filenameWild = "filename*";
    int filenameWildIndex = value.indexOf(filenameWild);
    if (filenameWildIndex != -1) {
      int lastIndex = value.indexOf(';', filenameWildIndex);
      String substring;
      if (lastIndex == -1) {
        substring = value.substring(filenameWildIndex + filenameWild.length() + 1);
      } else {
        substring = value.substring(filenameWildIndex + filenameWild.length() + 1, lastIndex);
      }
      String[] ary = substring.split("''");
      return URLDecoder.decode(ary[1], ary[0]);
    }
    String filename = "filename";
    int filenameIndex = value.indexOf(filename);
    if (filenameIndex != -1) {
      int lastIndex = value.indexOf(';', filenameIndex);
      String substring;
      // 处理filename=文件名，不包含双引号的情况
      int offset = 2;
      if (value.substring(filenameIndex + filename.length() + 1).charAt(0) != '\"') {
        offset = 1;
      }
      if (lastIndex == -1) {
        substring = value.substring(filenameIndex + filename.length() + offset);
      } else {
        substring = value
            .substring(filenameIndex + filename.length() + offset, offset == 2 ? lastIndex - 1 : lastIndex);
      }
      return URLDecoder.decode(substring, "UTF-8");
    }
    throw new IllegalStateException("不合法的附件头信息" + header.getName() + ": " + header.getValue());
  }
725040
def metafilename(self):
        """"""
        metafilename = os.path.dirname(self.filename)
        if metafilename: metafilename += '/'
        metafilename += '.' + os.path.basename(self.filename) + '.METADATA'
        return metafilename
295589
public static String extName(String fileName) {
		if (fileName == null) {
			return null;
		}
		int index = fileName.lastIndexOf(StrUtil.DOT);
		if (index == -1) {
			return StrUtil.EMPTY;
		} else {
			String ext = fileName.substring(index + 1);
			// 扩展名中不能包含路径相关的符号
			return StrUtil.containsAny(ext, UNIX_SEPARATOR, WINDOWS_SEPARATOR) ? StrUtil.EMPTY : ext;
		}
	}
783685
def _read_file(name, encoding='utf-8') -> str:
    
    with open(name, encoding=encoding) as f:
        return f.read()
239143
public static String getName(String fileName){
        int dot = fileName.lastIndexOf('.');
        return dot==-1 ? fileName : fileName.substring(0, dot);
    }
676821
protected String processFileName(String name) {

        int pos = name.lastIndexOf("/");
        if (pos >= 0) {
            name = name.substring(pos + 1);
        }
        pos = name.lastIndexOf("\\");
        if (pos >= 0) {
            name = name.substring(pos + 1);
        }
        return name;
    }
918391
def filename(self, value):
        """"""
        warnings.warn(
            "The 'filename' attribute will be removed in future versions.  "
            "Use 'source' instead.",
            DeprecationWarning, stacklevel=2
        )
        self.source = value
1167840
def read_file(filename):
    
    if os.path.isfile(filename):
        with open(filename, 'r') as f:
            return f.read()
611352
def filename(self):
        """"""
        if self.value and 'value' in self._json_data and self._json_data['value']:
            return self._json_data['value'].split('/')[-1]
        return None
484811
function getFileNames(path, extension)
{
    var docPath = __dirname + '/' + path;
    var fileNames = [];
    var findPattern = new RegExp("." + extension + "$");
    var replacePattern = new RegExp("." + extension + "$","g");
    fs.readdirSync( docPath ).forEach( function(fileName ) {
        if( fileName.match( findPattern ) ) {
            fileNames.push( fileName.replace( replacePattern, "" ) );
        }
    });

    verbose && console.log('Read "' + extension + '" files from ' + docPath );

    return fileNames;
}
343057
function basename(file){
    var extname = path.extname(file);
    return path.basename(file, extname);
}
373601
def read_file(filename, prepend_paths=[]):
  
  if prepend_paths is True:
    prepend_paths = [
      os.path.abspath(os.path.dirname(__file__)),
    ]
  if prepend_paths:
    prepend_paths.append(filename)
    filename = os.path.join(*prepend_paths)
  print(filename)
  with open(filename, encoding='utf-8') as f:
    return f.read()
1019835
def filename(self):
        
        if self._filename:
            return self._filename
        else:
            with tempfile.NamedTemporaryFile(delete=False) as f:
                f.write(self._bytes)
            return f.name
1257067
function getExtensionlessFilename( filename ) {
	return filename.substr( 0, filename.length - path.extname( filename ).length);
}
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()))
406007
def get_filenames(directory):
    """"""
    for filename in os.listdir(directory):
        if re.search(r"cp\d{2}mu?-manylinux1_\S+\.whl", filename):
            yield filename