Created docstrings for symbology.

This commit is contained in:
Nanda Scott 2018-02-21 19:17:22 -05:00
parent 3704ad40d2
commit 1f841263ff
3 changed files with 65 additions and 2 deletions

View File

@ -1,8 +1,30 @@
from .symbology_object import SymbologyObject
class ParseMana(SymbologyObject):
def __init__(self, **kwargs):
self.cost = kwargs.get('cost')
"""
symbology/parse-mana
Positional arguments:
cost : str ....................... The given mana cost you want. (`RUG`)
Optional arguments:
All arguments are inherited from SymbologyObject
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:
>>> mana = scrython.symbology.ParseMana(cost="xcug")
>>> mana.colors()
"""
def __init__(self, cost):
self.cost = cost
self.url = 'symbology/parse-mana?cost=' + self.cost
super(ParseMana, self).__init__(self.url)

View File

@ -1,6 +1,34 @@
from .symbology_object import SymbologyObject
class Symbology(SymbologyObject):
"""
/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_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_cmc(num): float . The total converted mana cost of the symbol.
symbol_appears_in_mana_costs(num): bool . True if the symbol appears on the mana cost of any card.
symbol_funny(num): bool . True if the symbol is featured on any funny cards.
symbol_colors(num): float . An array of all colors in the given symbol.
Example usage:
>>> symbol = scrython.symbology.Symbology()
"""
def __init__(self):
self.url = 'symbology?'
super(Symbology, self).__init__(self.url)

View File

@ -3,6 +3,19 @@ import aiohttp
import urllib.parse
class SymbologyObject(object):
"""
The master class for all symbology objects.
Positional arguments:
No arguments required.
Optional arguments:
format : str ................... The format to return. Defaults to JSON.
pretty : bool ... Makes the returned JSON prettier. The library may not work properly with this setting.
Attributes:
No attributes to call.
"""
def __init__(self, _url, **kwargs):
self.params = {'format': kwargs.get('format', 'json'), 'pretty': kwargs.get('pretty', '')}