mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 15:02:59 +00:00
27 lines
600 B
Python
27 lines
600 B
Python
import re
|
|
|
|
from .card import Card
|
|
|
|
|
|
class Cards(list[Card]):
|
|
def __init__(self, name, cards: list[Card] = None):
|
|
if cards is None:
|
|
cards = []
|
|
|
|
super().__init__(cards)
|
|
self.__name = name
|
|
|
|
def __repr__(self) -> str:
|
|
return f"[{', '.join(str(card) for card in self)}]"
|
|
|
|
def __str__(self) -> str:
|
|
return repr(self)
|
|
|
|
@property
|
|
def name(self) -> str:
|
|
return self.__name
|
|
|
|
@property
|
|
def file_name(self) -> str:
|
|
val = self.name.lower().replace(" ", "_")
|
|
return re.sub(r"[^\w]", "", val, flags=re.UNICODE)
|