mktestdocs 0.2.1__py2.py3-none-any.whl → 0.2.3__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mktestdocs/__init__.py +1 -1
- mktestdocs/__main__.py +8 -3
- {mktestdocs-0.2.1.dist-info → mktestdocs-0.2.3.dist-info}/METADATA +2 -2
- mktestdocs-0.2.3.dist-info/RECORD +7 -0
- {mktestdocs-0.2.1.dist-info → mktestdocs-0.2.3.dist-info}/WHEEL +1 -1
- mktestdocs-0.2.1.dist-info/RECORD +0 -7
- {mktestdocs-0.2.1.dist-info → mktestdocs-0.2.3.dist-info}/LICENSE +0 -0
- {mktestdocs-0.2.1.dist-info → mktestdocs-0.2.3.dist-info}/top_level.txt +0 -0
mktestdocs/__init__.py
CHANGED
mktestdocs/__main__.py
CHANGED
@@ -3,7 +3,6 @@ import pathlib
|
|
3
3
|
import subprocess
|
4
4
|
import textwrap
|
5
5
|
|
6
|
-
|
7
6
|
_executors = {}
|
8
7
|
|
9
8
|
|
@@ -90,20 +89,26 @@ def grab_code_blocks(docstring, lang="python"):
|
|
90
89
|
docstring: the docstring to analyse
|
91
90
|
lang: if not None, the language that is assigned to the codeblock
|
92
91
|
"""
|
92
|
+
docstring = format_docstring(docstring)
|
93
93
|
docstring = textwrap.dedent(docstring)
|
94
94
|
in_block = False
|
95
95
|
block = ""
|
96
96
|
codeblocks = []
|
97
97
|
for idx, line in enumerate(docstring.split("\n")):
|
98
|
-
if
|
98
|
+
if "```" in line:
|
99
99
|
if in_block:
|
100
100
|
codeblocks.append(check_codeblock(block, lang=lang))
|
101
101
|
block = ""
|
102
102
|
in_block = not in_block
|
103
103
|
if in_block:
|
104
104
|
block += line + "\n"
|
105
|
-
return [c for c in codeblocks if c != ""]
|
105
|
+
return [textwrap.dedent(c) for c in codeblocks if c != ""]
|
106
106
|
|
107
|
+
def format_docstring(docstring):
|
108
|
+
"""Formats docstring to be able to successfully go through dedent."""
|
109
|
+
if docstring[:1] != "\n":
|
110
|
+
return f"\n {docstring}"
|
111
|
+
return docstring
|
107
112
|
|
108
113
|
def check_docstring(obj, lang=""):
|
109
114
|
"""
|
@@ -0,0 +1,7 @@
|
|
1
|
+
mktestdocs/__init__.py,sha256=oO-1kO-bZaGv3gUaUUD_tVAOH56cRVYf542yjwt9z3U,371
|
2
|
+
mktestdocs/__main__.py,sha256=1wWVXVxsGeSWAZhVb4ezuhZxziT-2KfBdAQxNsb6_QI,4753
|
3
|
+
mktestdocs-0.2.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
4
|
+
mktestdocs-0.2.3.dist-info/METADATA,sha256=wKes8p2f8jXkVyBKIDewXJ6QJG5GBQ32SAKkqSuhpCA,144
|
5
|
+
mktestdocs-0.2.3.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
|
6
|
+
mktestdocs-0.2.3.dist-info/top_level.txt,sha256=1XGYsQSl3FsAtilWThIet3WOJQSuzQXXn6sQA7hxlho,11
|
7
|
+
mktestdocs-0.2.3.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
mktestdocs/__init__.py,sha256=_iVQPmcuxkjOr-bEOP4DEygx6mnG_6fP4wJBhbc2G8E,371
|
2
|
-
mktestdocs/__main__.py,sha256=BO5LopXLAeKFFuKcT0KaeErUeFXt8ekjIiyrTymBG3k,4508
|
3
|
-
mktestdocs-0.2.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
4
|
-
mktestdocs-0.2.1.dist-info/METADATA,sha256=67xAXa_sIfpXAHDaOiKJPxRUqXQekbdMhZDqXQzL5Ec,148
|
5
|
-
mktestdocs-0.2.1.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
|
6
|
-
mktestdocs-0.2.1.dist-info/top_level.txt,sha256=1XGYsQSl3FsAtilWThIet3WOJQSuzQXXn6sQA7hxlho,11
|
7
|
-
mktestdocs-0.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|