コード例 #1
0
ファイル: context.py プロジェクト: kwikteam/phy
 def save(self, name, data, location='local', kind='json'):
     """Save a dictionary in a JSON file within the cache directory."""
     file_ext = '.json' if kind == 'json' else '.pkl'
     path = self._get_path(name, location, file_ext=file_ext)
     _ensure_dir_exists(op.dirname(path))
     logger.debug("Save data to `%s`.", path)
     if kind == 'json':
         _save_json(path, data)
     else:
         _save_pickle(path, data)
コード例 #2
0
 def save(self, name, data, location='local', kind='json'):
     """Save a dictionary in a JSON file within the cache directory."""
     file_ext = '.json' if kind == 'json' else '.pkl'
     path = self._get_path(name, location, file_ext=file_ext)
     _ensure_dir_exists(op.dirname(path))
     logger.debug("Save data to `%s`.", path)
     if kind == 'json':
         _save_json(path, data)
     else:
         _save_pickle(path, data)
コード例 #3
0
ファイル: testing.py プロジェクト: wueric/phy-contrib
def download_test_file(name, config_dir=None, force=False):
    """Download a test file."""
    config_dir = config_dir or phy_config_dir()
    path = op.join(config_dir, 'test_data', name)
    _ensure_dir_exists(op.dirname(path))
    if not force and op.exists(path):
        return path
    url = _BASE_URL + name
    download_file(url, output_path=path)
    return path
コード例 #4
0
 def __init__(self, name='GUI', config_dir=None, **kwargs):
     super(GUIState, self).__init__(**kwargs)
     self.name = name
     self.config_dir = config_dir or phy_config_dir()
     _ensure_dir_exists(op.join(self.config_dir, self.name))
     self.load()
コード例 #5
0
ファイル: context.py プロジェクト: stephenlenzi/phy
 def save(self, name, data, location='local'):
     """Save a dictionary in a JSON file within the cache directory."""
     path = self._get_path(name, location)
     _ensure_dir_exists(op.dirname(path))
     logger.debug("Save data to `%s`.", path)
     _save_json(path, data)
コード例 #6
0
ファイル: context.py プロジェクト: ablot/phy
 def save(self, name, data, location='local'):
     """Save a dictionary in a JSON file within the cache directory."""
     path = self._get_path(name, location)
     _ensure_dir_exists(op.dirname(path))
     logger.debug("Save data to `%s`.", path)
     _save_json(path, data)
コード例 #7
0
ファイル: gui.py プロジェクト: kwikteam/phy
 def __init__(self, name='GUI', config_dir=None, **kwargs):
     super(GUIState, self).__init__(**kwargs)
     self.name = name
     self.config_dir = config_dir or phy_config_dir()
     _ensure_dir_exists(op.join(self.config_dir, self.name))
     self.load()