Files
revng-revng/python/revng/model
Giacomo Vercesi 116d965117 revng.model: implement kw_only
Implement a constructor override for model classes that checks that the
constructor does not have positional arguments passed to it. This can
be dropped post-3.10 since it is implemented natively by kw_only.
2022-07-22 14:56:15 +02:00
..
2022-07-22 14:56:15 +02:00

rev.ng model classes

By default, importing the top level package will expose the classes for the latest version of the model.

Example: deserializing a model

import yaml
from revng import model as m

with open("/path/to/model.yaml") as f:
    model = yaml.load(f, Loader=m.YamlLoader)

If you need to access a specific version of the model you can import it like so:

import yaml
from revng.model import v1

yaml.load(..., Loader=v1.YamlLoader)