fabricatio_team.models.team

This module contains the models for the team.

Classes

Team

A class representing a team of mates.

Module Contents

class fabricatio_team.models.team.Team

A class representing a team of mates.

Example

from fabricatio_core import Role
from fabricatio_team.models import Team

# Create roles
role1 = Role.with_bio(name="Role1")
role2 = Role.with_bio(name="Role2")

# define the role that needs the member info
class MyRole(Cooperate):
    ...

# Create a team
team = Team(members={"Role1", "Role2"}).join(MyRole(name="MyRole"))

# Inform the team members about each other accordingly
team.inform()
members: Set[fabricatio_core.models.role.RoleName]

The team members.

join(teammate: fabricatio_core.Role | fabricatio_core.models.role.RoleName) Self

Adds a teammate to the team.

Parameters:

teammate – The mate to be added to the team.

Raises:

ValueError – If the teammate is already a member of the team.

resign(teammate: fabricatio_core.Role | fabricatio_core.models.role.RoleName) Self

Removes a teammate from the team.

Parameters:

teammate – The mate to be removed from the team.

Raises:

ValueError – If the teammate is not a member of the team.

inform() Self

Updates teammates information for informed members.

Returns:

The updated team instance.

dispatch(resolve_config: bool = True) Self

Dispatches the team members.

Returns:

The updated team instance.