Updated docs for better formatting

This commit is contained in:
Nanda Scott 2018-10-28 01:52:40 -04:00
parent cd9f7efbc0
commit dff715aaa6
32 changed files with 62 additions and 175 deletions

View File

@ -1,8 +1,8 @@
# **class** `scrython.bulk_data.BulkData()` # **class** `scrython.bulk_data.BulkData()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`BulkData().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`BulkData().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.ArenaId()` # **class** `scrython.cards.ArenaId()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ArenaId().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ArenaId().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Autocomplete()` # **class** `scrython.cards.Autocomplete()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Autocomplete().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Autocomplete().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Collector()` # **class** `scrython.cards.Collector()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Collector().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Collector().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Id()` # **class** `scrython.cards.Id()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Id().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Id().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Mtgo()` # **class** `scrython.cards.Mtgo()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Mtgo().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Mtgo().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Multiverse()` # **class** `scrython.cards.Multiverse()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Multiverse().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Multiverse().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Named()` # **class** `scrython.cards.Named()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Named().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Named().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Random()` # **class** `scrython.cards.Random()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Random().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Random().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.cards.Search()` # **class** `scrython.cards.Search()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Search().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Search().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.ArtifactTypes()` # **class** `scrython.catalog.ArtifactTypes()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ArtifactTypes().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ArtifactTypes().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.ArtistNames()` # **class** `scrython.catalog.ArtistNames()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ArtistNames().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ArtistNames().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.CardNames()` # **class** `scrython.catalog.CardNames()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`CardNames().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`CardNames().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.CreatureTypes()` # **class** `scrython.catalog.CreatureTypes()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`CreatureTypes().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`CreatureTypes().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.EnchantmentTypes()` # **class** `scrython.catalog.EnchantmentTypes()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`EnchantmentTypes().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`EnchantmentTypes().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.LandTypes()` # **class** `scrython.catalog.LandTypes()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`LandTypes().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`LandTypes().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.Loyalties()` # **class** `scrython.catalog.Loyalties()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Loyalties().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Loyalties().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.PlaneswalkerTypes()` # **class** `scrython.catalog.PlaneswalkerTypes()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`PlaneswalkerTypes().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`PlaneswalkerTypes().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.Powers()` # **class** `scrython.catalog.Powers()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Powers().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Powers().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.SpellTypes()` # **class** `scrython.catalog.SpellTypes()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`SpellTypes().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`SpellTypes().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.Toughnesses()` # **class** `scrython.catalog.Toughnesses()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Toughnesses().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Toughnesses().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.Watermarks()` # **class** `scrython.catalog.Watermarks()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Watermarks().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Watermarks().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.catalog.WordBank()` # **class** `scrython.catalog.WordBank()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`WordBank().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`WordBank().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.rulings.Code()` # **class** `scrython.rulings.Code()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Code().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Code().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.rulings.Id()` # **class** `scrython.rulings.Id()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Id().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Id().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.rulings.Mtgo()` # **class** `scrython.rulings.Mtgo()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Mtgo().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Mtgo().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.rulings.Multiverse()` # **class** `scrython.rulings.Multiverse()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Multiverse().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Multiverse().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.sets.Code()` # **class** `scrython.sets.Code()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Code().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Code().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.sets.Sets()` # **class** `scrython.sets.Sets()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Sets().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Sets().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.symbology.ParseMana()` # **class** `scrython.symbology.ParseMana()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ParseMana().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`ParseMana().scryfallJson`).
## Args ## Args

View File

@ -1,8 +1,8 @@
# **class** `scrython.symbology.Symbology()` # **class** `scrython.symbology.Symbology()`
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Symbology().scryfallJson`). >In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Symbology().scryfallJson`).
## Args ## Args

View File

@ -1,113 +0,0 @@
import sys
import scrython
import re
from scrython.bulk_data import *
from scrython.cards import *
from scrython.catalog import *
from scrython.rulings import *
from scrython.sets import *
from scrython.symbology import *
from types import FunctionType
def format_args(string, f):
f.write('\n## Args\n\n|arg|type|description|\n|:---:|:---:|:---:|\n')
arg_list = re.findall(r'(\w*\s*\(\w+[,\s\w]{1,}\):[\w\s\'\\`,.]*[^\w\s\(])', string)
for arg in arg_list:
arg_name = re.findall(r'[^\s]*', arg)[0]
description = re.findall(r'(?<=:\s)(.*)', arg)[0]
type_and_optional = re.findall(r'(?<=\()\w+[,\s\w]+(?=\))', arg)[0]
if len(type_and_optional) > 1:
f.write('|{}|{}|{}|\n'.format(arg_name, type_and_optional, description))
else:
f.write('|{}|{}|{}|\n'.format(arg_name, type_and_optional, description))
def format_returns(string, f):
f.write('\n## Returns\n{}\n'.format(string.strip()))
def format_raises(string, f):
f.write('\n## Raises\n\n|exception type|reason|\n|:---:|:---:|\n')
exception_list = re.findall(r'\w+:[\w\s\\\']+[^\s\w:]', string)
for exception in exception_list:
exception_name = re.findall(r'[^:]*', exception)[0]
exception_description = re.findall(r'(?<=:\s)([\w\s\.\'\\]*)', exception)[0]
f.write('|{}|{}|\n'.format(exception_name, exception_description))
def format_examples(string, f):
example_list = re.findall(r'>{3}[\s\w=.("+:,)]+', string)
f.write('\n## Examples\n')
f.write('```python\n{}\n```\n'.format('\n'.join(example_list)))
def format_functions(_class, function_list, f):
f.write('\n## Methods\n')
for function in function_list:
function_docstring = getattr(eval(_class), function).__doc__
f.write('\n---\n### `{}()`\n'.format(getattr(eval(_class), function).__name__))
f.write('\n```\n{}\n```'.format(function_docstring))
def main(subpackage):
for _class in subpackage.__all__:
intro = """
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`{}().scryfallJson`).
""".format(eval(_class).__name__)
class_docstring = repr(re.sub(r'\n+', '', eval(_class).__doc__)) # removes newlines
remove_extra_spaces = re.sub(' +', ' ', class_docstring)
try:
args = re.findall(r'(?<=Args:)(.*)(?=Returns:)', remove_extra_spaces)[0]
returns = re.findall(r'(?<=Returns:)(.*)(?=Raises:)', remove_extra_spaces)[0]
raises = re.findall(r'(?<=Raises:)(.*)(?=Examples:)', remove_extra_spaces)[0]
examples = re.findall(r'(?<=Examples:)(.*)', remove_extra_spaces)[0]
functions = [x for x in dir(eval(_class)) if not x.startswith('_')]
with open('./docs/{}/{}.md'.format(subpackage.__name__, _class), 'w') as f:
f.write('# **class** `{}.{}()`\n'.format(subpackage.__name__, _class))
f.write(intro)
format_args(args, f)
format_returns(returns, f)
format_raises(raises, f)
format_examples(examples, f)
format_functions(_class, functions, f)
except Exception as e:
print(_class.upper())
print(repr(eval(_class).__doc__))
print('Args: ', re.findall(r'(?<=Args:)(.*)(?=Returns:)', remove_extra_spaces))
print('Returns: ', re.findall(r'(?<=Returns:)(.*)(?=Raises:)', remove_extra_spaces))
print('Raises: ', re.findall(r'(?<=Raises:)(.*)(?=Examples:)', remove_extra_spaces))
print('Examples: ', re.findall(r'(?<=Examples:)(.*)', remove_extra_spaces))
print(e)
print('~~~~~~~~~~~~~~~~~~~~~~~~~~')
if __name__ == '__main__':
main(scrython.bulk_data)
main(scrython.cards)
main(scrython.catalog)
main(scrython.rulings)
main(scrython.sets)
main(scrython.symbology)