Scrython/scrython/symbology/symbology.py

108 lines
3.9 KiB
Python
Raw Normal View History

import sys
sys.path.append('..')
from scrython.foundation import FoundationObject
2018-02-19 17:20:05 +00:00
class Symbology(FoundationObject):
2018-10-22 14:19:38 +00:00
"""
/symbology
2018-02-22 00:17:22 +00:00
2018-10-22 14:19:38 +00:00
Positional arguments:
No arguments are required.
2018-02-22 00:17:22 +00:00
2018-10-22 14:19:38 +00:00
Optional arguments:
All arguments are inherited from SymbologyObject
2018-02-22 00:17:22 +00:00
2018-10-22 14:19:38 +00:00
Attributes:
object : str . Returns the type of object it is. (card, error, etc)
has_more : bool . True if there are more pages to the object.
data : list . A list of all data returned.
data_length : int . The length of the data returned.
2018-02-22 00:17:22 +00:00
2018-10-22 14:19:38 +00:00
The following require an integer as an arg, which acts as a tuple.
symbol_symbol(num) : str . The plaintext symbol, usually written with curly braces.
symbol_loose_variant(num) : str . The alternate version of the symbol, without curly braces.
2018-10-22 15:25:20 +00:00
symbol_english(num): str .. An english sentence describing the mana cost.
2018-10-22 14:19:38 +00:00
symbol_transposable(num): bool . True if it's possibly to write the symbol backwards.
symbol_represents_mana(num): bool . True if this is a mana symbol.
symbol_appears_in_mana_costs(num): bool . True if the symbol appears on the mana cost of any card.
2018-10-22 15:25:20 +00:00
symbol_cmc(num): float . The total converted mana cost of the symbol.
2018-10-22 14:19:38 +00:00
symbol_funny(num): bool . True if the symbol is featured on any funny cards.
2018-10-22 15:25:20 +00:00
symbol_colors(num): array . An array of all colors in the given symbol.
symbol_gatherer_alternates(num): array .. An array of Gatherer like costs.
2018-02-22 00:17:22 +00:00
2018-10-22 14:19:38 +00:00
Example usage:
>>> symbol = scrython.symbology.Symbology()
"""
def __init__(self):
self.url = 'symbology?'
super(Symbology, self).__init__(self.url)
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def object(self):
super(Symbology, self)._checkForKey('object')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['object']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def has_more(self):
super(Symbology, self)._checkForKey('has_more')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['has_more']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def data(self):
super(Symbology, self)._checkForKey('has_more')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def data_length(self):
super(Symbology, self)._checkForKey('data')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return len(self.scryfallJson['data'])
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_symbol(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'symbol')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['symbol']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_loose_variant(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'loose_variant')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['loose_variant']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_transposable(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'transposable')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['transposable']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_represents_mana(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'represents_mana')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['represents_mana']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_cmc(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'cmc')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['cmc']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_appears_in_mana_costs(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'appears_in_mana_costs')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['appears_in_mana_costs']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_funny(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'funny')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['funny']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def symbol_colors(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'colors')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['data'][num]['colors']
2018-10-22 15:25:20 +00:00
def symbol_english(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'english')
return self.scryfallJson['data'][num]['english']
def symbol_gatherer_alternates(self, num):
super(Symbology, self)._checkForTupleKey('data', num, 'gatherer_alternates')
return self.scryfallJson['data'][num]['gatherer_alternates']