1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 23:03:00 +00:00
fftcgtool/fftcg/cards.py

25 lines
542 B
Python
Raw Normal View History

2021-08-23 14:00:17 +00:00
import re
2021-08-09 05:01:25 +00:00
from .card import Card
2021-08-03 21:41:25 +00:00
2021-08-09 03:32:05 +00:00
class Cards(list[Card]):
2021-08-20 22:16:38 +00:00
def __init__(self, name, cards: list[Card] = None):
if cards is None:
cards = []
2021-08-18 11:49:34 +00:00
2021-08-20 22:16:38 +00:00
super().__init__(cards)
2021-08-18 11:49:34 +00:00
self.__name = name
def __str__(self) -> str:
return f"[{', '.join(str(card) for card in self)}]"
2021-08-18 14:52:32 +00:00
@property
def name(self) -> str:
return self.__name
@property
def file_name(self) -> str:
2021-08-23 14:00:17 +00:00
val = self.name.lower().replace(" ", "_")
return re.sub(r"[^\w]", "", val, flags=re.UNICODE)