finesse.script.compiler.KatCompiler.compile_file

KatCompiler.compile_file(fobj, model=None, resolve=True, build=True)[source]

Compile the contents of the specified file.

Parameters:
fobjio.FileIO

The file object to compile kat script from. This should be opened in text mode.

modelModel, optional

An existing model to compile the contents of fobj into. If not specified, a new, empty model is created.

resolvebool, optional

Resolve the parsed script. If False, the parsed contents is added to graph but no sanity checks are performed and nothing is returned. Defaults to True.

buildbool, optional

Build the parsed script. If False, no Finesse objects will be added to the model and nothing will be returned. Defaults to True.

Returns:
Model or None

If resolve and build are True, the model compiled from reading fobj; None otherwise.

Raises:
KatSyntaxError

If a syntax error is present in the contents of fobj.