Пример #1
0
def get_config():
    config_file = os.environ.get('GETDIST_CONFIG', None)
    if not config_file:
        config_file = os.path.join(os.path.dirname(__file__), 'config.ini')
    if os.path.exists(config_file):
        return IniFile(config_file)
    else:
        return IniFile()
Пример #2
0
 def __init__(self, base):
     self.batchPath = base
     self.roots = {}
     self.base_dir_names = set()
     self._sorted_names = {}
     option_file = os.path.join(base, 'getdist.ini')
     if os.path.exists(option_file):
         self.getdist_options = IniFile(option_file).params
     else:
         self.getdist_options = {}
     for base, dirs, files in os.walk(base):
         for _dir in dirs:
             files = get_chain_root_files(os.path.join(base, _dir))
             if files:
                 self._add(_dir, os.path.join(base, _dir), files)
             for base_rel, dirs_rel, files_rel in os.walk(
                     os.path.join(base, _dir)):
                 for _subdir in dirs_rel:
                     files = get_chain_root_files(
                         os.path.join(base_rel, _subdir))
                     if files:
                         self._add(_dir, os.path.join(base_rel, _subdir),
                                   files)
         break
     self._make_unique()