Skip to content

erdantic.examples.dataclasses

Example data model classes using standard library's dataclasses module.

Classes

Adventurer dataclass

A person often late for dinner but with a tale or two to tell.

Attributes:

Name Type Description
name str

Name of this adventurer

profession str

Profession of this adventurer

level int

Level of this adventurer

alignment Alignment

Alignment of this adventurer

alignment: Alignment dataclass-field
level: int dataclass-field
name: str dataclass-field
profession: str dataclass-field
__init__(self, name: str, profession: str, level: int, alignment: Alignment) -> None special

Alignment

An enumeration.

CHAOTIC_EVIL
CHAOTIC_GOOD
CHAOTIC_NEUTRAL
LAWFUL_EVIL
LAWFUL_GOOD
LAWFUL_NEUTRAL
NEUTRAL_EVIL
NEUTRAL_GOOD
TRUE_NEUTRAL

Party dataclass

A group of adventurers finding themselves doing and saying things altogether unexpected.

Attributes:

Name Type Description
name str

Name that party is known by

formed_datetime datetime

Timestamp of when the party was formed

members List[Adventurer]

Adventurers that belong to this party

active_quest Optional[Quest]

Current quest that party is actively tackling

active_quest: Optional[erdantic.examples.dataclasses.Quest] dataclass-field
formed_datetime: datetime dataclass-field
members: List[erdantic.examples.dataclasses.Adventurer] dataclass-field
name: str dataclass-field
__init__(self, name: str, formed_datetime: datetime, members: List[erdantic.examples.dataclasses.Adventurer], active_quest: Optional[erdantic.examples.dataclasses.Quest]) -> None special

Quest dataclass

A task to complete, with some monetary reward.

Attributes:

Name Type Description
name str

Name by which this quest is referred to

giver QuestGiver

Person who offered the quest

reward_gold int

Amount of gold to be rewarded for quest completion

giver: QuestGiver dataclass-field
name: str dataclass-field
reward_gold: int dataclass-field
__init__(self, name: str, giver: QuestGiver, reward_gold: int) -> None special

QuestGiver dataclass

A person who offers a task that needs completing.

Attributes:

Name Type Description
name str

Name of this quest giver

faction str

Faction that this quest giver belongs to

location str

Location this quest giver can be found

faction: Optional[str] dataclass-field
location: str dataclass-field
name: str dataclass-field
__init__(self, name: str, faction: Optional[str], location: str) -> None special
Back to top