yasuki_core.accounts.decks.to_yaml#

to_yaml(cards, *, name='Untitled Deck', author=None, date=None, donor_names=None)[source]#

Serialize deck cards to the interchange YAML parse_deck_yaml reads back.

Within each section cards sort by name then set for a stable export. An art-swap renders as the {art: Donor [Set]} trailer; the donor’s display name comes from donor_names (its slug is a graceful fallback), since the row stores only the donor’s id.

Parameters:
cardslist of DeckCard

The deck to write.

namestr, optional

The deck name for the name: line. Default ‘Untitled Deck’.

authorstr, optional

Written as an author: line when given. Default None.

datestr, optional

Written as a date: line when given. Default None.

donor_namesdict mapping str to str, optional

Art-swap donor card id to display name. Default None (donors render by id).

Returns:
yamlstr

The decklist text, newline-terminated.