whist_core.cards.card

Card related classes

Module Contents

Classes

_CardEnum

Generic enumeration.

Suit

Suits in a playing card deck

Rank

Ranks in a playing card deck

Card

A playing card

class whist_core.cards.card._CardEnum(_: str, short_name: str | None = None)

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

property ordinal: int

Get the ordinal.

Returns:

ordinal

property long_name: str

Get the long version of the name.

Returns:

long version of name

property short_name: str

Get the short version of the name.

Returns:

short version of name

classmethod _missing_(value: Any) _CardEnum | None
__lt__(other: Any) bool

Return self<value.

__str__() str

Return str(self).

class whist_core.cards.card.Suit(_: str, short_name: str | None = None)

Bases: _CardEnum

Suits in a playing card deck

CLUBS = ('clubs', '♣')
DIAMONDS = ('diamonds', '♦')
HEARTS = ('hearts', '♥')
SPADES = ('spades', '♠')
class whist_core.cards.card.Rank(_: str, short_name: str | None = None)

Bases: _CardEnum

Ranks in a playing card deck

NUM_2 = '2'
NUM_3 = '3'
NUM_4 = '4'
NUM_5 = '5'
NUM_6 = '6'
NUM_7 = '7'
NUM_8 = '8'
NUM_9 = '9'
NUM_10 = '10'
J = ('jack', 'J')
Q = ('queen', 'Q')
K = ('king', 'K')
A = ('ace', 'A')
class whist_core.cards.card.Card

Bases: pydantic.BaseModel

A playing card

property short_name: str

Get the short name of this card.

Returns:

short name

property name: str

Get the name of this card.

Returns:

name

suit: Suit
rank: Rank
static all_cards() Iterator[Card]

Get iterator of all cards.

Returns:

all cards

dict(*args, **kwargs)

Returns the dictionary. See BaseModel for details.

model_dump(*args, **kwargs)

Returns the dictionary. See BaseModel for details.

__lt__(other: Any) bool

Checks if the other card is lower than this card.

__str__() str

Returns string representation of this card.