Rename jsonify_tree() to render_json()
This commit is contained in:
parent
6f70dd5508
commit
1262d7ce55
|
@ -323,8 +323,8 @@ def render_tree(tree, list_all=True, show_only=None, frozen=False):
|
|||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def jsonify_tree(tree, indent):
|
||||
"""Converts the tree into json representation.
|
||||
def render_json(tree, indent):
|
||||
"""Converts the tree into a flat json representation.
|
||||
|
||||
The json repr will be a list of hashes, each hash having 2 fields:
|
||||
- package
|
||||
|
@ -505,7 +505,7 @@ def main():
|
|||
tree = construct_tree(dist_index)
|
||||
|
||||
if args.json:
|
||||
print(jsonify_tree(tree, indent=4))
|
||||
print(render_json(tree, indent=4))
|
||||
return 0
|
||||
elif args.output_format:
|
||||
output = dump_graphviz(tree, output_format=args.output_format)
|
||||
|
|
|
@ -9,7 +9,7 @@ from operator import attrgetter
|
|||
from pipdeptree import (build_dist_index, construct_tree,
|
||||
DistPackage, ReqPackage, render_tree,
|
||||
reverse_tree, cyclic_deps, conflicting_deps,
|
||||
get_parser, jsonify_tree, dump_graphviz,
|
||||
get_parser, render_json, dump_graphviz,
|
||||
print_graphviz)
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ def test_render_tree_freeze():
|
|||
|
||||
|
||||
def test_render_json(capsys):
|
||||
output = jsonify_tree(tree, indent=4)
|
||||
output = render_json(tree, indent=4)
|
||||
print_graphviz(output)
|
||||
out, _ = capsys.readouterr()
|
||||
assert out.startswith('[\n {\n "')
|
||||
|
|
Loading…
Reference in New Issue