CardSetCollection
Bases: UserDict
Represents a collection of card sets, stored by identifier.
Note
This class inherits collections.UserDict
, and thus supports any common
dict
methods.
Attributes:
Name | Type | Description |
---|---|---|
data |
dict[str, CardSet]
|
The mapping of |
editions()
¶
Returns the set of all card set editions within this card set collection.
Returns:
Type | Description |
---|---|
list[str]
|
A unique |
from_csv(csvstr, delimiter='\t')
staticmethod
¶
Creates a new card set collection given a CSV string representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
csvstr |
str
|
The CSV string representation to parse. |
required |
delimiter |
str
|
An optional |
'\t'
|
Returns:
Type | Description |
---|---|
CardSetCollection
|
A new |
from_json(jsonstr)
staticmethod
¶
Creates a new card set collection given a JSON string representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
jsonstr |
str
|
The JSON string representation to parse. |
required |
Returns:
Type | Description |
---|---|
CardSetCollection
|
A new |
get_release_date(card)
¶
Returns the release date for the specified card by looking up its card set(s).
Note
The earliest date will be returned for cards released more than once.
This method returns None
if no release date is found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
card |
Card
|
The card to obtain the release date of. |
required |
Returns:
Type | Description |
---|---|
Optional[datetime.date]
|
The release date of the specified card, or |
identifiers()
¶
Returns the set of all card set identifiers within this card set collection.
Returns:
Type | Description |
---|---|
list[str]
|
The unique |
load(file_path, set_catalog=False)
staticmethod
¶
Loads a card set collection from the specified .json
or .csv
file.
Note
If set_catalog
is set to True
, then a cop of the card set
collection will be set as the default card_set.CATALOG
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
The file path from which to load the card set collection. |
required |
set_catalog |
bool
|
Whether to set the loaded data as the default card set catalog. |
False
|
Returns:
Type | Description |
---|---|
CardSetCollection
|
A new |
names()
¶
Returns the set of all card set names within this card set collection.
Returns:
Type | Description |
---|---|
list[str]
|
A unique |
release_dates()
¶
Returns the set of all card set release dates within this card set collection.
Returns:
Type | Description |
---|---|
list[datetime.date]
|
A unique |
save(file_path)
¶
Saves the card set collection to the specified file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
The file path to save to. |
required |
to_dataframe()
¶
Converts the list of card sets into a pandas DataFrame.
Returns:
Type | Description |
---|---|
DataFrame
|
A pandas |
to_json()
¶
Computes the JSON string representation of this collection of card sets.
Returns:
Type | Description |
---|---|
str
|
The JSON string representation of the collection. |