From 2b791a7524b9a3461a9ceb6b044414dbaea53780 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 2 Aug 2020 11:07:41 -0500 Subject: [PATCH 1/6] Handle parsing empty line Fixes issue discovered accidentally in #22 where a numpy docstring attribute without a description leads to IndexError of an empty line. --- mkapi/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkapi/utils.py b/mkapi/utils.py index 54f7577f..4aac02fb 100644 --- a/mkapi/utils.py +++ b/mkapi/utils.py @@ -12,6 +12,8 @@ def get_indent(line: str) -> int: def join(lines): + if not len(lines): + return '' indent = get_indent(lines[0]) return "\n".join(line[indent:] for line in lines).strip() From 7472d965015549f1e8acaeb0560a4ef5289756bc Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 2 Aug 2020 11:48:44 -0500 Subject: [PATCH 2/6] Typos --- examples/google_style.py | 2 +- examples/numpy_style.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/google_style.py b/examples/google_style.py index a4649de6..7dc1ee8b 100644 --- a/examples/google_style.py +++ b/examples/google_style.py @@ -79,7 +79,7 @@ def message(self, n: int) -> List[str]: """Returns a message list. Args: - n: Repeatation. + n: Repetition. """ return [self.a] * n diff --git a/examples/numpy_style.py b/examples/numpy_style.py index 87b78357..a9de9a37 100644 --- a/examples/numpy_style.py +++ b/examples/numpy_style.py @@ -88,7 +88,7 @@ def message(self, n: int) -> List[str]: Parameters ---------- n - Repeatation. + Repetition. """ return [self.a] * n From 8f9726708d57018dd03ea8912b126d742e265737 Mon Sep 17 00:00:00 2001 From: daizu Date: Mon, 3 Aug 2020 18:55:16 +0900 Subject: [PATCH 3/6] Update Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d816717..940052cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## [Unreleased] +### Fixed +- Handle parsing empty line ([#23](https://github.com/daizutabi/mkapi/pull/23)). Thanks to [tony](https://github.com/tony). + ## [1.0.12] - 2020-07-29 ### Changed From b60bbab2831dcb28186db79cc1d8c488f6670c6a Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 2 Aug 2020 15:20:13 -0500 Subject: [PATCH 4/6] Show source links: Add trailing slash for CDN urls Without a trailing slash, CDNs like CloudFront will not be treated as a directory (depending on lambda@edge / workers config) --- mkapi/core/postprocess.py | 2 +- mkapi/templates/object.jinja2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mkapi/core/postprocess.py b/mkapi/core/postprocess.py index 959aa770..bab33139 100644 --- a/mkapi/core/postprocess.py +++ b/mkapi/core/postprocess.py @@ -11,7 +11,7 @@ def sourcelink(object: Object) -> str: link = f'' else: link = "" - link += f'</>' return link diff --git a/mkapi/templates/object.jinja2 b/mkapi/templates/object.jinja2 index da1ef7f9..f7a0a111 100644 --- a/mkapi/templates/object.jinja2 +++ b/mkapi/templates/object.jinja2 @@ -11,7 +11,7 @@ {% if 'sourcelink' in filters or 'link' in filters or 'apilink' in filters -%} {%- endif %} From 64c82b76c5c0d2c97f36c47db955514cf6a61871 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 2 Aug 2020 15:54:51 -0500 Subject: [PATCH 5/6] build(package): Rename to mkapi-git-pull so it can be deployed to pypi poetry is failing to handle locking for this: mkapi = {git = "https://github.com/tony/mkapi", rev = "git-pull", extras = ["docs"], python = ">=3.7"} In python 2.7 with poetry 1.0.10, it fails with: /home/runner/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads. "program uses threads.", RuntimeWarning) Installing dependencies from lock file [RuntimeError] Unable to retrieve the package version for /tmp/pypoetry-git-mkap8a5bZB \#\#[error]Process completed with exit code 1. See also: - https://github.com/python-poetry/poetry/issues/2391 - https://github.com/python-poetry/poetry/issues/2176 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4d7ece4f..f2cac07e 100644 --- a/setup.py +++ b/setup.py @@ -62,9 +62,9 @@ def publish(): setup( - name="mkapi", + name="mkapi-git-pull", version=get_version("mkapi"), - description="An Auto API Documentation tool.", + description="Fork of mkapi since poetry fails with git + python verson constraint", long_description=long_description, url="https://mkapi.daizutabi.net", author="daizutabi", From c29e90dcfe7c3f3418c316a60537c8c89489f738 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 2 Aug 2020 17:41:06 -0500 Subject: [PATCH 6/6] Fix crash when parsing / splitting property / undocumented or unlinked base class ```python class RepoLoggingAdapter(logging.LoggerAdapter): """Adapter for adding Repo related content to logger. - [`RepoLoggingAdapter.bin_name`](RepoLoggingAdapter.bin_name) -> ``repo_vcs`` - [`RepoLoggingAdapter.name`](RepoLoggingAdapter.name) -> ``repo_name`` """ ``` See also: - https://github.com/daizutabi/mkapi/pull/27 - Possibly related to https://github.com/daizutabi/mkapi/pull/26 --- mkapi/core/object.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkapi/core/object.py b/mkapi/core/object.py index b9b8cbbe..5445434e 100644 --- a/mkapi/core/object.py +++ b/mkapi/core/object.py @@ -65,6 +65,9 @@ def get_fullname(obj: Any, name: str) -> str: return "" obj = getattr(obj, name) + if isinstance(obj, property): + return "" + return ".".join(split_prefix_and_name(obj))