Udpated docstring for symbology
This commit is contained in:
parent
b3fd5610b2
commit
f1bad72898
|
@ -6,20 +6,12 @@ class ParseMana(FoundationObject):
|
||||||
"""
|
"""
|
||||||
symbology/parse-mana
|
symbology/parse-mana
|
||||||
|
|
||||||
Positional arguments:
|
Args:
|
||||||
cost : str ....................... The given mana cost you want. (`RUG`)
|
cost (string): The given mana cost you want. (`RUG`)
|
||||||
|
format (string, optional):
|
||||||
Optional arguments:
|
Returns data in the specified method. Defaults to JSON.
|
||||||
All arguments are inherited from SymbologyObject
|
pretty (string, optional):
|
||||||
|
Returns a prettier version of the json object. Note that this may break functionality with Scrython.
|
||||||
Attributes:
|
|
||||||
object : str ...... Returns the type of object it is. (card, error, etc)
|
|
||||||
mana_cost : str ............................... The formatted mana cost.
|
|
||||||
cmc : float ....................... The converted mana cost of the card.
|
|
||||||
colors : list ................... A list of all colors in the mana cost.
|
|
||||||
colorless : bool ................... True if the mana cost is colorless.
|
|
||||||
monocolored : bool .............. True if the mana cost is mono colored.
|
|
||||||
multicolored : bool ...... True if the mana cost is a multicolored cost.
|
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
>>> mana = scrython.symbology.ParseMana(cost="xcug")
|
>>> mana = scrython.symbology.ParseMana(cost="xcug")
|
||||||
|
@ -31,36 +23,72 @@ class ParseMana(FoundationObject):
|
||||||
super(ParseMana, self).__init__(self.url)
|
super(ParseMana, self).__init__(self.url)
|
||||||
|
|
||||||
def object(self):
|
def object(self):
|
||||||
|
"""Returns the type of object it is
|
||||||
|
(card, error, etc)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
string
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('object')
|
super(ParseMana, self)._checkForKey('object')
|
||||||
|
|
||||||
return self.scryfallJson['object']
|
return self.scryfallJson['object']
|
||||||
|
|
||||||
def mana_cost(self):
|
def mana_cost(self):
|
||||||
|
"""The formatted mana cost
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
string
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('cost')
|
super(ParseMana, self)._checkForKey('cost')
|
||||||
|
|
||||||
return self.scryfallJson['cost']
|
return self.scryfallJson['cost']
|
||||||
|
|
||||||
def cmc(self):
|
def cmc(self):
|
||||||
|
"""The converted mana cost of the card
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
float
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('cmc')
|
super(ParseMana, self)._checkForKey('cmc')
|
||||||
|
|
||||||
return self.scryfallJson['cmc']
|
return self.scryfallJson['cmc']
|
||||||
|
|
||||||
def colors(self):
|
def colors(self):
|
||||||
|
"""A list of all colors in the mana cost
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('colors')
|
super(ParseMana, self)._checkForKey('colors')
|
||||||
|
|
||||||
return self.scryfallJson['colors']
|
return self.scryfallJson['colors']
|
||||||
|
|
||||||
def colorless(self):
|
def colorless(self):
|
||||||
|
"""True if the mana cost is colorless
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
boolean
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('colorless')
|
super(ParseMana, self)._checkForKey('colorless')
|
||||||
|
|
||||||
return self.scryfallJson['colorless']
|
return self.scryfallJson['colorless']
|
||||||
|
|
||||||
def monocolored(self):
|
def monocolored(self):
|
||||||
|
"""True if the mana cost is mono colored
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
boolean
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('monocolored')
|
super(ParseMana, self)._checkForKey('monocolored')
|
||||||
|
|
||||||
return self.scryfallJson['monocolored']
|
return self.scryfallJson['monocolored']
|
||||||
|
|
||||||
def multicolored(self):
|
def multicolored(self):
|
||||||
|
"""True if the mana cost is a multicolored cost
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
boolean
|
||||||
|
"""
|
||||||
super(ParseMana, self)._checkForKey('multicolored')
|
super(ParseMana, self)._checkForKey('multicolored')
|
||||||
|
|
||||||
return self.scryfallJson['multicolored']
|
return self.scryfallJson['multicolored']
|
||||||
|
|
|
@ -6,30 +6,6 @@ class Symbology(FoundationObject):
|
||||||
"""
|
"""
|
||||||
/symbology
|
/symbology
|
||||||
|
|
||||||
Positional arguments:
|
|
||||||
No arguments are required.
|
|
||||||
|
|
||||||
Optional arguments:
|
|
||||||
All arguments are inherited from SymbologyObject
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
symbol_english(num): str .. An english sentence describing the mana cost.
|
|
||||||
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.
|
|
||||||
symbol_cmc(num): float . The total converted mana cost of the symbol.
|
|
||||||
symbol_funny(num): bool . True if the symbol is featured on any funny cards.
|
|
||||||
symbol_colors(num): array . An array of all colors in the given symbol.
|
|
||||||
symbol_gatherer_alternates(num): array .. An array of Gatherer like costs.
|
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
>>> symbol = scrython.symbology.Symbology()
|
>>> symbol = scrython.symbology.Symbology()
|
||||||
"""
|
"""
|
||||||
|
@ -38,71 +14,67 @@ class Symbology(FoundationObject):
|
||||||
super(Symbology, self).__init__(self.url)
|
super(Symbology, self).__init__(self.url)
|
||||||
|
|
||||||
def object(self):
|
def object(self):
|
||||||
|
"""Returns the type of object it is
|
||||||
|
(card, error, etc)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
string
|
||||||
|
"""
|
||||||
super(Symbology, self)._checkForKey('object')
|
super(Symbology, self)._checkForKey('object')
|
||||||
|
|
||||||
return self.scryfallJson['object']
|
return self.scryfallJson['object']
|
||||||
|
|
||||||
def has_more(self):
|
def has_more(self):
|
||||||
|
"""True if there are more pages to the object
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
boolean
|
||||||
|
"""
|
||||||
super(Symbology, self)._checkForKey('has_more')
|
super(Symbology, self)._checkForKey('has_more')
|
||||||
|
|
||||||
return self.scryfallJson['has_more']
|
return self.scryfallJson['has_more']
|
||||||
|
|
||||||
def data(self):
|
def data(self, index=None, key=None):
|
||||||
|
"""The data returned from the query
|
||||||
|
|
||||||
|
Acceptable keys:
|
||||||
|
symbol (string): The plaintext symbol, usually written with curly braces
|
||||||
|
loose_variant (string): The alternate version of the symbol, without curly braces
|
||||||
|
transposable (boolean): True if it's possibly to write the symbol backwards
|
||||||
|
represents_mana (boolean): True if this is a mana symbol
|
||||||
|
cmc (float): The total converted mana cost of the symbol
|
||||||
|
appears_in_mana_costs (boolean): True if the symbol appears on the mana cost of any card
|
||||||
|
funny (boolean): True if the symbol is featured on any funny cards
|
||||||
|
colors (array): An array of all colors in the given symbol
|
||||||
|
english (string): An english sentence describing the mana cost
|
||||||
|
gatherer_alternate (array): An array of Gatherer like costs
|
||||||
|
|
||||||
|
Args:
|
||||||
|
index (integer, optional): Defaults to None. Access a specific index.
|
||||||
|
key (string, optional): Defaults to None. Returns the value of the given key. Requires the `index` argument.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List: The full list of data.
|
||||||
|
Dictionary: If given an index
|
||||||
|
String: If given an index and key.
|
||||||
|
"""
|
||||||
super(Symbology, self)._checkForKey('has_more')
|
super(Symbology, self)._checkForKey('has_more')
|
||||||
|
|
||||||
|
if index is not None:
|
||||||
|
if key is not None:
|
||||||
|
super(Symbology, self)._checkForTupleKey('data', index, key)
|
||||||
|
return self.scryfallJson['data'][index][key]
|
||||||
|
|
||||||
|
return self.scryfallJson['data'][index]
|
||||||
|
|
||||||
return self.scryfallJson['data']
|
return self.scryfallJson['data']
|
||||||
|
|
||||||
def data_length(self):
|
def data_length(self):
|
||||||
|
"""The length of the data returned
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
integer
|
||||||
|
"""
|
||||||
super(Symbology, self)._checkForKey('data')
|
super(Symbology, self)._checkForKey('data')
|
||||||
|
|
||||||
return len(self.scryfallJson['data'])
|
return len(self.scryfallJson['data'])
|
||||||
|
|
||||||
def symbol_symbol(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'symbol')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['symbol']
|
|
||||||
|
|
||||||
def symbol_loose_variant(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'loose_variant')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['loose_variant']
|
|
||||||
|
|
||||||
def symbol_transposable(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'transposable')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['transposable']
|
|
||||||
|
|
||||||
def symbol_represents_mana(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'represents_mana')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['represents_mana']
|
|
||||||
|
|
||||||
def symbol_cmc(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'cmc')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['cmc']
|
|
||||||
|
|
||||||
def symbol_appears_in_mana_costs(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'appears_in_mana_costs')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['appears_in_mana_costs']
|
|
||||||
|
|
||||||
def symbol_funny(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'funny')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['funny']
|
|
||||||
|
|
||||||
def symbol_colors(self, num):
|
|
||||||
super(Symbology, self)._checkForTupleKey('data', num, 'colors')
|
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['colors']
|
|
||||||
|
|
||||||
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']
|
|
Loading…
Reference in New Issue