Beispiel #1
0
 def load_json(self, f):
     from json import load
     if isinstance(f, basestring):
         with file(f, 'r') as fp:
             return load(fp)
     else:
         return load(f)
Beispiel #2
0
 def load_json(self, f):
     from json import load
     if isinstance(f, basestring):
         with file(f, 'r') as fp:
             return load(fp)
     else:
         return load(f)
Beispiel #3
0
 def load_raml(self, f):
     if isinstance(f, basestring):
         from pyraml.parser import load
         return load(f)
     else:
         from pyraml.parser import parse
         return parse(f.read(), dirname(f.name))
Beispiel #4
0
 def load_raml(self, f):
     if isinstance(f, basestring):
         from pyraml.parser import load
         return load(f)
     else:
         from pyraml.parser import parse
         return parse(f.read(), dirname(f.name))
Beispiel #5
0
    def parse(self):
        """ Parse the RAML file and return the InternalNode hierarchy from it """
        description = prp.load(self.file)

        root = InternalNode("", None)

        if '/' in description.resources:
            res = description.resources['/']
            del description.resources['/']

            if res is not None:
                #FIXME: this duplicate code from _parse_resource
                if res.methods is not None:
                    for method in res.methods:
                        root.add_method(method)

                root.set_doc(res.description)

        if description.resources is not None:
            for name in description.resources:
                res = description.resources[name]
                self._parse_resource(root, name, res)

        return root
Beispiel #6
0
def _load_all_definitions(definition_path):
    if not definition_path:
        raise ValueError('Missing setting value" `RAML_PATH`.')
    return parser.load(definition_path)
Beispiel #7
0
 def load(self, *parts):
     path = self.sample_path(*parts)
     return parser.load(path)
Beispiel #8
0
 def load(self, *parts):
     path = self.sample_path(*parts)
     return parser.load(path)