read dotfile and populate self
        opts will override the dotfile settings,
        make sure everything is synced in both
        opts and this object
14780
def load(self):
        
        if self.exists():
            with open(self.dot_file, 'r') as handle:
                self.update(json.load(handle))
        if self.options['context'] is not None:
            self['context'] = self.options['context']
        else:
            self.options['context'] = self['context']
        if self.options['defaults'] is not None:
            self['defaults'] = self.options['defaults']
        else:
            self.options['defaults'] = self['defaults']
        if self.options['output'] is not None:
            self['output'] = self.options['output']

        if self.options.get('inclusive', False):
            self['inclusive'] = True

        if self.options.get('exclude', []):
            self['exclude'].extend(self.options['exclude'])

        if self['output'] is None:
            self['output'] = os.path.join(os.getcwd(), 'dockerstache-output')
        self['output_path'] = self.abs_output_dir()
        self['input_path'] = self.abs_input_dir()
        if self['context'] is not None:
            self['context_path'] = absolute_path(self['context'])
        if self['defaults'] is not None:
            self['defaults_path'] = absolute_path(self['defaults'])
80527
def dotty (params = {})
      dotfile = "graph.dot"
      File.open(dotfile, "w") {|f|
        print_dotted_on(params, f)
      }
      system("dotty", dotfile)
    end
910330
function readFileSync( path, opts ) {
	var file;
	try {
		if ( arguments.length > 1 ) {
			file = fs.readFileSync( path, opts );
		} else {
			file = fs.readFileSync( path );
		}
	} catch ( err ) {
		return err;
	}
	return file;
}
694244
def init(FILE):
    
    try:
        cfg.read(FILE)
        global _loaded
        _loaded = True
    except:
        file_not_found_message(FILE)
1265334
function() {
        try {
            this.set(fs.existsSync(this._stateFile) ? JSON.parse(fs.readFileSync(this._stateFile)) : {});
        } catch (e) {}
    }
1332477
def AddFileReadData(self, path, file_data_path):
    
    if self.file_system.FileEntryExistsByPath(path):
      raise ValueError('Path: {0:s} already set.'.format(path))

    with open(file_data_path, 'rb') as file_object:
      file_data = file_object.read()

    self._AddParentDirectories(path)
    self.file_system.AddFileEntry(path, file_data=file_data)
556800
function loadEnvFile() {
	if (flags.env || flags.envfile) {
		try {
			const dotenv = require("dotenv");

			if (flags.envfile)
				dotenv.config({ path: flags.envfile });
			else
				dotenv.config();
		} catch(err) {
			throw new Error("The 'dotenv' package is missing! Please install it with 'npm install dotenv --save' command.");
		}
	}
}
187652
function addAddedFileInnScript(key, path, dot_path){
			dot_path = dot_path || path;
			// checking if same file imported twice for same Class.
			if(!dot_path) return;
			var script = scriptArr[scriptArr.length - 1];
			if( !script ){
				return;
			}
			var arr = script[key] ||  (script[key] = []);
			if( arr.indexOf(dot_path) === -1 ) {
				arr.push(dot_path);
			}
			return true;
		}
804135
def read(opts = {})
      Bunto.logger.debug "Reading:", relative_path

      if yaml_file?
        @data = SafeYAML.load_file(path)
      else
        begin
          merge_defaults
          read_content(opts)
          read_post_data
        rescue SyntaxError => e
          Bunto.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}"
        rescue => e
          raise e if e.is_a? Bunto::Errors::FatalException
          Bunto.logger.error "Error:", "could not read file #{path}: #{e.message}"
        end
      end
    end
91938
def sync(infile, outfile):
    

    ecode = 0
    try:
        rc, ret = anchore_policy.sync_policymeta(bundlefile=infile, outfile=outfile)
        if not rc:
            anchore_print_err(ret['text'])
            ecode = 1
        elif outfile and outfile == '-':
            anchore_print(ret['text'])
    except Exception as err:
        anchore_print_err('operation failed')
        ecode = 1

    sys.exit(ecode)
208497
def populateFromFile(self, dataUrls, indexFiles):
        
        assert len(dataUrls) == len(indexFiles)
        for dataUrl, indexFile in zip(dataUrls, indexFiles):
            varFile = pysam.VariantFile(dataUrl, index_filename=indexFile)
            try:
                self._populateFromVariantFile(varFile, dataUrl, indexFile)
            finally:
                varFile.close()
1319305
function(file, opts) {
	if (util.isObject(file) || util.isArray(file)) {
		return file;
	}

	var options = util.extend({
		asText: false, // true, false, 'pretty'
		javascript: false, // true, false
		scope: '', // directory to look for initial file
		variables: {
			// contains a key->value object with variables to @extends
		}
	}, opts);

	file = util.template(file, options.variables);

	/*****************************************************************************
	*  Initialize
	*****************************************************************************/

	var file_path;

	// If the file path is absolute use it
	// If not then prepend the current scope of the previous file.
	if (path.resolve(file) === path.normalize(file)) {
		file_path = path.normalize(file);
	}
	else {
		file_path = path.normalize(
			options.scope ? options.scope + '/' + file : file
		);
	}
	var class_json = parseFile(file_path, options);

	// Stores JSON objects of files that have to be merged together:
	// ["a", "b"]
	var file_list = util.isArray(class_json[indicators.EXTENDS]) ?
		class_json[indicators.EXTENDS] :
		class_json[indicators.EXTENDS] != null ?
			[ class_json[indicators.EXTENDS] ] :
			[];

	// Delete @extends from base_json to avoid infinitive recursion
	delete class_json[indicators.EXTENDS];

	// Push class_json to the path list:
	file_list.push(class_json);
	/*****************************************************************************
	*  Merge file by file
	*****************************************************************************/

	// default config for each file required:
	// set asText = false so we get an object returned
	// set scope = file's directory so there can be relative references
	var json_config = util.defaults({
		asText: false,
		scope: path.dirname(file_path),

		// _as is a hack so that we know its we are calling the function recursive
		_as: ANTI_SANITIZER
	}, options);

	// super_json is our output, start by containing first file in array
	var super_json = fromFile(file_list.shift(), json_config);

	// TODO: Figure out when to sanitize super_json hopefully we don't have to
	//   santize all returns. I'm not sure about this, and I'm not sure if we
	//   can even sanitize super_json when we return it.
	//   Is super_json used by anyone recursively?

	while (file_list.length) {
		var json = fromFile(file_list.shift(), json_config);

		merge(super_json, json);
	}

	// If this file is called from the outside eg json_merger.from...
	//   File('file_which_doesnt_extends_another_file.json')
	//   we need to sanitize the file and remove all indicators
	if (options._as != ANTI_SANITIZER) {
		super_json = util.sanitizeValue(super_json);
	}

	/*****************************************************************************
	*  Return super_json
	*****************************************************************************/
	if (options.asText) {
		return stringify(super_json, options);
	}
	else {
		return super_json;
	}
}
973481
function readdirPlus(path, userOptions, callback) {
	if (libTools.isFunction(userOptions)) {
		callback = userOptions;
		userOptions = null;
	}

	var options = libTools.merge(libVars.DEFAULT_OPTIONS);

	if (userOptions) {
		userOptions.stat = normalizeSection(userOptions.stat);
		userOptions.content = normalizeSection(userOptions.content);

		if (userOptions.content) {
			normalizeArray(userOptions.content, options.content, "asText");
			normalizeArray(userOptions.content, options.content, "asBinary");
		}

		libTools.merge(userOptions, options);
	}

	if (path[path.length - 1] !== libPath.sep) {
		path += libPath.sep;
	}

	setupFn(options.readdir);
	setupFn(options.stat);
	setupFn(options.content);

	return doReadDir(path, options, function (err, results) {
		if (err) {
			return callback && callback(err);
		}
		return callback && callback(null, results);
	});

	function normalizeSection(section) {
		if (libTools.isBoolean(section)) {
			return {
				enabled: section
			};
		}
		if (libTools.isAnonObject(section) && !libTools.isBoolean(section.enabled)) {
			section.enabled = true;
		}
		return section;
	}

	function setupFn(opts) {
		if (!opts.fn) {
			opts.fn = options.sync ? opts.fnSync : opts.fnAsync;
		}
		if (options.sync) {
			opts.fn = libTools.syncWrapper(opts.fn);
		}
	}

	function normalizeArray(target, source, property) {
		if (!target[property] || target[property] === true) {
			return;
		}
		if (!libTools.isArray(target[property])) {
			target[property] = [target[property]];
		}
		else if (target[property].length === 1 && libTools.isArray(target[property][0])) {
			// array wrapped in array, replaces source value
			target[property] = target[property][0];
		} else {
			target[property] = source[property].concat(target[property]);
		}
	}
}
1078270
def read(self, config_dir=None, config_name=None, clear=False):
        

# TODO should probably allow config_dir to be a list as well
        # get name of config directory
        if not config_dir:
            config_dir = self._defaults.get('config_dir', None)
        if not config_dir:
            raise KeyError('config_dir not set')

        # get name of config file
        if not config_name:
            config_name = self._defaults.get('config_name', None)
        if not config_name:
            raise KeyError('config_name not set')

        conf_path = os.path.expanduser(config_dir)
        if not os.path.exists(conf_path):
            raise IOError("config dir not found at %s" % (conf_path,))

        config = munge.load_datafile(config_name, conf_path, default=None)

        if not config:
            raise IOError("config file not found in %s" % (conf_path,))

        if clear:
            self.clear()

        munge.util.recursive_update(self.data, config)
        self._meta_config_dir = conf_path
        return self
697689
function (opts) {
            var self = this;
            opts.meta.files = [];
            Y.each(this.data.files, function (v) {
                if (v.external) {
                    return;
                }
                opts.meta.files.push({
                    displayName: v.name,
                    name: self.filterFileName(v.name),
                    path: v.path || v.name
                });
            });

            var tree = {};
            var files = [];
            Y.each(this.data.files, function (v) {
                if (v.external) {
                    return;
                }
                files.push(v.name);
            });
            files.sort();
            Y.each(files, function (v) {
                var p = v.split('/'),
                    par;
                p.forEach(function (i, k) {
                    if (!par) {
                        if (!tree[i]) {
                            tree[i] = {};
                        }
                        par = tree[i];
                    } else {
                        if (!par[i]) {
                            par[i] = {};
                        }
                        if (k + 1 === p.length) {
                            par[i] = {
                                path: v,
                                name: self.filterFileName(v)
                            };
                        }
                        par = par[i];
                    }
                });
            });

            opts.meta.fileTree = tree;

            return opts;
        }
781097
def parse_dot_doc_file(in_dir, filename, options)
      # read and strip comments
      patterns = File.read(filename).gsub(/#.*/, '')

      result = []

      patterns.split.each do |patt|
        candidates = Dir.glob(File.join(in_dir, patt))
        result.concat(normalized_file_list(options,  candidates))
      end
      result
    end
1174080
def __gen_opts(self, opts):
        '''
        
        '''
        # If the state is intended to be applied locally, then the local opts
        # should have all of the needed data, otherwise overwrite the local
        # data items with data from the master
        if 'local_state' in opts:
            if opts['local_state']:
                return opts
        mopts = self.client.master_opts()
        if not isinstance(mopts, dict):
            # An error happened on the master
            opts['renderer'] = 'jinja|yaml'
            opts['failhard'] = False
            opts['state_top'] = salt.utils.url.create('top.sls')
            opts['nodegroups'] = {}
            opts['file_roots'] = {'base': [syspaths.BASE_FILE_ROOTS_DIR]}
        else:
            opts['renderer'] = mopts['renderer']
            opts['failhard'] = mopts.get('failhard', False)
            if mopts['state_top'].startswith('salt://'):
                opts['state_top'] = mopts['state_top']
            elif mopts['state_top'].startswith('/'):
                opts['state_top'] = salt.utils.url.create(mopts['state_top'][1:])
            else:
                opts['state_top'] = salt.utils.url.create(mopts['state_top'])
            opts['state_top_saltenv'] = mopts.get('state_top_saltenv', None)
            opts['nodegroups'] = mopts.get('nodegroups', {})
            opts['state_auto_order'] = mopts.get(
                'state_auto_order',
                opts['state_auto_order'])
            opts['file_roots'] = mopts['file_roots']
            opts['top_file_merging_strategy'] = mopts.get('top_file_merging_strategy',
                                                           opts.get('top_file_merging_strategy'))
            opts['env_order'] = mopts.get('env_order', opts.get('env_order', []))
            opts['default_top'] = mopts.get('default_top', opts.get('default_top'))
            opts['state_events'] = mopts.get('state_events')
            opts['state_aggregate'] = mopts.get('state_aggregate', opts.get('state_aggregate', False))
            opts['jinja_env'] = mopts.get('jinja_env', {})
            opts['jinja_sls_env'] = mopts.get('jinja_sls_env', {})
            opts['jinja_lstrip_blocks'] = mopts.get('jinja_lstrip_blocks', False)
            opts['jinja_trim_blocks'] = mopts.get('jinja_trim_blocks', False)
        return opts