Beispiel #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,
         )
Beispiel #2
0
	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
Beispiel #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'))
Beispiel #4
0
 def serialize_application_result(self, application_result):
     return yaml.dump(application_result)
Beispiel #5
0
 def saves(self, dict_of_dicts):
     return yaml.dump(self.__remove_instances(dict_of_dicts))
Beispiel #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))
Beispiel #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)