mbr / asciitree Goto Github PK
View Code? Open in Web Editor NEW+-- ASCII Trees.
License: MIT License
+-- ASCII Trees.
License: MIT License
Since there was a critical fix to make this package work for Python 3 (#4), could a new release be pushed to PyPI? Presumably this would be 0.3.2?
Would be nice if there was a way to check if a child will have children or not through some mechanism in Style
. Not entirely sure what that would be yet, but it would be really handy for handling cases like opening and closing tags.
To provide a concrete example, am trying to generate some HTML and CSS to make a visualization like this one (item 4) The HTML code being generated needs to look something like this. So would want to be able to add <li>
/</li>
tags based on whether children are present or not.
When running the example I am getting this:
File "/usr/local/lib/python3.5/dist-packages/asciitree/__init__.py", line 48, in __call__
return '\n'.join(self.render(self.traverse.get_root(tree)))
File "/usr/local/lib/python3.5/dist-packages/asciitree/traversal.py", line 29, in get_root
return tree.items()[0]
TypeError: 'dict_items' object does not support indexing
I am on linux 64 with python 3.5.2
When using unicode labels you currently get a crash on Python 2. Monkey-patching like this fixes the crash:
import asciitree
asciitree.drawing.Style.label_format = u"{}"
... but it would of course be nicer not to have to do that.
Can I ask for a "u" to be added the the formatting string in asciitree.drawing.Style.label_format?
Hi,
I would love to run the test suite while building packages for openSUSE distro. It would be the easiest if the tests/
directory was also packaged in the distribution tarball. Could you please add to MANIFEST.in
file this one line
recursive-include tests *
, please?
Thank you.
I was thinking of using asciitree
to represent arithmetic expressions as trees, eg (2 * 2)
:
*
+-- 2
+-- 2
But this seems not to work, because one 2
overwrites the other, in the OrderedDict
.
Here is my code:
from asciitree import LeftAligned
from collections import OrderedDict as OD
tree = {
'*': OD([
('2', {}),
('2', {})
])
}
tr = LeftAligned()
print(tr(tree))
and output:
*
+-- 2
I guess the workaround would be to invent unique names for each 2
?
In some contexts it might be desired to use a non-breaking space (U+00A0) or some other larger space character rather than the "ordinary" spaces the library currently uses.
The best place to add this would probably be as another character in the BoxStyle.gfx
dict, although you may have a better idea.
In the event that one needs to customize how the first child appears, it would be nice to have first_child_head
and first_child_tail
. Also would be nice if LeftAligned
handled the case of the first child separately.
Thanks for this useful library! I'm just filing this issue to collect interest in having wheels for this library.
This is very useful and does exactly what I need!
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.