Skip to content

Commit

Permalink
Merge pull request #57 from nschloe/upda
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
nschloe authored Feb 15, 2021
2 parents f4c42a7 + 8dd1a66 commit 2b62156
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 45 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand All @@ -26,3 +26,4 @@ lint:
format:
isort .
black .
blacken-docs README.md
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ Horizontal bar charts are covered as well. This
<!--exdown-skip-->
```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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = termplotlib
version = 0.3.3
version = 0.3.4
author = Nico Schlömer
author_email = [email protected]
description = Plotting on the command line
Expand Down
6 changes: 0 additions & 6 deletions termplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
2 changes: 0 additions & 2 deletions termplotlib/subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions test/test_barh.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def test_barh():
Geese [ 2] ████████\
"""
)
return


def test_barh_ascii():
Expand All @@ -42,7 +41,6 @@ def test_barh_ascii():
Geese [ 2] ********\
"""
)
return


@pytest.mark.skipif(
Expand All @@ -64,7 +62,6 @@ def test_barh_floats():
Geese [0.2] █████████████▍\
"""
)
return


if __name__ == "__main__":
Expand Down
6 changes: 0 additions & 6 deletions test/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ def test_simple():
fig.aprint("abc")
string = fig.get_string()
assert string == """abc"""
return


def test_padding_1():
Expand All @@ -19,7 +18,6 @@ def test_padding_1():
abc
"""
)
return


def test_padding_1b():
Expand All @@ -32,7 +30,6 @@ def test_padding_1b():
abc
"""
)
return


def test_padding_2():
Expand All @@ -45,7 +42,6 @@ def test_padding_2():
abc
"""
)
return


def test_padding_3():
Expand All @@ -60,7 +56,6 @@ def test_padding_3():
"""
)
return


def test_padding_4():
Expand All @@ -76,4 +71,3 @@ def test_padding_4():
"""
)
fig.show()
return
6 changes: 0 additions & 6 deletions test/test_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def test_horizontal():
+2.89e+00 - +3.57e+00 [ 2] ▎\
"""
)
return


def test_horizontal_ascii():
Expand All @@ -60,7 +59,6 @@ def test_horizontal_ascii():
+2.89e+00 - +3.57e+00 [ 2] *\
"""
)
return


@pytest.mark.skipif(
Expand Down Expand Up @@ -92,7 +90,6 @@ def test_vertical():
▂ ▃▂▄▄█████████████████████████▅▃▁▂▁▁ ▁\
"""
)
return


def test_vertical_ascii():
Expand Down Expand Up @@ -120,7 +117,6 @@ def test_vertical_ascii():
* *********************************** *\
"""
)
return


@pytest.mark.skipif(
Expand Down Expand Up @@ -151,7 +147,6 @@ def test_vertical_grid():
▂ ▃▂▄▄████████▉█████████▉██████▅▃▁▂▁▁ ▁\
"""
)
return


@pytest.mark.skipif(
Expand Down Expand Up @@ -181,7 +176,6 @@ def test_vertical_strip():
▃██▉██▉▂\
"""
)
return


if __name__ == "__main__":
Expand Down
3 changes: 0 additions & 3 deletions test/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def test_plot():
0 1 2 3 4 5 6 7"""

assert string == ref
return


def test_nolabel():
Expand All @@ -52,7 +51,6 @@ def test_nolabel():
0 1 2 3 4 5 6 7"""

assert string == ref
return


def test_plot_lim():
Expand Down Expand Up @@ -88,4 +86,3 @@ def test_plot_lim():
x vals"""

assert string == ref
return
10 changes: 0 additions & 10 deletions test/test_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def test_subplot():
│ │ │
└─────────┴────────┘"""
)
return


def test_subplot_custom_border():
Expand All @@ -41,7 +40,6 @@ def test_subplot_custom_border():
x x x
xxxxxxxxxxxxxxxxxxxx"""
)
return


def test_subplot2():
Expand All @@ -58,7 +56,6 @@ def test_subplot2():
┃ ┃ ┃
┗━━━━━━━━━┻━━━━━━━━┛"""
)
return


def test_subplot_padding():
Expand All @@ -77,7 +74,6 @@ def test_subplot_padding():
║ ║ ║
╚═════════╩════════╝"""
)
return


def test_subplot_3x2():
Expand All @@ -100,7 +96,6 @@ def test_subplot_3x2():
│ │ │ │
└────────────┴────────────┴────────────┘"""
)
return


def test_subplot_ascii():
Expand All @@ -123,7 +118,6 @@ def test_subplot_ascii():
| | | |
----------------------------------------"""
)
return


def test_subplot_thin_rounded():
Expand All @@ -146,7 +140,6 @@ def test_subplot_thin_rounded():
│ │ │ │
╰────────────┴────────────┴────────────╯"""
)
return


def test_subplot_custom():
Expand All @@ -173,7 +166,6 @@ def test_subplot_custom():
)

grid.show()
return


def test_subplot_no_borders():
Expand All @@ -191,7 +183,6 @@ def test_subplot_no_borders():
even mor"""

assert string == ref
return


def test_subplot_column_widths():
Expand All @@ -216,7 +207,6 @@ def test_subplot_column_widths():
│ │ │ │
└──────────────────────────────┴───────────────┴────────────────────┘"""
)
return


if __name__ == "__main__":
Expand Down

0 comments on commit 2b62156

Please sign in to comment.