Ejemplo n.º 1
0
def touch_file(filename):
    """
    Like mkdir -p && touch
    """
    sysutils.mkdirp_writable(os.path.dirname(filename))
    if not os.path.exists(filename):
        open(filename, 'a').close()
Ejemplo n.º 2
0
def touch_file(filename):
    """
    Like mkdir -p && touch
    """
    sysutils.mkdirp_writable(os.path.dirname(filename))
    if not os.path.exists(filename):
        open(filename, 'a').close()
Ejemplo n.º 3
0
 def save(self, newdata=None):
     " Write the contents of the data cache to the file. "
     if newdata is not None:
         assert isinstance(newdata, dict)
         self.data = newdata
     fpath = os.path.split(self._filename)[0]
     if len(fpath):
         sysutils.mkdirp_writable(fpath)
     open(self._filename, 'w').write(yaml.dump(self.data, default_flow_style=False))
Ejemplo n.º 4
0
 def save(self, newdata=None):
     " Write the contents of the data cache to the file. "
     if newdata is not None:
         assert isinstance(newdata, dict)
         self.data = newdata
     fpath = os.path.split(self._filename)[0]
     if len(fpath):
         sysutils.mkdirp_writable(fpath)
     with open(self._filename, 'w') as fn:
         self.yaml.dump(self.data, fn)
Ejemplo n.º 5
0
 def save(self, newdata=None):
     " Write the contents of the data cache to the file. "
     if newdata is not None:
         assert isinstance(newdata, dict)
         self.data = newdata
     fpath = os.path.split(self._filename)[0]
     if len(fpath):
         sysutils.mkdirp_writable(fpath)
     open(self._filename,
          'w').write(yaml.dump(self.data, default_flow_style=False))