Search the strings in a config file for a substitutable value, e.g. 
            "morphologies_dir": "$COMPONENT_DIR/morphologies",
196763
def subs(self, path):
        
        #print_v('Checking for: \n  %s, \n  %s \n  in %s'%(self.substitutes,self.init_substitutes,path))
        if type(path) == int or type(path) == float:
            return path
        for s in self.init_substitutes:
            if path.startswith(s):
                path = path.replace(s,self.init_substitutes[s], 1)
        #print_v('  So far: %s'%path)
        for s in self.substitutes:
            if s in path:
                path = path.replace(s,self.substitutes[s])
        #print_v('  Returning: %s'%path)
        return path
654418
def detect_config(self):
        """"""
        default_files = ("config.json", "config.yml")
        for file_ in default_files:
            if os.path.exists(file_):
                return file_
22883
function findComponents(directory, components = []) {
  const items = fs.readdirSync(directory);

  items.forEach(item => {
    const itemPath = path.resolve(directory, item);

    if (fs.statSync(itemPath).isDirectory()) {
      findComponents(itemPath, components);
      return;
    }

    if (!componentRegex.test(item)) {
      return;
    }

    components.push({
      filename: itemPath,
    });
  });

  return components;
}
141138
def load_config(cls, opts, path=None, profile=None):
        """"""
        if path and os.path.exists(path):
            if os.path.isdir(path):
                cls.config_searchpath.insert(0, path)
            else:
                cls.config_files.insert(0, path)

        config = cls.read_config()
        values = config.get("default", {})
        cls._load_values_into_opts(opts, values)

        if profile and profile != "default":
            values = config.get("profile:%s" % profile, {})
            cls._load_values_into_opts(opts, values)

        return values
364417
private static function findDirectories(): string
    {
        if ($value = trim((string) self::getEnvVariable(self::CONFIG_PATH))) {
            // add env config path to top of possible locations.
            array_unshift(self::$possibleLocations, $value);
        }

        foreach (self::$possibleLocations as $path) {
            if (($location = realpath($path)) !== false) {
                return $location;
            }
        }

        throw new LogicException(sprintf(
            'Configuration directory not found in known path\'s: %s',
            join(',', self::$possibleLocations)
        ));
    }
580772
function findConfig(file) {
  if (file) {
    // Custom config location

    const configFilepath = file[0] === '/'? file : path.join(process.cwd(), file);
    if (!fs.existsSync(configFilepath)) {
      throw new DvhbWebpackError('DvhbWebpack config not found: ' + configFilepath + '.');
    }

    return configFilepath;
  }

  // Search config file in all parent directories

  let configDir;
  try {
    configDir = findup.sync(__dirname, CONFIG_FILENAME);
  }
  catch (exception) {
    throw new DvhbWebpackError('DvhbWebpack config not found: ' + CONFIG_FILENAME + '.');
  }

  return path.join(configDir, CONFIG_FILENAME);
}
639463
def find_home_config_files(filetype=['json', 'yaml']):
    """"""
    configs = []

    yaml_config = os.path.expanduser('~/.vcspull.yaml')
    has_yaml_config = os.path.exists(yaml_config)
    json_config = os.path.expanduser('~/.vcspull.json')
    has_json_config = os.path.exists(json_config)

    if not has_yaml_config and not has_json_config:
        log.debug(
            'No config file found. Create a .vcspull.yaml or .vcspull.json'
            ' in your $HOME directory. http://vcspull.git-pull.com for a'
            ' quickstart.'
        )
    else:
        if sum(filter(None, [has_json_config, has_yaml_config])) > int(1):
            raise exc.MultipleConfigWarning()
        if has_yaml_config:
            configs.append(yaml_config)
        if has_json_config:
            configs.append(json_config)

    return configs
72319
function (options, iterationInfo, modules) {
        // filename filter
        if (options.fileNameFilter) {
            var match = iterationInfo.fileName.match(options.fileNameFilter);
            if (!match) {
                return;
            }
        }

        // Filter spec.js files
        var match = iterationInfo.fileName.match(/.spec.js/i);
        if (match) {
            return;
        }

        // relative path filter
        if (options.relativePathFilter) {
            var pathMatch = iterationInfo.relativeFullPath.match(options.relativePathFilter);
            if (!pathMatch)
                return;
        }

        //load module
        loadModule(modules, options, iterationInfo);
    }
567604
def find_config_file(self, project=None, extension='.conf'):
        
        cfg_dirs = self._get_config_dirs()
        config_files = self._search_dirs(cfg_dirs, project, extension)

        return config_files
300651
def _in_conf_dir(filename):
    
    return os.path.join(
        os.path.dirname(__file__),
        "templates/conf",
        filename
    )
989058
def config_(name: str, local: bool, package: str, section: str,
            key: Optional[str]):
    """"""
    cfg = config.read_configs(package, name, local=local)
    if key:
        with suppress(NoOptionError, NoSectionError):
            echo(cfg.get(section, key))
    else:
        with suppress(NoSectionError):
            for opt in cfg.options(section):
                colourise.pinfo(opt)
                echo('    {}'.format(cfg.get(section, opt)))
1274648
def get_config_file(override_files=False):
    
    if override_files:
        if isinstance(override_files, six.string_types):
            possible_configs = [override_files]
        else:
            raise Exception("Config file override must be a string")
    else:
        xdg_config_home = os.environ.get('XDG_CONFIG_HOME') or \
            os.path.expanduser('~/.config')
        possible_configs = [os.path.join(xdg_config_home, "supernova"),
                            os.path.expanduser("~/.supernova"),
                            ".supernova"]

    for config_file in reversed(possible_configs):
        if os.path.isfile(config_file):
            return config_file

    return False
1241017
def get_bind_modules(verbose=False):
    
    builtin_path = os.path.join(module_root_path, "bind")
    searchpaths = config.bind_module_path + [builtin_path]
    bindnames = {}

    for path in searchpaths:
        if verbose:
            print "searching %s..." % path
        if not os.path.isdir(path):
            continue

        for filename in os.listdir(path):
            fpath = os.path.join(path, filename)
            fname, ext = os.path.splitext(filename)
            if os.path.isfile(fpath) and ext == ".py" \
                    and not fname.startswith('_'):
                bindnames[fname] = fpath

    return bindnames
395594
def _find_file(f):
        """"""
        if os.path.isabs(f):
            return f
        else:
            for d in Config._dirs:
                _f = os.path.join(d, f)
                if os.path.isfile(_f):
                    return _f
            raise FiggypyError(
                "could not find configuration file {} in dirs {}"
                .format(f, Config._dirs)
            )
1257777
def in_dir(
    config_dir=os.path.expanduser('~/.tmuxp'), extensions=['.yml', '.yaml', '.json']
):
    
    configs = []

    for filename in os.listdir(config_dir):
        if is_config_file(filename, extensions) and not filename.startswith('.'):
            configs.append(filename)

    return configs
347787
function getModuleName(nameWithConditional, variation) {
			var modName;
			var conditionIndex = nameWithConditional.search(conditionalRegEx);

			// look for any "/" after the condition
			var lastSlashIndex = nameWithConditional.indexOf("/",
				nameWithConditional.indexOf("}"));

			// substitution of a folder name
			if (lastSlashIndex !== -1) {
				modName = nameWithConditional.substr(0, conditionIndex) + variation;
			}
			else {
				modName = nameWithConditional.replace(conditionalRegEx, variation);
			}

			return modName;
		}
429665
def scan_directory_for_bot_configs(root_dir) -> Set[BotConfigBundle]:
    

    configs = set()

    for filename in glob.iglob(os.path.join(root_dir, '**/*.cfg'), recursive=True):
        try:
            bundle = get_bot_config_bundle(filename)
            configs.add(bundle)
        except (NoSectionError, MissingSectionHeaderError, NoOptionError, AttributeError, ParsingError, FileNotFoundError):
            pass

    return configs