Filtering¶
-
class
pyartifact.filtering.
CardFilter
(sets=None, cards=None)[source]¶ Class that allows you to use predefined filters to get the cards you are looking for. The cards are then available in the cards attribute.
All filter methods return a new filter instance. That means you can both nest filtering methods and save certain filter to a variables and access them later if you want to go a different path.
-
color
(color)[source]¶ Filters for a single color.
Parameters: color ( str
) – ColorReturn type: CardFilter
-
color_in
(colors)[source]¶ Filters for multiple colors.
Parameters: colors ( Iterable
[str
]) – ColorsReturn type: CardFilter
-
color_not_in
(colors)[source]¶ For filtering out colors
Parameters: colors ( Iterable
[str
]) – ColorsReturn type: CardFilter
-
gold_cost
(gt=None, gte=None, lt=None, lte=None, eq=None)[source]¶ Filters out cards by their gold cost, if they have one. This will always filter out cards without gold cost. If multiple arguments are passed, every card that fits at least one will pass the filter.
Parameters: - gt (
Optional
[int
]) – Filters out cards that have higher gold cost than the number provided - gte (
Optional
[int
]) – Filters out cards that have higher or equal gold cost than the number provided - lt (
Optional
[int
]) – Filters out cards that have lower gold cost than the number provided - lte (
Optional
[int
]) – Filters out cards that have lower or equal gold cost than the number provided - eq (
Optional
[int
]) – Filters out cards that have gold cost equal to the number provided
Return type: - gt (
-
mana_cost
(gt=None, gte=None, lt=None, lte=None, eq=None)[source]¶ Filters out cards by their mana cost, if they have one. This will always filter out cards without mana cost. If multiple arguments are passed, every card that fits at least one will pass the filter.
Parameters: - gt (
Optional
[int
]) – Filters out cards that have higher mana cost than the number provided - gte (
Optional
[int
]) – Filters out cards that have higher or equal mana cost than the number provided - lt (
Optional
[int
]) – Filters out cards that have lower mana cost than the number provided - lte (
Optional
[int
]) – Filters out cards that have lower or equal mana cost than the number provided - eq (
Optional
[int
]) – Filters out cards that have mana cost equal to the number provided
Return type: - gt (
-
rarity
(rarity)[source]¶ Filters for a rarity
Parameters: rarity ( str
) – RarityReturn type: CardFilter
-
rarity_in
(rarities)[source]¶ Filters for multiple rarities
Parameters: rarities ( List
[str
]) – RaritiesReturn type: CardFilter
-
rarity_not_in
(rarities)[source]¶ Filters out cards of specified rarities.
Parameters: rarities ( List
[str
]) – RaritiesReturn type: CardFilter
-
sub_type
(sub_type)[source]¶ Filters out everything but items and leaves just items with a subtype equal to the provided string
Parameters: sub_type ( str
) – Sub type of an itemReturn type: CardFilter
-
type
(type_, filter_out=False)[source]¶ Filters for a single type (or anything but a single type)
Parameters: - type – Type of the card
- filter_out – Whether to filter that type out
Return type:
-
types_in
(card_types)[source]¶ Filters out cards that were not passed to this filter
Parameters: card_types ( Iterable
[Union
[str
,Type
[Item
],Type
[Hero
],Type
[Ability
],Type
[PassiveAbility
],Type
[Improvement
],Type
[Creep
],Type
[Spell
]]]) – Either strings of card types, or this library’s classes of card typesReturn type: CardFilter
-
types_not_in
(card_types)[source]¶ Filters out cards that were passed into this filter
Parameters: card_types ( Iterable
[Union
[str
,Type
[Item
],Type
[Hero
],Type
[Ability
],Type
[PassiveAbility
],Type
[Improvement
],Type
[Creep
],Type
[Spell
]]]) – Either strings of card types, or this library’s classes of card typesReturn type: CardFilter
-