Source code for aac.plugins.constraint_assignment_arguments
"""__init__.py module for the Constraint Assignment Arguments plugin."""# WARNING - DO NOT EDIT - YOUR CHANGES WILL NOT BE PROTECTED.# This file is auto-generated by the aac gen-plugin and may be overwritten.fromos.pathimportjoin,dirnamefromtypingimportAnyfromaac.execute.aac_execution_resultimport(ExecutionResult,)fromaac.executeimporthookimplfromaac.context.language_contextimportLanguageContextfromaac.context.definitionimportDefinitionfromaac.execute.plugin_runnerimportPluginRunnerfromaac.plugins.constraint_assignment_arguments.constraint_assignment_arguments_implimport(plugin_name,)fromaac.plugins.constraint_assignment_arguments.constraint_assignment_arguments_implimport(check_arguments_against_constraint_definition,)constraint_assignment_arguments_aac_file_name="constraint_assignment_arguments.aac"
[docs]defrun_check_arguments_against_constraint_definition(instance:Any,definition:Definition,defining_schema,arguments:Any)->ExecutionResult:"""Ensures the arguments provided in the assignment match the arguments defined in the constraint definition."""returncheck_arguments_against_constraint_definition(instance,definition,defining_schema)
[docs]@hookimpldefregister_plugin()->None:""" Returns information about the plugin. Returns: A collection of information about the plugin and what it contributes. """active_context=LanguageContext()constraint_assignment_arguments_aac_file=join(dirname(__file__),constraint_assignment_arguments_aac_file_name)definitions=active_context.parse_and_load(constraint_assignment_arguments_aac_file)constraint_assignment_arguments_plugin_definition=[definitionfordefinitionindefinitionsifdefinition.name==plugin_name][0]plugin_instance=constraint_assignment_arguments_plugin_definition.instanceforfile_to_loadinplugin_instance.definition_sources:active_context.parse_and_load(file_to_load)plugin_runner=PluginRunner(plugin_definition=constraint_assignment_arguments_plugin_definition)plugin_runner.add_constraint_callback("Check arguments against constraint definition",run_check_arguments_against_constraint_definition,)active_context.register_plugin_runner(plugin_runner)