Checks file name to see if parse should be attempted

Default implementation returns false for files with extensions '.dll',
'tlb', '.res'
487794
protected boolean canParse(final File sourceFile) {
    final String sourceName = sourceFile.toString();
    final int lastPeriod = sourceName.lastIndexOf('.');
    if (lastPeriod >= 0 && lastPeriod == sourceName.length() - 4) {
      final String ext = sourceName.substring(lastPeriod).toUpperCase();
      if (ext.equals(".DLL") || ext.equals(".TLB") || ext.equals(".RES")) {
        return false;
      }
    }
    return true;
  }
1336859
function check(filename) {
  this.filename = filename && path.resolve(filename) || '';
  this.types = [];
  this.valid = null;
}
83896
def plugin_valid(self, filename):
        
        filename = os.path.basename(filename)
        for regex in self.regex_expressions:
            if regex.match(filename):
                return True
        return False
317520
private void parseFilename() {

    // Add additional filtering to discard empty files, or files ending in .crc
    if ((filename != null) && (filename.length() > 0)
        && (!filename.endsWith(".crc"))) {

      Matcher matcher = PATTERN.matcher(filename);

      if (matcher.matches()) {
    	//  jobTracker = "";
    	  jobid = matcher.group(1);
    	  Matcher confMatcher = CONF_PATTERN.matcher(filename);
    	  if (confMatcher.matches()) {
        	isJobConfFile = true;
        	LOG.debug("Job Conf file  " + filename + " with job id: " + jobid);
        	} else {
        		isJobHistoryFile = true;
        		LOG.debug("Job History file " + filename + " with job id: " + jobid);
        		}
    	  }
      else {
          LOG.info(" file does not match any format: " + filename);
      }
    }
  }
1200095
async function baseInclude(filename) {
	let f = new Functmpl(this);
	try {
		await f.loadFile(filename);
		return this.echo((await f.parse(_scope2.default)));
	} catch (e) {}
}
985835
function checkForMissingFilesAndFixFilenameCase() {
  // Get filenames from toc.yaml.
  const filenames = tocText
    .split('\n')
    .filter(line => line.includes('path:'))
    .map(line => line.split(devsitePath)[1]);
  // Logs warning to console if a file from TOC is not found.
  const fileCheckPromises = filenames.map(filename => {
    // Warns if file does not exist, fixes filename case if it does.
    // Preferred filename for devsite should be capitalized and taken from
    // toc.yaml.
    const tocFilePath = `${docPath}/${filename}.html`;
    // Generated filename from Typedoc will be lowercase.
    const generatedFilePath = `${docPath}/${filename.toLowerCase()}.html`;
    return fs.exists(generatedFilePath).then(exists => {
      if (exists) {
        // Store in a lookup table for link fixing.
        lowerToUpperLookup[
          `${filename.toLowerCase()}.html`
        ] = `${filename}.html`;
        return fs.rename(generatedFilePath, tocFilePath);
      } else {
        console.warn(
          `Missing file: ${filename}.html requested ` +
            `in toc.yaml but not found in ${docPath}`
        );
      }
    });
  });
  return Promise.all(fileCheckPromises).then(() => filenames);
}
1215100
def which(filename, interactive=False, verbose=False):
    
    exe = [e.lower() for e in os.environ.get('PATHEXT', '').split(';')]
    if sys.platform != 'win32':  # pragma: nocover
        exe.append('')

    name, ext = os.path.splitext(filename)
    has_extension = bool(ext)
    if has_extension and ext.lower() not in exe:
        raise ValueError("which can only search for executable files")

    def match(filenames):
        """Returns the sorted subset of ``filenames`` that matches ``filename``.
        """
        res = set()
        for fname in filenames:
            if fname == filename:  # pragma: nocover
                res.add(fname)  # exact match
                continue
            fname_name, fname_ext = os.path.splitext(fname)
            if fname_name == name and fname_ext.lower() in exe: # pragma: nocover
                res.add(fname)
        return sorted(res)

    returnset = set()
    found = False
    for pth in get_path_directories():
        if verbose:  # pragma: nocover
            print('checking pth..')

        fnames = _listdir(pth, exe)
        if not fnames:
            continue

        for m in match(fnames):
            found_file = _normalize(os.path.join(pth, m))
            if found_file not in returnset:  # pragma: nocover
                if is_executable(found_file):
                    yield found_file
                returnset.add(found_file)
        found = True

    if not found and interactive:  # pragma: nocover
        print("Couldn't find %r anywhere on the path.." % filename)
        sys.exit(1)
1151385
def check_rst(code, ignore):
    """"""
    filename = '<string>'

    for result in check(code,
                        filename=filename,
                        ignore=ignore):
        yield result
440887
@Override
    public boolean matches(Source src) {
        String name = src.getOrigin().getName().toLowerCase();
        String[] extensions = getInputFileExtensions();
        if (extensions.length == 1) {
            return FilenameUtils.isExtension(name, extensions[0]);
        }

        return FilenameUtils.isExtension(name, extensions);
    }
289068
function isDataURI(filename) {
  return String.prototype.startsWith ?
      filename.startsWith(dataURIPrefix) :
      filename.indexOf(dataURIPrefix) === 0;
}
1357072
def _CheckParserCanProcessFileEntry(self, parser, file_entry):
    
    for filter_object in parser.FILTERS:
      if filter_object.Match(file_entry):
        return True

    return False
248791
private static boolean checkLib(final File f, String basename) {
        boolean fExists = System.getSecurityManager() == null ? f.exists() : AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
            @Override
            public Boolean run() {
                return f.exists();
            }
        });
        return fExists &&
               (f.getName().equals(basename) || (isWindows(basename) && f.getName().equalsIgnoreCase(basename)));
    }
939399
private synchronized void checkFileName(String fileName) throws ParameterException{
		Validate.notNull(fileName);
		File cFile = new File(fileName);
		if(cFile.getName().length()==0)
			throw new ParameterException(ErrorCode.INCOMPATIBILITY, fileName + " is not a valid file-name!");
	}
724830
def _check_file_syntax(filename, temp_dir, override_lang=None, enforce=True):
    
    def check_python(filename):
        # Generate a semi-recognizable name to write the pyc to. Of
        # course it's possible that different files being scanned could
        # have the same basename, so this path won't be unique, but the
        # checks don't run concurrently so this shouldn't cause any
        # problems.
        pyc_path = os.path.join(temp_dir, os.path.basename(filename) + ".pyc")
        try:
            if USING_PYTHON2:
                filename = filename.encode(sys.getfilesystemencoding())
            py_compile.compile(filename, cfile=pyc_path, doraise=True)
        finally:
            try:
                os.unlink(pyc_path)
            except OSError:
                pass
    def check_bash(filename):
        if platform.system() == 'Windows':
            logging.warn(
                    'Skipping bash syntax check due to unavailability of bash on Windows.')
        else:
            subprocess.check_output(["/bin/bash", "-n", filename], stderr=subprocess.STDOUT)

    if override_lang == 'python2.7':
        checker_fn = check_python
    elif override_lang == 'bash':
        checker_fn = check_bash
    elif filename.endswith('.py'):
        checker_fn = check_python
    elif filename.endswith('.sh'):
        checker_fn = check_bash
    else:
        # Ignore other kinds of files.
        return

    # Do a test read of the file to catch errors like the file not
    # existing or not being readable.
    open(filename)

    try:
        checker_fn(filename)
    except subprocess.CalledProcessError as e:
        print(filename + " has a syntax error! Interpreter output:", file=sys.stderr)
        for line in e.output.strip("\n").split("\n"):
            print("  " + line.rstrip("\n"), file=sys.stderr)
        if enforce:
            raise DXSyntaxError(filename + " has a syntax error")
    except py_compile.PyCompileError as e:
        print(filename + " has a syntax error! Interpreter output:", file=sys.stderr)
        print("  " + e.msg.strip(), file=sys.stderr)
        if enforce:
            raise DXSyntaxError(e.msg.strip())
758101
def _check_expr_filename(expr):
    
    expr_lst = expr.split()
    f = [x for x in expr_lst if x not in DATA_FRAMES and x.endswith(".lpd")]
    return f
467251
def is_python_interpreter_valid_name(filename):
    """"""
    pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$'
    if re.match(pattern, filename, flags=re.I) is None:
        return False
    else:
        return True
235378
public static boolean checkFileForPackaging(String fileName) {
        String[] fileSegments = fileName.split("\\.");
        String fileExt = "";
        if (fileSegments.length > 1) {
            fileExt = fileSegments[fileSegments.length-1];
        }

        return checkFileForPackaging(fileName, fileExt);
    }