From 8cf0e5774c79d7dbbab4c0694092246d030b0367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 15 Feb 2021 13:38:53 +0100 Subject: [PATCH 1/4] remove some returns --- Makefile | 6 +++--- termplotlib/figure.py | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index aa15b88..3ea455e 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,12 @@ default: @echo "\"make publish\"?" tag: - # Make sure we're on the master branch - @if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi + # Make sure we're on the main branch + @if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "v$(VERSION)"}' https://api.github.com/repos/nschloe/termplotlib/releases upload: clean - @if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi + @if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi python3 -m build --sdist --wheel . twine upload dist/* diff --git a/termplotlib/figure.py b/termplotlib/figure.py index d17ebe6..73ef48f 100644 --- a/termplotlib/figure.py +++ b/termplotlib/figure.py @@ -14,18 +14,15 @@ def __init__(self, width=None, padding=0): self._width = width self._subfigures = None self._padding = create_padding_tuple(padding) - return def __rich_console__(self, *args): yield self.get_string() def aprint(self, string): self._content.append(string.split("\n")) - return def show(self): print(self.get_string()) - return def get_string(self, remove_trailing_whitespace=True): lines = [] @@ -58,12 +55,9 @@ def get_string(self, remove_trailing_whitespace=True): def hist(self, *args, **kwargs): self._content.append(hist(*args, **kwargs)) - return def barh(self, *args, **kwargs): self._content.append(barh(*args, **kwargs)) - return def plot(self, *args, **kwargs): self._content.append(plot(*args, **kwargs)) - return From 6cf87e893bdc823afb74745e244656740b1ea14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 15 Feb 2021 13:40:25 +0100 Subject: [PATCH 2/4] remove more returns --- termplotlib/subplot.py | 2 -- test/test_barh.py | 3 --- test/test_figure.py | 6 ------ test/test_hist.py | 6 ------ test/test_plot.py | 3 --- test/test_subplot.py | 10 ---------- 6 files changed, 30 deletions(-) diff --git a/termplotlib/subplot.py b/termplotlib/subplot.py index 5b9e7f2..36125a0 100644 --- a/termplotlib/subplot.py +++ b/termplotlib/subplot.py @@ -60,11 +60,9 @@ def __init__( [Figure(self._column_widths[j], padding=padding) for j in range(layout[1])] for _ in range(layout[0]) ] - return def show(self): print(self.get_string()) - return def get_string(self): # compute column width diff --git a/test/test_barh.py b/test/test_barh.py index b785c3e..6b0ad76 100644 --- a/test/test_barh.py +++ b/test/test_barh.py @@ -24,7 +24,6 @@ def test_barh(): Geese [ 2] ████████\ """ ) - return def test_barh_ascii(): @@ -42,7 +41,6 @@ def test_barh_ascii(): Geese [ 2] ********\ """ ) - return @pytest.mark.skipif( @@ -64,7 +62,6 @@ def test_barh_floats(): Geese [0.2] █████████████▍\ """ ) - return if __name__ == "__main__": diff --git a/test/test_figure.py b/test/test_figure.py index 5126210..73b4537 100644 --- a/test/test_figure.py +++ b/test/test_figure.py @@ -6,7 +6,6 @@ def test_simple(): fig.aprint("abc") string = fig.get_string() assert string == """abc""" - return def test_padding_1(): @@ -19,7 +18,6 @@ def test_padding_1(): abc """ ) - return def test_padding_1b(): @@ -32,7 +30,6 @@ def test_padding_1b(): abc """ ) - return def test_padding_2(): @@ -45,7 +42,6 @@ def test_padding_2(): abc """ ) - return def test_padding_3(): @@ -60,7 +56,6 @@ def test_padding_3(): """ ) - return def test_padding_4(): @@ -76,4 +71,3 @@ def test_padding_4(): """ ) fig.show() - return diff --git a/test/test_hist.py b/test/test_hist.py index d5c0de0..27f8f57 100644 --- a/test/test_hist.py +++ b/test/test_hist.py @@ -34,7 +34,6 @@ def test_horizontal(): +2.89e+00 - +3.57e+00 [ 2] ▎\ """ ) - return def test_horizontal_ascii(): @@ -60,7 +59,6 @@ def test_horizontal_ascii(): +2.89e+00 - +3.57e+00 [ 2] *\ """ ) - return @pytest.mark.skipif( @@ -92,7 +90,6 @@ def test_vertical(): ▂ ▃▂▄▄█████████████████████████▅▃▁▂▁▁ ▁\ """ ) - return def test_vertical_ascii(): @@ -120,7 +117,6 @@ def test_vertical_ascii(): * *********************************** *\ """ ) - return @pytest.mark.skipif( @@ -151,7 +147,6 @@ def test_vertical_grid(): ▂ ▃▂▄▄████████▉█████████▉██████▅▃▁▂▁▁ ▁\ """ ) - return @pytest.mark.skipif( @@ -181,7 +176,6 @@ def test_vertical_strip(): ▃██▉██▉▂\ """ ) - return if __name__ == "__main__": diff --git a/test/test_plot.py b/test/test_plot.py index 2dd6375..8584edc 100644 --- a/test/test_plot.py +++ b/test/test_plot.py @@ -26,7 +26,6 @@ def test_plot(): 0 1 2 3 4 5 6 7""" assert string == ref - return def test_nolabel(): @@ -52,7 +51,6 @@ def test_nolabel(): 0 1 2 3 4 5 6 7""" assert string == ref - return def test_plot_lim(): @@ -88,4 +86,3 @@ def test_plot_lim(): x vals""" assert string == ref - return diff --git a/test/test_subplot.py b/test/test_subplot.py index 4c722dc..9319774 100644 --- a/test/test_subplot.py +++ b/test/test_subplot.py @@ -25,7 +25,6 @@ def test_subplot(): │ │ │ └─────────┴────────┘""" ) - return def test_subplot_custom_border(): @@ -41,7 +40,6 @@ def test_subplot_custom_border(): x x x xxxxxxxxxxxxxxxxxxxx""" ) - return def test_subplot2(): @@ -58,7 +56,6 @@ def test_subplot2(): ┃ ┃ ┃ ┗━━━━━━━━━┻━━━━━━━━┛""" ) - return def test_subplot_padding(): @@ -77,7 +74,6 @@ def test_subplot_padding(): ║ ║ ║ ╚═════════╩════════╝""" ) - return def test_subplot_3x2(): @@ -100,7 +96,6 @@ def test_subplot_3x2(): │ │ │ │ └────────────┴────────────┴────────────┘""" ) - return def test_subplot_ascii(): @@ -123,7 +118,6 @@ def test_subplot_ascii(): | | | | ----------------------------------------""" ) - return def test_subplot_thin_rounded(): @@ -146,7 +140,6 @@ def test_subplot_thin_rounded(): │ │ │ │ ╰────────────┴────────────┴────────────╯""" ) - return def test_subplot_custom(): @@ -173,7 +166,6 @@ def test_subplot_custom(): ) grid.show() - return def test_subplot_no_borders(): @@ -191,7 +183,6 @@ def test_subplot_no_borders(): even mor""" assert string == ref - return def test_subplot_column_widths(): @@ -216,7 +207,6 @@ def test_subplot_column_widths(): │ │ │ │ └──────────────────────────────┴───────────────┴────────────────────┘""" ) - return if __name__ == "__main__": From 9075352f4cac4787aa311414de2039748c23c40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 15 Feb 2021 13:40:59 +0100 Subject: [PATCH 3/4] blacken-docs --- Makefile | 1 + README.md | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3ea455e..93f5520 100644 --- a/Makefile +++ b/Makefile @@ -26,3 +26,4 @@ lint: format: isort . black . + blacken-docs README.md diff --git a/README.md b/README.md index 478c2b0..fe8df98 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,7 @@ Horizontal bar charts are covered as well. This ```python fig = tpl.figure() -fig.barh( - [3, 10, 5, 2], - ['Cats', 'Dogs', 'Cows', 'Geese'], - force_ascii=True -) +fig.barh([3, 10, 5, 2], ["Cats", "Dogs", "Cows", "Geese"], force_ascii=True) fig.show() ``` produces From 8dd1a66369a50f81da0dd390b1d49b368d650b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 15 Feb 2021 13:41:30 +0100 Subject: [PATCH 4/4] version bump --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c4957e9..d00cd63 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = termplotlib -version = 0.3.3 +version = 0.3.4 author = Nico Schlömer author_email = nico.schloemer@gmail.com description = Plotting on the command line