Skip to content

autonomy.cli.scaffold_fsm

Implement a scaffold sub-command to scaffold ABCI skills.

This module patches the 'aea scaffold' command so to add a new subcommand for scaffolding a skill starting from FSM specification.

AbstractFileGenerator Objects

class AbstractFileGenerator(ABC)

An abstract class for file generators.

__init__

def __init__(ctx: Context, skill_name: str, dfa: DFA) -> None

Initialize the abstract file generator.

get_file_content

@abstractmethod
def get_file_content() -> str

Get file content.

write_file

def write_file(output_dir: Path) -> None

Write the file to output_dir/FILENAME.

abci_app_name

@property
def abci_app_name() -> str

ABCI app class name

fsm_name

@property
def fsm_name() -> str

FSM base name

author

@property
def author() -> str

Author

all_rounds

@property
def all_rounds() -> List[str]

Rounds

degenerate_rounds

@property
def degenerate_rounds() -> List[str]

Degenerate rounds

rounds

@property
def rounds() -> List[str]

Non-degenerate rounds

base_names

@property
def base_names() -> List[str]

Base names

behaviours

@property
def behaviours() -> List[str]

Behaviours

payloads

@property
def payloads() -> List[str]

Payloads

template_kwargs

@property
def template_kwargs() -> Dict[str, str]

All keywords for string formatting of templates

SimpleFileGenerator Objects

class SimpleFileGenerator(AbstractFileGenerator)

For files that require minimal formatting

get_file_content

def get_file_content() -> str

Get the file content.

RoundFileGenerator Objects

class RoundFileGenerator(AbstractFileGenerator,  ROUNDS)

File generator for 'rounds.py' modules.

get_file_content

def get_file_content() -> str

Scaffold the 'rounds.py' file.

BehaviourFileGenerator Objects

class BehaviourFileGenerator(AbstractFileGenerator,  BEHAVIOURS)

File generator for 'behaviours.py' modules.

get_file_content

def get_file_content() -> str

Scaffold the 'behaviours.py' file.

PayloadsFileGenerator Objects

class PayloadsFileGenerator(AbstractFileGenerator,  PAYLOADS)

File generator for 'payloads.py' modules.

get_file_content

def get_file_content() -> str

Get the file content.

ModelsFileGenerator Objects

class ModelsFileGenerator(SimpleFileGenerator,  MODELS)

File generator for 'models.py' modules.

HandlersFileGenerator Objects

class HandlersFileGenerator(SimpleFileGenerator,  HANDLERS)

File generator for 'handlers.py' modules.

DialoguesFileGenerator Objects

class DialoguesFileGenerator(SimpleFileGenerator,  DIALOGUES)

File generator for 'dialogues.py' modules.

SkillConfigUpdater Objects

class SkillConfigUpdater()

Update the skill configuration according to the Abci classes.

__init__

def __init__(ctx: Context, skill_dir: Path, dfa: DFA) -> None

Initialize the skill config updater.

Arguments:

  • ctx: the AEA CLI context object.
  • skill_dir: the directory of the AEA skill package.
  • dfa: the DFA object.

update

def update() -> None

Update the skill configuration file.

RoundTestsFileGenerator Objects

class RoundTestsFileGenerator(AbstractFileGenerator,  TEST_ROUNDS)

RoundTestsFileGenerator

get_file_content

def get_file_content() -> str

Scaffold the 'test_rounds.py' file.

BehaviourTestsFileGenerator Objects

class BehaviourTestsFileGenerator(AbstractFileGenerator,  TEST_BEHAVIOURS)

File generator for 'test_behaviours.py' modules.

get_file_content

def get_file_content() -> str

Scaffold the 'test_behaviours.py' file.

PayloadTestsFileGenerator Objects

class PayloadTestsFileGenerator(AbstractFileGenerator,  TEST_PAYLOADS)

File generator for 'test_payloads.py' modules.

get_file_content

def get_file_content() -> str

Scaffold the 'test_payloads.py' file.

ModelTestFileGenerator Objects

class ModelTestFileGenerator(SimpleFileGenerator,  TEST_MODELS)

File generator for 'test_models.py'.

HandlersTestFileGenerator Objects

class HandlersTestFileGenerator(SimpleFileGenerator,  TEST_HANDLERS)

File generator for 'test_dialogues.py'.

DialoguesTestFileGenerator Objects

class DialoguesTestFileGenerator(SimpleFileGenerator,  TEST_DIALOGUES)

File generator for 'test_dialogues.py'.

ScaffoldABCISkill Objects

class ScaffoldABCISkill()

Utility class that implements the scaffolding of the ABCI skill.

__init__

def __init__(ctx: Context, skill_name: str, dfa: DFA) -> None

Initialize the utility class.

skill_dir

@property
def skill_dir() -> Path

Get the directory to the skill.

skill_test_dir

@property
def skill_test_dir() -> Path

Get the directory to the skill tests.

do_scaffolding

def do_scaffolding() -> None

Do the scaffolding.

fsm

@scaffold.command()  # noqa
@registry_flag()
@click.argument("skill_name", type=str, required=True)
@click.option("--spec", type=click.Path(exists=True, dir_okay=False), required=True)
@pass_ctx
def fsm(ctx: Context, registry: str, skill_name: str, spec: str) -> None

Add an ABCI skill scaffolding from an FSM specification.

Back to top