Commit 57ba18f2 authored by Grant Paton-Simpson's avatar Grant Paton-Simpson

Add images to README; fix trivial extra full-stop bug; bump version

parent 2cde7cd2
include README.md include README.md
include example_html_output_1.png
include example_terminal_output_1.png
include requirements.txt include requirements.txt
include superhelp/ansi_tables.json include superhelp/ansi_tables.json
# https://git.nzoss.org.nz/pyGrant/superhelp # https://git.nzoss.org.nz/pyGrant/superhelp
version number: 0.9.2 version number: 0.9.3
author: Grant Paton-Simpson author: Grant Paton-Simpson
## Overview ## Overview
...@@ -62,6 +62,14 @@ often. ...@@ -62,6 +62,14 @@ often.
# Example Usage # Example Usage
## Screenshot from HTML
![Example HTML output](example_html_output_1.png)
## Screenshot from Terminal
![Example Terminal output](example_terminal_output_1.png)
## Notebook ## Notebook
Add new cell at end with content like: Add new cell at end with content like:
...@@ -95,5 +103,4 @@ The notebook has more detailed instructions at the top. ...@@ -95,5 +103,4 @@ The notebook has more detailed instructions at the top.
2) Perhaps add style linting as an option 2) Perhaps add style linting as an option
3) Extend beyond standard library into popular libraries like requests, bottle, 3) Extend beyond standard library into popular libraries like requests, bottle, flask etc.
flask etc.
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages # @UnresolvedImport ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages # @UnresolvedImport
from codecs import open from codecs import open
from os import path from os import path
__version__ = '0.9.2' __version__ = '0.9.3'
here = path.abspath(path.dirname(__file__)) here = path.abspath(path.dirname(__file__))
......
...@@ -132,6 +132,10 @@ def _get_arg_comment(func_el, *, repeated_message=False): ...@@ -132,6 +132,10 @@ def _get_arg_comment(func_el, *, repeated_message=False):
def _get_return_comment(func_type_lbl, return_elements, *, def _get_return_comment(func_type_lbl, return_elements, *,
repeated_message=False): repeated_message=False):
"""
Comment should end without a full stop because calling code adds that to
make the sentence structure more explicit.
"""
implicit_return_els = [return_element for return_element in return_elements implicit_return_els = [return_element for return_element in return_elements
if not return_element.getchildren()] if not return_element.getchildren()]
implicit_returns_n = len(implicit_return_els) implicit_returns_n = len(implicit_return_els)
...@@ -150,17 +154,15 @@ def _get_return_comment(func_type_lbl, return_elements, *, ...@@ -150,17 +154,15 @@ def _get_return_comment(func_type_lbl, return_elements, *,
keyword_returns_n = none_returns_n + val_returns_n + implicit_returns_n keyword_returns_n = none_returns_n + val_returns_n + implicit_returns_n
if not keyword_returns_n: if not keyword_returns_n:
returns_comment = ( returns_comment = (
f"The {func_type_lbl} does not explicitly return anything.") f"The {func_type_lbl} does not explicitly return anything")
if not repeated_message: if not repeated_message:
returns_comment += ( returns_comment += (
" In which case, in Python, it implicitly returns None") ". In which case, in Python, it implicitly returns `None`")
else: else:
returns_comment = ( returns_comment = (
f"The {func_type_lbl} exits via an explicit `return` statement " f"The {func_type_lbl} exits via an explicit `return` statement "
f"{utils.int2nice(keyword_returns_n)} time") f"{utils.int2nice(keyword_returns_n)} time")
if repeated_message: if not repeated_message:
returns_comment += '.'
else:
if keyword_returns_n > 1: if keyword_returns_n > 1:
returns_comment += ( returns_comment += (
f"s. Some people prefer {func_type_lbl}s to have one, and " f"s. Some people prefer {func_type_lbl}s to have one, and "
...@@ -170,8 +172,6 @@ def _get_return_comment(func_type_lbl, return_elements, *, ...@@ -170,8 +172,6 @@ def _get_return_comment(func_type_lbl, return_elements, *,
f" the bulk of the {func_type_lbl}. Whatever approach you " f" the bulk of the {func_type_lbl}. Whatever approach you "
f"take make sure your {func_type_lbl} is easy to reason " f"take make sure your {func_type_lbl} is easy to reason "
"about in terms of what it returns and where it exits") "about in terms of what it returns and where it exits")
else:
returns_comment += '.'
return returns_comment return returns_comment
def _get_exit_comment(func_el, func_type_lbl, *, repeated_message=False): def _get_exit_comment(func_el, func_type_lbl, *, repeated_message=False):
......
...@@ -27,11 +27,9 @@ else: ...@@ -27,11 +27,9 @@ else:
## When testing user-supplied snippets watch out for the BOM MS inserts via Notepad. AST chokes on it. ## When testing user-supplied snippets watch out for the BOM MS inserts via Notepad. AST chokes on it.
TEST_SNIPPET = """\ TEST_SNIPPET = """\
for i in range(2): def powerMe(num, *, power=2):
a = 'jelly' poweredVal = num ** power
b = 'fish' return poweredVal
pet = f'{a}{b}'
""" """
DEMO_SNIPPET = """\ DEMO_SNIPPET = """\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment