Updated sets docstrings and deleted redundant stuff
This commit is contained in:
parent
1d869b872c
commit
80581d125f
|
@ -1,18 +1,19 @@
|
|||
from .sets_object import SetsObject
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
from scrython.foundation import FoundationObject
|
||||
|
||||
class Code(SetsObject):
|
||||
class Code(FoundationObject):
|
||||
"""
|
||||
sets/:code
|
||||
Get a set with a 3 letter code.
|
||||
|
||||
Positional arguments:
|
||||
code : str ............................... The 3 letter code of the set.
|
||||
|
||||
Optional arguments:
|
||||
All arguments are inherited from SetsObject
|
||||
|
||||
Attributes:
|
||||
All attributes are inherited from SetsObject
|
||||
Args:
|
||||
code (string):
|
||||
The 3 letter code of the set.
|
||||
format (string, optional):
|
||||
Returns data in the specified method. Defaults to JSON.
|
||||
pretty (string, optional):
|
||||
Returns a prettier version of the json object. Note that this may break functionality with Scrython.
|
||||
|
||||
Example usage:
|
||||
>>> set = scrython.sets.Code(code='por')
|
||||
|
@ -21,3 +22,144 @@ class Code(SetsObject):
|
|||
def __init__(self, code):
|
||||
self._url = 'sets/{}?'.format(code)
|
||||
super(Code, self).__init__(self._url)
|
||||
|
||||
def object(self):
|
||||
"""Returns the type of object it is
|
||||
(card, error, etc)
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('object')
|
||||
|
||||
return self.scryfallJson['object']
|
||||
|
||||
def code(self):
|
||||
"""The three letter set code of the set
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('object')
|
||||
|
||||
return self.scryfallJson['code']
|
||||
|
||||
def mtgo_code(self):
|
||||
"""The mtgo equivalent of `code()`
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('mtgo_code')
|
||||
|
||||
return self.scryfallJson['mtgo_code']
|
||||
|
||||
def name(self):
|
||||
"""The full name of the set
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('name')
|
||||
|
||||
return self.scryfallJson['name']
|
||||
|
||||
def set_type(self):
|
||||
"""The type of the set (expansion, commander, etc)
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('set_type')
|
||||
|
||||
return self.scryfallJson['set_type']
|
||||
|
||||
def released_at(self):
|
||||
"""The date the set was launched
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('released_at')
|
||||
|
||||
return self.scryfallJson['released_at']
|
||||
|
||||
def block_code(self):
|
||||
"""The the letter code for the block the set was in
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('block_code')
|
||||
|
||||
return self.scryfallJson['block_code']
|
||||
|
||||
def block(self):
|
||||
"""The full name of the block a set was in
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('block')
|
||||
|
||||
return self.scryfallJson['block']
|
||||
|
||||
def parent_set_code(self):
|
||||
"""The set code for the parent set
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('parent_set_code')
|
||||
|
||||
return self.scryfallJson['parent_set_code']
|
||||
|
||||
def card_count(self):
|
||||
"""The number of cards in the set
|
||||
|
||||
Returns:
|
||||
integer
|
||||
"""
|
||||
super(Code, self)._checkForKey('card_count')
|
||||
|
||||
return self.scryfallJson['card_count']
|
||||
|
||||
def digital(self):
|
||||
"""True if this set is only featured on MTGO
|
||||
|
||||
Returns:
|
||||
boolean
|
||||
"""
|
||||
super(Code, self)._checkForKey('digital')
|
||||
|
||||
return self.scryfallJson['digital']
|
||||
|
||||
def foil_only(self):
|
||||
"""True if this set only has foils
|
||||
|
||||
Returns:
|
||||
boolean
|
||||
"""
|
||||
super(Code, self)._checkForKey('foil_only')
|
||||
|
||||
return self.scryfallJson['foil_only']
|
||||
|
||||
def icon_svg_uri(self):
|
||||
"""A URI to the SVG of the set symbol
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('icon_svg_uri')
|
||||
|
||||
return self.scryfallJson['icon_svg_uri']
|
||||
|
||||
def search_uri(self):
|
||||
"""The scryfall API url for the search
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
super(Code, self)._checkForKey('search_uri')
|
||||
|
||||
return self.scryfallJson['search_uri']
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from .sets_object import SetsObject
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
from scrython.foundation import FoundationObject
|
||||
|
||||
class Sets(SetsObject):
|
||||
class Sets(FoundationObject):
|
||||
"""
|
||||
/sets
|
||||
`Sets()` gets it's own special attributes that don't match with the normal set attributes.
|
||||
|
@ -129,46 +131,4 @@ class Sets(SetsObject):
|
|||
def set_search_uri(self, num):
|
||||
super(Sets, self)._checkForTupleKey('data', num, 'search_uri')
|
||||
|
||||
return self.scryfallJson['data'][num]['search_uri']
|
||||
|
||||
#The following attributes are only to override the inherited class attributes.
|
||||
#This class has no matching attributes but we still need the getRequest from SetsObject
|
||||
|
||||
def code(self):
|
||||
raise AttributeError('This object has no key \'code\'')
|
||||
|
||||
def mtgo_code(self):
|
||||
raise AttributeError('This object has no key \'mtgo_code\'')
|
||||
|
||||
def name(self):
|
||||
raise AttributeError('This object has no key \'name\'')
|
||||
|
||||
def set_type(self):
|
||||
raise AttributeError('This object has no key \'set_type\'')
|
||||
|
||||
def released_at(self):
|
||||
raise AttributeError('This object has no key \'released_at\'')
|
||||
|
||||
def block_code(self):
|
||||
raise AttributeError('This object has no key \'block_code\'')
|
||||
|
||||
def block(self):
|
||||
raise AttributeError('This object has no key \'block\'')
|
||||
|
||||
def parent_set_code(self):
|
||||
raise AttributeError('This object has no key \'parent_set_code\'')
|
||||
|
||||
def card_count(self):
|
||||
raise AttributeError('This object has no key \'card_count\'')
|
||||
|
||||
def digital(self):
|
||||
raise AttributeError('This object has no key \'digital\'')
|
||||
|
||||
def foil_only(self):
|
||||
raise AttributeError('This object has no key \'foil_only\'')
|
||||
|
||||
def icon_svg_uri(self):
|
||||
raise AttributeError('This object has no key \'icon_svg_uri\'')
|
||||
|
||||
def search_uri(self):
|
||||
raise AttributeError('This object has no key \'search_uri\'')
|
||||
return self.scryfallJson['data'][num]['search_uri']
|
Loading…
Reference in New Issue