blark.input.load_file_by_name

blark.input.load_file_by_name(filename: str | Path, input_format: str | None = None) list[BlarkSourceItem | BlarkCompositeSourceItem][source]

Load a file using blark’s file input handlers.

Parameters:
filenamepathlib.Path or str

The filename to load.

input_formatstr, optional

Optionally specify the loader to use, if auto-detection based on filename is insufficient. This may be either the loader name (e.g., “plain”) or an equivalent filename extension (e.g., “.tcpou”)

Returns:
list[BlarkSourceItem | BlarkCompositeSourceItem]

A list of items that were loaded, which may be either singular (BlarkSourceItem) or composite (BlarkCompositeSourceItem). An example of a composite file is a Beckhoff TwinCAT TcPOU file, which may contain a declaration, implementation, and a number of properties/methods/actions each with their own grammar rules).