nemoguardrails.colang
Subpackages
Submodules
Package Contents
Functions
Data
API
Checks if the content of a file is in Colang 2.x format.
This function uses a simple heuristic to determine if the content is a Colang 2.x file. Initially, it removes comments and content within triple quotes, as these could potentially contain misleading keywords. Then, it checks for the presence of certain keywords in the content:
- If the keyword
importis present, the content is likely a Colang 2.x file. - If the keyword
defineis present at the beginning of a line, the content is likely a Colang 1.0 file.
Parameters:
content
The content of the file to check.
Returns:
True if the content is likely a Colang 2.x file, False otherwise.
Parse the content of a .co file into the CoYML format.
Parse the flow elements from CoYML format to CIL.