Beispiel #1
0
    def parse(self, path):
        if not os.path.exists(path):
            raise RuntimeError('cannot find %r' % path)

        try:
            data = Format.read(path)
        except Exception:
            raise RuntimeError('cannot parse %r' % path)

        if data:
            self.merge(data)
        return self
Beispiel #2
0
 def write(self, path, value, format=None, **params):
     value = self.process(value, OUTGOING, True)
     Format.write(path, value, format, **params)
Beispiel #3
0
 def write(self, path, format=None, **params):
     Format.write(path, self.environment, format, **params)
     return self
Beispiel #4
0
 def read(self, path, **params):
     data = Format.read(path, **params)
     return self.process(data, INCOMING, True)