aac.context.language_context

The LanguageContext is a singleton that holds the current state of the AaC language, including all definitions and plugin runners.

Classes

LanguageContext()

A singleton class that holds the current state of the AaC language.

class aac.context.language_context.LanguageContext[source]

A singleton class that holds the current state of the AaC language.

static __new__(cls)[source]

Create a new instance of the LanguageContext singleton class.

create_aac_enum(aac_enum_name: str, value: str) Any[source]

Function to create a python instance of an AaC enum class and value.

Parameters:
  • aac_enum_name (str)

  • value (str)

Return type:

Any

create_aac_object(aac_type_name: str, attributes: dict) Any[source]

Function to create a python instance of an AaC class and attributes.

Parameters:
  • aac_type_name (str)

  • attributes (dict)

Return type:

Any

get_aac_core_as_yaml() str[source]

Function to return the AaC language as a yaml string.

Return type:

str

get_aac_core_definitions() list[Definition][source]

Function to return the definitions for the AaC language.

Return type:

list[Definition]

get_aac_core_file_path() str[source]

Function to return the AaC language file path.

Return type:

str

get_defining_schema_for_root(root_key: str) Definition[source]

Get the defining schema for a given root key.

Parameters:

root_key (str)

Return type:

Definition

get_definitions() list[Definition][source]

Get all the definitions.

Return type:

list[Definition]

get_definitions_by_name(name: str) list[Definition][source]

Get all the definitions with a given name.

Parameters:

name (str)

Return type:

list[Definition]

get_definitions_by_root(root_key: str) list[Definition][source]

Get all the definitions with a given root key.

Parameters:

root_key (str)

Return type:

list[Definition]

get_definitions_of_type(package: str, name: str) list[Definition][source]

Search the language context to find definitions that match a given package and name.

Parameters:
  • package (str)

  • name (str)

Return type:

list[Definition]

get_plugin_runners() list[PluginRunner][source]

Get all the plugin runners.

Return type:

list[PluginRunner]

get_primitives() list[Definition][source]

Get all the primitive definitions.

Return type:

list[Definition]

get_python_type_from_primitive(primitive_name: str) str[source]

Get the python type from a primitive name.

Parameters:

primitive_name (str)

Return type:

str

get_values_by_field_chain(search_term: str) list[source]

Find values from the language context using a dot notation field chain.

Parameters:

search_term (str)

Return type:

list

is_aac_instance(obj: Any, name: str)[source]

Function to determine if an object is an instance of an AaC class.

Parameters:
  • obj (Any)

  • name (str)

is_extension_of(check_me: Definition, package: str, name: str) bool[source]

Check to see if a given definition extends from a given package and name.

Parameters:
Return type:

bool

parse_and_load(arg: str) list[Definition][source]

Convenience function that parses a file or string and loads the definitions into the context.

Parameters:

arg (str)

Return type:

list[Definition]

register_plugin_runner(runner: PluginRunner) None[source]

Register a plugin runner.

Parameters:

runner (PluginRunner)

Return type:

None

remove_definitions(definitions: list[Definition]) None[source]

Remove the given definitions from the context.

Parameters:

definitions (list[Definition])

Return type:

None