B-UML Code Builder#

besser.utilities.buml_code_builder.agent_model_to_code(model: Agent, file_path: str)[source]#

Generates Python code for a B-UML Agent model and writes it to a specified file.

Parameters: model (Agent): The B-UML Agent model object containing states, intents, and transitions. file_path (str): The path where the generated code will be saved.

Outputs: - A Python file containing the code representation of the B-UML agent model.

besser.utilities.buml_code_builder.domain_model_to_code(model: DomainModel, file_path: str)[source]#

Generates Python code for a B-UML model and writes it to a specified file.

Parameters:
  • model (DomainModel) – The B-UML model object containing classes, enumerations, associations, and generalizations.

  • file_path (str) – The path where the generated code will be saved.

Outputs:
  • A Python file containing the base code representation of the B-UML domain model.

besser.utilities.buml_code_builder.safe_class_name(name)[source]#

Add a suffix to class names that match reserved keywords or BUML metaclass names. If the name already ends with an underscore and would conflict with a reserved name, add a numeric suffix instead.

Parameters: name (str): The original class name

Returns: str: A safe variable name for the class