def open_api(json_path): path = get_header(json_path) try: apispec = json.read_file(path) except OSError as error: raise Error(("[Errno %d]: %s\n" % (error.errno, path)).decode('utf-8')) api = Api(apispec.getitem(String(u"constants")), apispec.getitem(String(u"types")), apispec.getitem(String(u"variables"))) return api
def open_api(json_path, dependencies, decorator): path = get_header(json_path) try: apispec = json.read_file([path]) except OSError as error: raise OldError(u"[Errno %d]: %s\n" % (error.errno, pathobj.stringify(path))) api = Api(apispec.getitem(String(u"constants")), apispec.getitem(String(u"types")), apispec.getitem(String(u"variables")), dependencies, decorator) return api
def open_api(json_path): path = get_header(json_path) try: apispec = json.read_file(path) except OSError as error: raise Error(("[Errno %d]: %s\n" % (error.errno, path)).decode('utf-8')) api = Api( apispec.getitem(String(u"constants")), apispec.getitem(String(u"types")), apispec.getitem(String(u"variables"))) return api
def open_api(json_path, dependencies, decorator): path = get_header(json_path) try: apispec = json.read_file([path]) except OSError as error: raise OldError(u"[Errno %d]: %s\n" % (error.errno, pathobj.stringify(path))) api = Api( apispec.getitem(String(u"constants")), apispec.getitem(String(u"types")), apispec.getitem(String(u"variables")), dependencies, decorator) return api
def read_file(path, dependencies, decorator): basename = path.getattr(u"basename") if isinstance(basename, String): if not basename.string.endswith(u".json"): dirname = path.getattr(u"dirname") path = pathobj.concat(dirname, pathobj.parse(basename.string + u".json")) path = pathobj.concat(conf.headers_dir, path) try: apispec = json.read_file(path) except OSError as error: raise OldError(u"[Errno %d]: %s\n" % (error.errno, pathobj.stringify(path))) return read_object(apispec, dependencies, decorator)
def read_file(path, dependencies, decorator): basename = path.getattr(u"basename") if isinstance(basename, String): if not basename.string.endswith(u".json"): path.setattr( u"basename", String(basename.string + u".json")) path = pathobj.concat(conf.headers_dir, path) try: apispec = json.read_file(path) except OSError as error: raise OldError(u"[Errno %d]: %s\n" % (error.errno, pathobj.stringify(path))) return read_object(apispec, dependencies, decorator)