Exemplo n.º 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')})
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
0
Arquivo: context.py Projeto: 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)
Exemplo n.º 6
0
Arquivo: gui.py Projeto: 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')})