# Path: poker/_common.py
# class PokerEnum(_OrderableMixin, enum.Enum, metaclass=_PokerEnumMeta):
#     def __str__(self):
#         return str(self._value_[0])
# 
#     def __repr__(self):
#         val = self._value_[0]
#         apostrophe = "'" if isinstance(val, str) else ""
#         return f"{self.__class__.__name__}({apostrophe}{val}{apostrophe})"
# 
#     def __format__(self, format_spec):
#         return str(self._value_[0])
# 
#     @property
#     def val(self):
#         """The first value of the Enum member."""
#         return self._value_[0]
# 
# class _ReprMixin:
#     def __repr__(self):
#         return f"{self.__class__.__name__}('{self}')"


import itertools
from functools import total_ordering
from ._common import PokerEnum, _ReprMixin
        rank_list = list(cls)
        return abs(rank_list.index(first) - rank_list.index(second))


FACE_RANKS = Rank("J"), Rank("Q"), Rank("K")

BROADWAY_RANKS = Rank("T"), Rank("J"), Rank("Q"), Rank("K"), Rank("A")


class _CardMeta(type):
    def __new__(metacls, clsname, bases, classdict):
        """Cache all possible Card instances on the class itself."""
        cls = super(_CardMeta, metacls).__new__(metacls, clsname, bases, classdict)
        cls._all_cards = list(
            cls(f"{rank}{suit}") for rank, suit in itertools.product(Rank, Suit)
        )
        return cls

    def make_random(cls):
        """Returns a random Card instance."""
        self = object.__new__(cls)
        self.rank = Rank.make_random()
        self.suit = Suit.make_random()
        return self

    def __iter__(cls):
        return iter(cls._all_cards)


@total_ordering

# Path: poker/_common.py
# class PokerEnum(_OrderableMixin, enum.Enum, metaclass=_PokerEnumMeta):
#     def __str__(self):
#         return str(self._value_[0])
# 
#     def __repr__(self):
#         val = self._value_[0]
#         apostrophe = "'" if isinstance(val, str) else ""
#         return f"{self.__class__.__name__}({apostrophe}{val}{apostrophe})"
# 
#     def __format__(self, format_spec):
#         return str(self._value_[0])
# 
#     @property
#     def val(self):
#         """The first value of the Enum member."""
#         return self._value_[0]
# 
# class _ReprMixin:
#     def __repr__(self):
#         return f"{self.__class__.__name__}('{self}')"


# Path: poker/card.py
import itertools
from functools import total_ordering
from ._common import PokerEnum, _ReprMixin

        rank_list = list(cls)
        return abs(rank_list.index(first) - rank_list.index(second))


FACE_RANKS = Rank("J"), Rank("Q"), Rank("K")

BROADWAY_RANKS = Rank("T"), Rank("J"), Rank("Q"), Rank("K"), Rank("A")


class _CardMeta(type):
    def __new__(metacls, clsname, bases, classdict):
        """Cache all possible Card instances on the class itself."""
        cls = super(_CardMeta, metacls).__new__(metacls, clsname, bases, classdict)
        cls._all_cards = list(
            cls(f"{rank}{suit}") for rank, suit in itertools.product(Rank, Suit)
        )
        return cls

    def make_random(cls):
        """Returns a random Card instance."""
        self = object.__new__(cls)
        self.rank = Rank.make_random()
        self.suit = Suit.make_random()
        return self

    def __iter__(cls):
        return iter(cls._all_cards)


@total_ordering

class Card(_ReprMixin, metaclass=_CardMeta):