Check if specified filename can be patched. Returns None if file can
    not be found among source filenames. False if patch can not be applied
    clearly. True otherwise.

    :returns: True, False or None
770980
def can_patch(self, filename):
    
    filename = abspath(filename)
    for p in self.items:
      if filename == abspath(p.source):
        return self._match_file_hunks(filename, p.hunks)
    return None
245392
public function canHtaccessFileBeUpdated()
    {
        try {
            $defaultPathParameters = $this->getDefaultPathParams();
            $defaultPathParameters['sBaseUrlPath'] = $this->extractRewriteBase($defaultPathParameters['sShopURL']);
            $this->updateHtaccessFile($defaultPathParameters);
        } catch (Exception $exception) {
            return false;
        }

        return true;
    }
1374741
def check_filename(filename)
      extension = filename.split('.').last
      return true if valid_extensions.include?(extension)
      false
    end
454092
def is_file_secure(file_name):
	
	if not os.path.isfile(file_name):
		return True
	file_mode = os.stat(file_name).st_mode
	if file_mode & (stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH):
		return False
	return True
172087
def _is_excluded(filename, exclusions):
    """"""
    for exclusion in exclusions:
        if fnmatch(filename, exclusion):
            return True

    return False
832499
def fix_file(self, file_name):
        
        # We hope that a CalledProcessError would have already raised
        # during the init if it were going to raise here.
        modified_lines = self.modified_lines(file_name)

        return fix_file(file_name, modified_lines, self.options,
                        in_place=self.in_place, diff=True,
                        verbose=self.verbose, cwd=self.cwd)
342303
def has_file(self, name: str):
        '''
        
        '''
        return os.path.isfile(self._path / name)
472800
def _validate_if_patch_supported(self, headers, uri):
        """"""
        if not self._operation_allowed(headers, 'PATCH'):
                msg = ('PATCH Operation not supported on the resource '
                       '"%s"' % uri)
                raise exception.IloError(msg)
854788
def has_changed (filename):
    """"""
    key = os.path.abspath(filename)
    mtime = get_mtime(key)
    if key not in _mtime_cache:
        _mtime_cache[key] = mtime
        return True
    return mtime > _mtime_cache[key]
926671
def update_safe(filename: str, **kw: Any) -> Generator[IO, None, None]:
    
    with tempfile.NamedTemporaryFile(
        dir=os.path.dirname(filename),
        delete=False,
        prefix=f"{os.path.basename(filename)}.",
        **kw,
    ) as tf:
        if os.path.exists(filename):
            os.chmod(tf.name, os.stat(filename).st_mode & 0o7777)
        tf.has_changed = False  # type: ignore
        yield tf
        if not os.path.exists(tf.name):
            return
        filename_tmp = tf.name
    if os.path.exists(filename) and filecmp.cmp(filename, filename_tmp, shallow=False):
        os.unlink(filename_tmp)
    else:
        os.rename(filename_tmp, filename)
        tf.has_changed = True
770576
def apply_patch(self, filename, arch, build_dir=None):
        
        info("Applying patch {}".format(filename))
        build_dir = build_dir if build_dir else self.get_build_dir(arch)
        filename = join(self.get_recipe_dir(), filename)
        shprint(sh.patch, "-t", "-d", build_dir, "-p1",
                "-i", filename, _tail=10)
532455
def patched_function(self, *args, **kwargs):
        
        self.validate(*args, **kwargs)
        return self.function(*args, **kwargs)
635712
def _ensure_filepath(filename):
        

        filepath = os.path.dirname(filename)
        if not os.path.exists(filepath):
            os.makedirs(filepath)
178458
def excluded(self, filename, parent=None):
        
        if not self.options.exclude:
            return False
        basename = os.path.basename(filename)
        if filename_match(basename, self.options.exclude):
            return True
        if parent:
            filename = os.path.join(parent, filename)
        filename = os.path.abspath(filename)
        return filename_match(filename, self.options.exclude)
268891
def _filter(self, filename):
        
        return self.name_filter is not None and re.search(self.name_filter, filename) is None
332365
def patch(name)
      raise ConfigurationError, "patch_dir has not been set" if patch_dir.nil?
      raise ConfigurationError, "patch_dir is not a directory" unless Dir.exist?(patch_dir)
      Patch.from_yaml File.join(patch_dir, "#{name}.yml")
    end
785898
def is_accessable_by_others(filename):
    """"""
    mode = os.stat(filename)[stat.ST_MODE]
    return mode & (stat.S_IRWXG | stat.S_IRWXO)