:py:mod:`whist_core.cards.card` =============================== .. py:module:: whist_core.cards.card .. autoapi-nested-parse:: Card related classes Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: whist_core.cards.card._CardEnum whist_core.cards.card.Suit whist_core.cards.card.Rank whist_core.cards.card.Card .. py:class:: _CardEnum(_: str, short_name: Optional[str] = None) Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:property:: ordinal :type: int Get the ordinal. :return: ordinal .. py:property:: long_name :type: str Get the long version of the name. :return: long version of name .. py:property:: short_name :type: str Get the short version of the name. :return: short version of name .. py:method:: _missing_(value: Any) -> Optional[_CardEnum] :classmethod: .. py:method:: __lt__(other: Any) -> bool Return self str Return str(self). .. py:class:: Suit(_: str, short_name: Optional[str] = None) Bases: :py:obj:`_CardEnum` Suits in a playing card deck .. py:attribute:: CLUBS :value: ('clubs', '♣') .. py:attribute:: DIAMONDS :value: ('diamonds', '♦') .. py:attribute:: HEARTS :value: ('hearts', '♥') .. py:attribute:: SPADES :value: ('spades', '♠') .. py:class:: Rank(_: str, short_name: Optional[str] = None) Bases: :py:obj:`_CardEnum` Ranks in a playing card deck .. py:attribute:: NUM_2 :value: '2' .. py:attribute:: NUM_3 :value: '3' .. py:attribute:: NUM_4 :value: '4' .. py:attribute:: NUM_5 :value: '5' .. py:attribute:: NUM_6 :value: '6' .. py:attribute:: NUM_7 :value: '7' .. py:attribute:: NUM_8 :value: '8' .. py:attribute:: NUM_9 :value: '9' .. py:attribute:: NUM_10 :value: '10' .. py:attribute:: J :value: ('jack', 'J') .. py:attribute:: Q :value: ('queen', 'Q') .. py:attribute:: K :value: ('king', 'K') .. py:attribute:: A :value: ('ace', 'A') .. py:class:: Card Bases: :py:obj:`pydantic.BaseModel` A playing card .. py:property:: short_name :type: str Get the short name of this card. :return: short name .. py:property:: name :type: str Get the name of this card. :return: name .. py:attribute:: suit :type: Suit .. py:attribute:: rank :type: Rank .. py:method:: all_cards() -> Iterator[Card] :staticmethod: Get iterator of all cards. :return: all cards .. py:method:: dict(*args, **kwargs) Returns the dictionary. See BaseModel for details. .. py:method:: model_dump(*args, **kwargs) Returns the dictionary. See BaseModel for details. .. py:method:: __lt__(other: Any) -> bool Checks if the other card is lower than this card. .. py:method:: __str__() -> str Returns string representation of this card.