Look for a configuration file in `path`.

        If exists return its full path, otherwise None.
776041
def _get_config_file_in_folder(cls, path):
        
        if os.path.isfile(path):
            path = os.path.dirname(path)

        for fn in cls.PROJECT_CONFIG_FILES:
            config = RawConfigParser()
            full_path = os.path.join(path, fn)
            if config.read(full_path) and cls._get_section_name(config):
                return full_path
1016288
def __read_config(self, file_path: str):
        
        if not os.path.exists(file_path):
            raise FileNotFoundError("File path not found: %s", file_path)
        # check if file exists
        if not os.path.isfile(file_path):
            log(ERROR, "file not found: %s", file_path)
            raise FileNotFoundError("configuration file not found %s", file_path)

        self.config.read(file_path)
440516
def get_default_config_file(rootdir=None):
    """"""
    if rootdir is None:
        return DEFAULT_CONFIG_FILE

    for path in CONFIG_FILES:
        path = os.path.join(rootdir, path)
        if os.path.isfile(path) and os.access(path, os.R_OK):
            return path
1257947
def read_config(path):
    
    parser = _make_parser()
    if parser.read(path):
        return parser
    raise Exception("Failed to read {}".format(path))
630475
def getConfigPath(configFileName = None):
    
    if configFileName != None:
        # Returning the path of the configuration file
        if sys.platform == 'win32':
            return os.path.expanduser(os.path.join('~\\', 'Deepify', configFileName))
        else:
            return os.path.expanduser(os.path.join('~/', '.config', 'Deepify', configFileName))
    else:
        # Returning the path of the configuration folder
        if sys.platform == 'win32':
            return os.path.expanduser(os.path.join('~\\', 'Deepify'))
        else:
            return os.path.expanduser(os.path.join('~/', '.config', 'Deepify'))
1048898
def getpath(cmd, name=None, url=None, cfg="~/.jcvirc", warn="exit"):
    
    p = which(cmd)  # if in PATH, just returns it
    if p:
        return p

    PATH = "Path"
    config = RawConfigParser()
    cfg = op.expanduser(cfg)
    changed = False
    if op.exists(cfg):
        config.read(cfg)

    assert name is not None, "Need a program name"

    try:
        fullpath = config.get(PATH, name)
    except NoSectionError:
        config.add_section(PATH)
        changed = True
    except:
        pass

    try:
        fullpath = config.get(PATH, name)
    except NoOptionError:
        msg = "=== Configure path for {0} ===\n".format(name, cfg)
        if url:
            msg += "URL: {0}\n".format(url)
        msg += "[Directory that contains `{0}`]: ".format(cmd)
        fullpath = input(msg).strip()
        config.set(PATH, name, fullpath)
        changed = True

    path = op.join(op.expanduser(fullpath), cmd)
    if warn == "exit":
        try:
            assert is_exe(path), \
                "***ERROR: Cannot execute binary `{0}`. ".format(path)
        except AssertionError as e:
            sys.exit("{0!s}Please verify and rerun.".format(e))

    if changed:
        configfile = open(cfg, "w")
        config.write(configfile)
        logging.debug("Configuration written to `{0}`.".format(cfg))

    return path
832375
def get_config_var(self, path, env=None):
        '''
        
        '''
        if env is None:
            env = {}
        result = self.conf
        for e in path.split('.'):
            if e[0] == '$':
                try:
                    result = result[env[e[1:]]]
                except KeyError as ex:
                    try:
                        result = result['.default']
                    except KeyError:
                        raise ex
            else:
                result = result[e]
        return result
1057031
def _resolve_path(self, path):
        
        filepath = None
        mimetype = None

        for root, dirs, files in self.filter_files(self.path):
            # Does it exist in error path?
            error_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'error_templates', path)
            try:
                with open(error_path):
                    mimetype, encoding = mimetypes.guess_type(error_path)
                    filepath = error_path
            except IOError:
                pass

            # Does it exist in Tarbell blueprint?
            if self.base:
                basepath = os.path.join(root, self.blueprint_name, path)
                try:
                    with open(basepath):
                        mimetype, encoding = mimetypes.guess_type(basepath)
                        filepath = basepath
                except IOError:
                    pass

            # Does it exist under regular path?
            fullpath = os.path.join(root, path)
            try:
                with open(fullpath):
                    mimetype, encoding = mimetypes.guess_type(fullpath)
                    filepath = fullpath
            except IOError:
                pass

        return filepath, mimetype
808633
def read_config_file(path):
    """"""
    try:
        with open(path, 'r') as f:
            return json.load(f, object_pairs_hook=OrderedDict)
    except IOError as ex:
        if ex != errno.ENOENT:
            raise
    return {}
39829
def _get_full_path(self, path, environ):
        
        if path.startswith('/'):
            path = environ.get('SCRIPT_NAME', '') + path
        return path
27217
def get(self, name):
        

        for d in self.paths:
            if os.path.exists(d) and name in os.listdir(d):
                return os.path.join(d, name)
        logger.debug('File not found {}'.format(name))
        return None
480087
def valid_config_exists(config_path=CONFIG_PATH):
    
    if os.path.isfile(config_path):
        try:
            config = read_config(config_path)
            check_config(config)
        except (ConfigurationError, IOError):
            return False
    else:
        return False
    return True
316097
def load_config(path)
      return unless File.exist?(path)
      buf = File.read(path) 
      eval("#{buf}", binding, path)
    end
655031
def file_get_contents(self, path):
        

        with open(self.get_full_file_path(path), 'r') as f: return  f.read()
1139973
def exists(self, full_path):
        """"""
        if path.exists(self.new_path(full_path)):
            return self.new_path(full_path)
789262
private static Path getConfigFilePath(Path projectPath) {
        String pathString = SystemProperty.CONFIGURATION_FILE.value();
        Path path;
        if (pathString == null) {
            path = DEFAULT_CONFIG_FILE;
        } else {
            path = Paths.get(pathString);
        }
        return projectPath.resolve(path);
    }
284199
def find():
        """"""
        names = ('archan.yml', 'archan.yaml', '.archan.yml', '.archan.yaml')
        current_dir = os.getcwd()
        configconfig_file = os.path.join(current_dir, '.configconfig')
        default_config_dir = os.path.join(current_dir, 'config')
        if os.path.isfile(configconfig_file):
            logger.debug('Reading %s to get config folder path',
                         configconfig_file)
            with open(configconfig_file) as stream:
                config_dir = os.path.join(current_dir, stream.read()).strip()
        elif os.path.isdir(default_config_dir):
            config_dir = default_config_dir
        else:
            config_dir = current_dir
        logger.debug('Config folder = %s', config_dir)
        for name in names:
            config_file = os.path.join(config_dir, name)
            logger.debug('Searching for config file at %s', config_file)
            if os.path.isfile(config_file):
                logger.debug('Found %s', config_file)
                return config_file
        logger.debug('No config file found')
        return None