From c9577a125acd2a821ae8289aeef9a6d3a9498370 Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Wed, 31 Oct 2018 11:24:35 -0400 Subject: [PATCH 1/4] Updated gen docs to properly format examples --- gen_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen_docs.py b/gen_docs.py index 4e8d45a..90141d3 100644 --- a/gen_docs.py +++ b/gen_docs.py @@ -49,7 +49,7 @@ def format_raises(string, f): def format_examples(string, f): - example_list = re.findall(r'>{3}[\s\w=.("+:,)]+', string) + 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))) From 1c0d21aaefd4263714edfaefe9ef8e9583019838 Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Wed, 31 Oct 2018 11:25:29 -0400 Subject: [PATCH 2/4] Updated docs --- docs/scrython.cards/Id.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scrython.cards/Id.md b/docs/scrython.cards/Id.md index a7054e9..3ed1b92 100644 --- a/docs/scrython.cards/Id.md +++ b/docs/scrython.cards/Id.md @@ -26,7 +26,7 @@ N/A ## Examples ```python ->>> card = scrython.cards.Id(id="5386a61c +>>> card = scrython.cards.Id(id="5386a61c-4928-4bd1-babe-5b089ab8b2d9") >>> card.name() ``` From ba0c3d412898710197236cf37eb21adf2bbc66f5 Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Wed, 31 Oct 2018 13:05:59 -0400 Subject: [PATCH 3/4] Updated gen docs --- gen_docs.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/gen_docs.py b/gen_docs.py index 90141d3..a12b8d3 100644 --- a/gen_docs.py +++ b/gen_docs.py @@ -1,13 +1,7 @@ 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 +import os def format_args(string, f): f.write('\n## Args\n\n|arg|type|description|\n|:---:|:---:|:---:|\n') @@ -89,6 +83,9 @@ These docs will likely not be as detailed as the official Scryfall Documentation functions = [x for x in dir(eval(_class)) if not x.startswith('_')] + if not os.path.exists('./docs/{}'.format(subpackage.__name__)): + os.makedirs('./docs/{}'.format(subpackage.__name__)) + with open('./docs/{}/{}.md'.format(subpackage.__name__, _class), 'w') as f: f.write('# **class** `{}.{}()`\n'.format(subpackage.__name__, _class)) f.write(intro) @@ -109,9 +106,26 @@ These docs will likely not be as detailed as the official Scryfall Documentation print('~~~~~~~~~~~~~~~~~~~~~~~~~~') if __name__ == '__main__': + from scrython.bulk_data import * main(scrython.bulk_data) + del scrython.bulk_data + + from scrython.cards import * main(scrython.cards) + del scrython.cards + + from scrython.catalog import * main(scrython.catalog) + del scrython.catalog + + from scrython.rulings import * main(scrython.rulings) + del scrython.rulings + + from scrython.sets import * main(scrython.sets) - main(scrython.symbology) \ No newline at end of file + del scrython.sets + + from scrython.symbology import * + main(scrython.symbology) + del scrython.symbology \ No newline at end of file From 9e06be54264e3735bfd14985ec1fe2a2cb6b8d9e Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Wed, 31 Oct 2018 13:06:10 -0400 Subject: [PATCH 4/4] Updated docs --- docs/scrython.rulings/Code.md | 139 +++++++--------------------------- docs/scrython.rulings/Id.md | 2 +- 2 files changed, 28 insertions(+), 113 deletions(-) diff --git a/docs/scrython.rulings/Code.md b/docs/scrython.rulings/Code.md index e66d395..3e03a83 100644 --- a/docs/scrython.rulings/Code.md +++ b/docs/scrython.rulings/Code.md @@ -8,8 +8,11 @@ These docs will likely not be as detailed as the official Scryfall Documentation |arg|type|description| |:---:|:---:|:---:| -|code|string|The 3 letter code of the set.| +|set|string|The 3 letter set code of the card you want rulings for.| +|collector_number|string|The collector number of the card.| |format|string, optional|Returns data in the specified method. Defaults to JSON.| +|face|string, optional|If you\'re using the `image` format, this will specify if you want the front or back face.| +|version|string, optional|If you\'re using the `image` format, this will specify if you want the small, normal, large, etc version of the image.| |pretty|string, optional|Returns a prettier version of the json object. Note that this may break functionality with Scrython.| ## Returns @@ -20,100 +23,52 @@ N/A ## Examples ```python ->>> set = scrython.sets.Code(code="por") ->>> set.name() +>>> rule = scrython.rulings.Code(code="ddg", collector_number="42") +>>> rule.data_length() ``` ## Methods --- -### `block()` +### `data()` ``` -The full name of the block a set was in +The data returned from the query + + Acceptable keys: + object (string): The type of object for a given ruling. + source (string): The source of the ruling. + published_at (string): The date when the ruling was published. + comment (string): The effective ruling. + + 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: - string + List: The full list of data. + Dictionary: If given an index + String: If given an index and key. ``` --- -### `block_code()` +### `data_length()` ``` -The the letter code for the block the set was in +The length of the `data` list. Returns: - string + Integer ``` --- -### `card_count()` +### `has_more()` ``` -The number of cards in the set +True if there is more than one page of results Returns: - integer - -``` ---- -### `code()` - -``` -The three letter set code of the set - - Returns: - string - -``` ---- -### `digital()` - -``` -True if this set is only featured on MTGO - - Returns: - boolean - -``` ---- -### `foil_only()` - -``` -True if this set only has foils - - Returns: - boolean - -``` ---- -### `icon_svg_uri()` - -``` -A URI to the SVG of the set symbol - - Returns: - string - -``` ---- -### `mtgo_code()` - -``` -The mtgo equivalent of `code()` - - Returns: - string - -``` ---- -### `name()` - -``` -The full name of the set - - Returns: - string + boolean: True if there are more results ``` --- @@ -126,44 +81,4 @@ Returns the type of object it is Returns: string -``` ---- -### `parent_set_code()` - -``` -The set code for the parent set - - Returns: - string - -``` ---- -### `released_at()` - -``` -The date the set was launched - - Returns: - string - -``` ---- -### `search_uri()` - -``` -The scryfall API url for the search - - Returns: - string - -``` ---- -### `set_type()` - -``` -The type of the set (expansion, commander, etc) - - Returns: - string - ``` \ No newline at end of file diff --git a/docs/scrython.rulings/Id.md b/docs/scrython.rulings/Id.md index 4bbbfbd..b0377ec 100644 --- a/docs/scrython.rulings/Id.md +++ b/docs/scrython.rulings/Id.md @@ -22,7 +22,7 @@ N/A ## Examples ```python ->>> rule = scrython.rulings.Id(id="5976c352 +>>> rule = scrython.rulings.Id(id="5976c352-ac49-4e0d-a4c0-ec9b6b78db9c") >>> rule.data_length() ```