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 CHANGED
@@ -7,7 +7,7 @@ from mktestdocs.__main__ import (
7
7
  get_codeblock_members,
8
8
  )
9
9
 
10
- __version__ = "0.2.1"
10
+ __version__ = "0.2.3"
11
11
 
12
12
  __all__ = [
13
13
  "__version__",
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 line.startswith("```"):
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
  """
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mktestdocs
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  License-File: LICENSE
5
5
  Provides-Extra: test
6
- Requires-Dist: pytest (>=4.0.2) ; extra == 'test'
6
+ Requires-Dist: pytest>=4.0.2; extra == "test"
7
7
 
@@ -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,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -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,,