示例#1
0
 def save(self):
     """Save the state to the JSON file in the config dir."""
     logger.debug("Save the GUI state to `%s`.", self.path)
     _save_json(
         self.path,
         {k: v
          for k, v in self.items() if k not in ('config_dir', 'name')})
示例#2
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)
示例#3
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)
示例#4
0
 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)
示例#5
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)
示例#6
0
文件: gui.py 项目: kwikteam/phy
 def save(self):
     """Save the state to the JSON file in the config dir."""
     logger.debug("Save the GUI state to `%s`.", self.path)
     _save_json(self.path, {k: v for k, v in self.items()
                            if k not in ('config_dir', 'name')})