Return data path to `filename`, checking locally first then in the config file.
162687
def datapath4file(filename, ext:str='.tgz', archive=True):
    ""
    local_path = URLs.LOCAL_PATH/'data'/filename
    if local_path.exists() or local_path.with_suffix(ext).exists(): return local_path
    elif archive: return Config.data_archive_path() / filename
    else: return Config.data_path() / filename
340027
def DataPath():
    
    return os.path.abspath('%s/data'%(os.path.dirname( \
        os.path.realpath(__file__))))
627196
def read_config(conf_dir=DEFAULT_CONFIG_DIR):
    ""

    conf_path = os.path.expanduser(conf_dir)
    if not os.path.exists(conf_path):
        # only throw if not default
        if conf_dir != DEFAULT_CONFIG_DIR:
            raise IOError("Config directory not found at %s" % (conf_path, ))

    return munge.load_datafile('config', conf_path, default=None)
620599
def in_system_path(filename):
    
    fn = sdk_normalize(os.path.realpath(filename))
    if fn.startswith('/usr/local/'):
        return False
    elif fn.startswith('/System/') or fn.startswith('/usr/'):
        return True
    else:
        return False
539668
def data_file(self):
        
        path = os.getcwd() + '/' + self.lazy_folder
        return path + self.data_filename
608779
def get_filepath(self, filename):
        
        return os.path.join(self.parent_folder, '{},{},{}'.format(self.tile_name, self.date, self.aws_index),
                            self.add_file_extension(filename)).replace(':', '.')
766413
def filepath(self) -> str:
        """"""
        return os.path.join(self._dirpath, self.name + '.nc')
104959
def get_conf_path(filename=None):
    """"""
    conf_dir = osp.join(get_home_dir(), '.condamanager')

    if not osp.isdir(conf_dir):
        os.mkdir(conf_dir)

    if filename is None:
        return conf_dir
    else:
        return osp.join(conf_dir, filename)
24443
def get_filename(self):
        '''  '''
        if self.filename is None or not os.path.exists(self.filename):
            tf = tempfile.mktemp() + self._default_file_extension
            self.save(tf)
            yield tf
            os.remove(tf)
        else:
            yield self.filename
240573
def get_data_path(data, module, check_exists=True):
    
    basepath = os.path.dirname(os.path.abspath(inspect.getfile(module)))

    if isinstance(data, basestring):
        data = [data]

    dirpath = os.path.join(basepath, *data)

    if check_exists:
        assert os.path.exists(dirpath), '{0} does not exist'.format(dirpath)

    return pathlib.Path(dirpath)
879297
function getLocalConfig(thisConfig, directory) {
  var found,
    i,
    localConfig,
    localConfigFile,
    config = {},
    localConfigFiles = thisConfig.findLocalConfigFiles(directory),
    numFiles = localConfigFiles.length,
    rootPath,
    projectConfigPath = path.join(process.cwd(), LOCAL_CONFIG_FILENAME);

  for (i = 0; i < numFiles; i++) {

    localConfigFile = localConfigFiles[i];

        // Don't consider the personal config file in the home directory,
        // except if the home directory is the same as the current working directory
    if (localConfigFile === PERSONAL_CONFIG_PATH && localConfigFile !== projectConfigPath) {
      continue;
    }

        // If root flag is set, don't consider file if it is above root
    if (rootPath && !pathIsInside(path.dirname(localConfigFile), rootPath)) {
      continue;
    }

    localConfig = loadConfig(localConfigFile);

        // Don't consider a local config file found if the config is empty.
    if (!Object.keys(localConfig).length) {
      continue;
    }

        // Check for root flag
    if (localConfig.root === true) {
      rootPath = path.dirname(localConfigFile);
    }

    found = true;
    config = util.mergeConfigs(localConfig, config);
  }

    // Use the personal config file if there are no other local config files found.
  return found ? config : util.mergeConfigs(config, getPersonalConfig());
}
1278881
def get_conf_files(filename):
    
    if not os.path.isfile(filename):
        raise ValueError("'%s' is not a file" % filename)
    conf_d_path = "%s.d" % filename
    if not os.path.exists(conf_d_path):
        return [filename]
    return [filename] + get_conf_d_files(conf_d_path)
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)
            )
290676
def _load_from_configs(self, filename):
    
    config_filename = os.path.join(self._config_path, filename)
    if os.path.exists(config_filename):
      try:
        f = open(config_filename, 'r')
        content = ''.join(f.readlines())
        f.close()
        return content
      except Exception as err:
        raise err
    else:
      raise IOError("File not found: {}".format(config_filename))
964258
def _get_filename(self):
        """"""
        if self._fname is None:
            timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
            fname = "%s-%s.log" % (timestamp, abs(id(self)))
            self._fname = os.path.join(self.file_path, fname)
        return self._fname
1242381
def get_default_config_file_path(init_filename=None):
    """"""
    prm_dir = get_package_prm_dir()
    if not init_filename:
        init_filename = DEFAULT_FILENAME
    src = os.path.join(prm_dir, init_filename)
    return src
1145952
def locate_config(self):
        '''  '''
        for f in self.__potential:
            f = FileHelper.abspath(f)
            if os.path.isfile(f):
                return f
        return None