Include file referenced at node.
16526
def construct_include(self, node):
        """"""

        filename = os.path.join(self._root, self.construct_scalar(node))
        filename = os.path.abspath(filename)
        extension = os.path.splitext(filename)[1].lstrip('.')

        with open(filename, 'r') as f:
            if extension in ('yaml', 'yml'):
                return yaml.load(f, Loader=self)
            else:
                return ''.join(f.readlines())
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) {}
}
485004
function include (filename, language) {
  return fs.readFile(filename, 'utf-8').then(function (contents) {
    return '```' +
      (typeof language === 'string' ? language : path.extname(filename).substr(1)) +
      '\n' +
      contents +
      '\n```\n'
  })
}
961099
def include_from_file(records, handle):
    
    ids = set(i.strip() for i in handle)

    for record in records:
        if record.id.strip() in ids:
            yield record
1335212
def includeme(config):
    """"""
    config.add_route('references', '/references')
    _add_referencer(config.registry)
    config.add_view_deriver(protected_resources.protected_view)
    config.add_renderer('json_item', json_renderer)
    config.scan()
193978
function loadIncludes(data, current_file) {
  return data.replace(includeExpr, function(src, name, ext) {
    try {
      var include_path =
          path.join(current_file, "../", name+"."+(ext || "markdown"))
      return loadIncludes(fs.readFileSync(include_path, "utf8"), current_file);
    } catch(e) {
      return "";
    }
  });
}
1167531
def include_file(filename):
        """"""
        if os.path.isfile(filename):
            with open(filename) as handle:
                return safe_load(handle)
        raise RuntimeError("Include file %s doesn't exist!" % filename)
999458
def handle_relative_import(self, node):
        
        no_file = os.path.abspath(os.path.join(self.filenames[-1], os.pardir))
        skip_init = False

        if node.level == 1:
            # Same directory as current file
            if node.module:
                name_with_dir = os.path.join(no_file, node.module.replace('.', '/'))
                if not os.path.isdir(name_with_dir):
                    name_with_dir = name_with_dir + '.py'
            # e.g. from . import X
            else:
                name_with_dir = no_file
                # We do not want to analyse the init file of the current directory
                skip_init = True
        else:
            parent = os.path.abspath(os.path.join(no_file, os.pardir))
            if node.level > 2:
                # Perform extra `cd ..` however many times
                for _ in range(0, node.level - 2):
                    parent = os.path.abspath(os.path.join(parent, os.pardir))
            if node.module:
                name_with_dir = os.path.join(parent, node.module.replace('.', '/'))
                if not os.path.isdir(name_with_dir):
                    name_with_dir = name_with_dir + '.py'
            # e.g. from .. import X
            else:
                name_with_dir = parent

        # Is it a file?
        if name_with_dir.endswith('.py'):
            return self.add_module(
                module=(node.module, name_with_dir),
                module_or_package_name=None,
                local_names=as_alias_handler(node.names),
                import_alias_mapping=retrieve_import_alias_mapping(node.names),
                from_from=True
            )
        return self.from_directory_import(
            (node.module, name_with_dir),
            not_as_alias_handler(node.names),
            as_alias_handler(node.names),
            retrieve_import_alias_mapping(node.names),
            skip_init=skip_init
        )
245968
@Override
	public void addInclude(String path)
	{
		if (!includes.contains(path))
		{
			includes.add(path);
		}
	}
174361
def file(ctx, data_dir, data_file):
    """"""
    if not ctx.file:
        ctx.data_file = data_file

    if not ctx.data_dir:
        ctx.data_dir = data_dir

    ctx.type = 'file'
1150474
def add_file(self,fName,content) :
        """"""
        if not self.isdir() : raise Exception("FSQuery tried to add a file in a node which is not a directory : %s" % self.abs)
        self.write_file("%s/%s"%(self.abs,fName),content)
1249093
def include_yaml(self, node):
        '''
        
        '''
        filename = self.construct_scalar(node)
        if not filename.startswith('/'):
            if self._root is None:
                raise Exception('!include_yaml %s is a relative path, '
                                'but stream lacks path' % filename)
            filename = os.path.join(self._root, self.construct_scalar(node))
        with self.open(filename, 'r') as fin:
            return yaml.load(fin, Loader)
582928
function include(path) {
	var path = publish.conf.templatesDir+path;
	return IO.readFile(path);
}
1080243
private static function IncludeTemplate(){
            $oThis = self::CreateInstanceIfNotExists();

            $oThis->ReplaceVars();
            $oThis->sBuffer = trim($oThis->sBuffer);
            $Offset = 0;

            while(preg_match('/{include\s*(.*?)}/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $Offset)){
                $sFilename = str_replace(array("'", '"'), "", $aMatches[1][0]);

                if(file_exists($sFilename)){
                    $sBufferAppend = file_get_contents($sFilename);
                    $oThis->sBuffer = str_replace($aMatches[0][0], $sBufferAppend, $oThis->sBuffer);
                }
                else{
                   $oThis->sBuffer = str_replace($aMatches[0][0], "", $oThis->sBuffer);
                }

                $Offset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }
        }
618271
protected function includes()
    {
        $moduleInclude = (array) $this->def('include');
        $globalInclude = $this->app['config']->get('module::include');
        $specificInclude = array($this->name.'.php');
        $include = array_merge($moduleInclude, $specificInclude, $globalInclude);
        foreach ($include as $file)
		{
			$path = $this->path.'/'.$file;
			if ($this->app['files']->exists($path)) require $path;
		}
    }
1108502
def include_file(member,file_filter):
    '''
    '''
    member_path = member.name.replace('.','',1)

    if len(member_path) == 0:
        return False

    # Does the filter skip it explicitly?
    if "skip_files" in file_filter:
        if member_path in file_filter['skip_files']:
            return False

    # Include explicitly?
    if "include_files" in file_filter:
        if member_path in file_filter['include_files']:
            return True

    # Regular expression?
    if "regexp" in file_filter:
        if re.search(file_filter["regexp"],member_path):
            return True
    return False
207510
def visit_reference(self, node: docutils.nodes.reference) -> None:
        """"""
        # if len(node.children) != 1 or not isinstance(node.children[0], docutils.nodes.Text) \
        #         or not all(_ in node.attributes for _ in ('name', 'refuri')):
        #     return
        path = pathlib.Path(node.attributes['refuri'])
        try:
            if path.is_absolute():
                return
            resolved_path = path.resolve()
        except FileNotFoundError:  # in resolve(), prior to Python 3.6
            return
        # except OSError:  # in is_absolute() and resolve(), on URLs in Windows
        #     return
        try:
            resolved_path.relative_to(HERE)
        except ValueError:
            return
        if not path.is_file():
            return
        assert node.attributes['name'] == node.children[0].astext()
        self.references.append(node)