示例#1
0
 def storeAll(self):
     if not os.path.exists('config_history'):
         os.mkdir('config_history')
     bk_filename = os.path.join(
         'config_history', '.'.join([
             self.filepath,
             datetime.now().strftime('%Y%m%d_%H%M%S')
         ]))
     shutil.copy(self.filepath, bk_filename)
     with open(self.filepath, 'w') as stream:
         yaml.dump(
             self.config,
             stream=stream,
             allow_unicode=True,
             default_flow_style=False,
             sort_keys=False,
         )
示例#2
0
文件: config.py 项目: typecode/voxpop
	def load(cls):
		config_url = 'config/config.yaml'
		stream = file(config_url, 'r')
	 	mode = 'dev'
		cls.data = yaml.load(stream)
		logging.info("Loaded Configuration File("+config_url+") with contents:\n" + str(yaml.dump(cls.data)))
		cls.data['base_url'] = cls.base_url()
		cls.data['mode'] = mode
示例#3
0
def dump(data):
  if not CACHE_DUMP:
    return
  if not os.path.exists(CACHE_PATH):
    os.mkdir(CACHE_PATH)
  if data['cachable']:
    h = hashlib.sha1()
    with open(data['file_path']) as f:
      h.update(f.read())
    for i in data['includes']['paths']:
      with open(i) as f:
        h.update(f.read())
    data['sha'] = h.hexdigest()
    data['version'] = getVersion()
    # curdir = <dsn>/script
    del data['preprocessed']
    del data['cachable']
    file = cache_path(data['file_path'])
    yaml.dump(data, open(file, 'w'))
示例#4
0
 def serialize_application_result(self, application_result):
     return yaml.dump(application_result)
示例#5
0
 def saves(self, dict_of_dicts):
     return yaml.dump(self.__remove_instances(dict_of_dicts))
示例#6
0
def dump_cache(db):
    cache_file = os.path.join(gloval.get_homedir(), 'tmp/cache_image.yaml')
    fp = open(cache_file, 'w')
    cache = yaml.dump(db, fp)
    fp.close()
 def serialize_application_result(self, application_result):
     return yaml.dump(application_result)
 def saves(self, dict_of_dicts):
     return yaml.dump(self.__remove_instances(dict_of_dicts))
示例#9
0
def dump(iContent):
  path = os.path.join(os.path.dirname(__file__), 'data', 'pkg_info.yaml')
  with open(path, 'w') as f:
    yaml.dump(iContent, f)