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

fobj : io.FileIO

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

model : Model, optional

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

resolve : bool, 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.

build : bool, 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.