Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.13.0 #96

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.13.0] - 2023-09-29
### Added
- Tree Exporter: Export tree to flowchart diagram in mermaid markdown format using `tree_to_mermaid`.
### Changed
- Tree Exporter: Relax type hinting using TypeVar for `clone_tree`.
- Tree Helper: Accept Iterable instead of List for custom_style attribute of `yield_tree` and `print_tree`.
- Misc: Fix docstring for better presentation of code vs variable vs normal text.

## [0.12.5] - 2023-09-26
### Added
- Utility Groot: Add test cases.
Expand Down Expand Up @@ -333,6 +341,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Utility Iterator: Tree traversal methods.
- Workflow To Do App: Tree use case with to-do list implementation.

[0.13.0]: https://github.com/kayjan/bigtree/compare/0.12.5...0.13.0
[0.12.5]: https://github.com/kayjan/bigtree/compare/0.12.4...0.12.5
[0.12.4]: https://github.com/kayjan/bigtree/compare/0.12.3...0.12.4
[0.12.3]: https://github.com/kayjan/bigtree/compare/0.12.2...0.12.3
Expand Down
4 changes: 1 addition & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ The latest version of bigtree is supported with security updates.

| Version | Supported |
|---------| ------------------ |
| 0.9.x | :white_check_mark: |
| 0.10.x | :white_check_mark: |
| 0.11.x | :white_check_mark: |
| 0.12.x | :white_check_mark: |
| 0.13.x | :white_check_mark: |


## Reporting a Vulnerability
Expand Down
3 changes: 2 additions & 1 deletion bigtree/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.12.5"
__version__ = "0.13.0"

from bigtree.binarytree.construct import list_to_binarytree
from bigtree.dag.construct import dataframe_to_dag, dict_to_dag, list_to_dag
Expand Down Expand Up @@ -26,6 +26,7 @@
tree_to_dataframe,
tree_to_dict,
tree_to_dot,
tree_to_mermaid,
tree_to_nested_dict,
tree_to_pillow,
yield_tree,
Expand Down
2 changes: 1 addition & 1 deletion bigtree/binarytree/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def list_to_binarytree(

Args:
heapq_list (List[int]): list containing integer node names, ordered in heapq fashion
node_type (Type[BinaryNode]): node type of tree to be created, defaults to BinaryNode
node_type (Type[BinaryNode]): node type of tree to be created, defaults to ``BinaryNode``

Returns:
(BinaryNode)
Expand Down
6 changes: 3 additions & 3 deletions bigtree/dag/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def list_to_dag(

Args:
relations (List[Tuple[str, str]]): list containing tuple of parent-child names
node_type (Type[DAGNode]): node type of DAG to be created, defaults to DAGNode
node_type (Type[DAGNode]): node type of DAG to be created, defaults to ``DAGNode``

Returns:
(DAGNode)
Expand Down Expand Up @@ -68,7 +68,7 @@ def dict_to_dag(
relation_attrs (Dict[str, Any]): dictionary containing node, node parents, and node attribute information,
key: child name, value: dictionary of parent names, node attribute, and attribute value
parent_key (str): key of dictionary to retrieve list of parents name, defaults to 'parent'
node_type (Type[DAGNode]): node type of DAG to be created, defaults to DAGNode
node_type (Type[DAGNode]): node type of DAG to be created, defaults to ``DAGNode``

Returns:
(DAGNode)
Expand Down Expand Up @@ -133,7 +133,7 @@ def dataframe_to_dag(
if not set, it will take the second column of data
attribute_cols (List[str]): columns of data containing child node attribute information,
if not set, it will take all columns of data except `child_col` and `parent_col`
node_type (Type[DAGNode]): node type of DAG to be created, defaults to DAGNode
node_type (Type[DAGNode]): node type of DAG to be created, defaults to ``DAGNode``

Returns:
(DAGNode)
Expand Down
44 changes: 22 additions & 22 deletions bigtree/tree/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def add_path_to_tree(
"""Add nodes and attributes to existing tree *in-place*, return node of added path.
Adds to existing tree from list of path strings.

Path should contain `Node` name, separated by `sep`.
Path should contain ``Node`` name, separated by `sep`.
- For example: Path string "a/b" refers to Node("b") with parent Node("a").
- Path separator `sep` is for the input `path` and can differ from existing tree.

Expand All @@ -67,7 +67,7 @@ def add_path_to_tree(
tree (Node): existing tree
path (str): path to be added to tree
sep (str): path separator for input `path`
duplicate_name_allowed (bool): indicator if nodes with duplicate `Node` name is allowed, defaults to True
duplicate_name_allowed (bool): indicator if nodes with duplicate ``Node`` name is allowed, defaults to True
node_attrs (Dict[str, Any]): attributes to add to node, key: attribute name, value: attribute value, optional

Returns:
Expand Down Expand Up @@ -122,7 +122,7 @@ def add_dict_to_tree_by_path(
"""Add nodes and attributes to tree *in-place*, return root of tree.
Adds to existing tree from nested dictionary, ``key``: path, ``value``: dict of attribute name and attribute value.

Path should contain `Node` name, separated by `sep`.
Path should contain ``Node`` name, separated by `sep`.
- For example: Path string "a/b" refers to Node("b") with parent Node("a").
- Path separator `sep` is for the input `path` and can differ from existing tree.

Expand Down Expand Up @@ -160,7 +160,7 @@ def add_dict_to_tree_by_path(
path_attrs (Dict[str, Dict[str, Any]]): dictionary containing node path and attribute information,
key: node path, value: dict of node attribute name and attribute value
sep (str): path separator for input `path_attrs`
duplicate_name_allowed (bool): indicator if nodes with duplicate `Node` name is allowed, defaults to True
duplicate_name_allowed (bool): indicator if nodes with duplicate ``Node`` name is allowed, defaults to True

Returns:
(Node)
Expand Down Expand Up @@ -209,7 +209,7 @@ def add_dict_to_tree_by_name(
name_attrs (Dict[str, Dict[str, Any]]): dictionary containing node name and attribute information,
key: node name, value: dict of node attribute name and attribute value
join_type (str): join type with attribute, default of 'left' takes existing tree nodes,
if join_type is set to 'inner' it will only take tree nodes that are in `path_attrs` key and drop others
if join_type is set to 'inner' it will only take tree nodes that are in `name_attrs` key and drop others

Returns:
(Node)
Expand Down Expand Up @@ -238,7 +238,7 @@ def add_dataframe_to_tree_by_path(
`path_col` and `attribute_cols` specify columns for node path and attributes to add to existing tree.
If columns are not specified, `path_col` takes first column and all other columns are `attribute_cols`

Path in path column should contain `Node` name, separated by `sep`.
Path in path column should contain ``Node`` name, separated by `sep`.
- For example: Path string "a/b" refers to Node("b") with parent Node("a").
- Path separator `sep` is for the input `path` and can differ from existing tree.

Expand Down Expand Up @@ -282,7 +282,7 @@ def add_dataframe_to_tree_by_path(
attribute_cols (List[str]): columns of data containing node attribute information,
if not set, it will take all columns of data except `path_col`
sep (str): path separator for input `path_col`
duplicate_name_allowed (bool): indicator if nodes with duplicate `Node` name is allowed, defaults to True
duplicate_name_allowed (bool): indicator if nodes with duplicate ``Node`` name is allowed, defaults to True

Returns:
(Node)
Expand Down Expand Up @@ -368,7 +368,7 @@ def add_dataframe_to_tree_by_name(
name_col (str): column of data containing `name` information,
if not set, it will take the first column of data
attribute_cols (List[str]): column(s) of data containing node attribute information,
if not set, it will take all columns of data except path_col
if not set, it will take all columns of data except `path_col`
join_type (str): join type with attribute, default of 'left' takes existing tree nodes,
if join_type is set to 'inner' it will only take tree nodes with attributes and drop the other nodes

Expand Down Expand Up @@ -450,7 +450,7 @@ def str_to_tree(
tree_string (str): String to construct tree
tree_prefix_list (List[str]): List of prefix to mark the end of tree branch/stem and start of node name, optional.
If not specified, it will infer unicode characters and whitespace as prefix.
node_type (Type[Node]): node type of tree to be created, defaults to Node
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down Expand Up @@ -502,7 +502,7 @@ def list_to_tree(
) -> Node:
"""Construct tree from list of path strings.

Path should contain `Node` name, separated by `sep`.
Path should contain ``Node`` name, separated by `sep`.
- For example: Path string "a/b" refers to Node("b") with parent Node("a").

Path can start from root node `name`, or start with `sep`.
Expand All @@ -527,8 +527,8 @@ def list_to_tree(
Args:
paths (Iterable[str]): list containing path strings
sep (str): path separator for input `paths` and created tree, defaults to `/`
duplicate_name_allowed (bool): indicator if nodes with duplicate `Node` name is allowed, defaults to True
node_type (Type[Node]): node type of tree to be created, defaults to Node
duplicate_name_allowed (bool): indicator if nodes with duplicate ``Node`` name is allowed, defaults to True
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down Expand Up @@ -581,7 +581,7 @@ def list_to_tree_by_relation(
relations (Iterable[Tuple[str, str]]): list containing tuple containing parent-child names
allow_duplicates (bool): allow duplicate intermediate nodes such that child node will
be tagged to multiple parent nodes, defaults to False
node_type (Type[Node]): node type of tree to be created, defaults to Node
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down Expand Up @@ -609,7 +609,7 @@ def dict_to_tree(
"""Construct tree from nested dictionary using path,
``key``: path, ``value``: dict of attribute name and attribute value.

Path should contain `Node` name, separated by `sep`.
Path should contain ``Node`` name, separated by `sep`.
- For example: Path string "a/b" refers to Node("b") with parent Node("a").

Path can start from root node `name`, or start with `sep`.
Expand Down Expand Up @@ -644,8 +644,8 @@ def dict_to_tree(
path_attrs (Dict[str, Any]): dictionary containing path and node attribute information,
key: path, value: dict of tree attribute and attribute value
sep (str): path separator of input `path_attrs` and created tree, defaults to `/`
duplicate_name_allowed (bool): indicator if nodes with duplicate `Node` name is allowed, defaults to True
node_type (Type[Node]): node type of tree to be created, defaults to Node
duplicate_name_allowed (bool): indicator if nodes with duplicate ``Node`` name is allowed, defaults to True
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down Expand Up @@ -704,7 +704,7 @@ def nested_dict_to_tree(
value of `child_key` (List[Dict[str, Any]]): list of dict containing `name_key` and `child_key` (recursive)
name_key (str): key of node name, value is type str
child_key (str): key of child list, value is type list
node_type (Type[Node]): node type of tree to be created, defaults to Node
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down Expand Up @@ -747,7 +747,7 @@ def dataframe_to_tree(
Path in path column can start from root node `name`, or start with `sep`.
- For example: Path string can be "/a/b" or "a/b", if sep is "/".

Path in path column should contain `Node` name, separated by `sep`.
Path in path column should contain ``Node`` name, separated by `sep`.
- For example: Path string "a/b" refers to Node("b") with parent Node("a").

All paths should start from the same root node.
Expand Down Expand Up @@ -785,8 +785,8 @@ def dataframe_to_tree(
attribute_cols (List[str]): columns of data containing node attribute information,
if not set, it will take all columns of data except `path_col`
sep (str): path separator of input `path_col` and created tree, defaults to `/`
duplicate_name_allowed (bool): indicator if nodes with duplicate `Node` name is allowed, defaults to True
node_type (Type[Node]): node type of tree to be created, defaults to Node
duplicate_name_allowed (bool): indicator if nodes with duplicate ``Node`` name is allowed, defaults to True
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down Expand Up @@ -856,7 +856,7 @@ def dataframe_to_tree_by_relation(
This error can be ignored by setting `allow_duplicates` to be True.

`child_col` and `parent_col` specify columns for child name and parent name to construct tree.
`attribute_cols` specify columns for node attribute for child name
`attribute_cols` specify columns for node attribute for child name.
If columns are not specified, `child_col` takes first column, `parent_col` takes second column, and all other
columns are `attribute_cols`.

Expand Down Expand Up @@ -895,7 +895,7 @@ def dataframe_to_tree_by_relation(
if not set, it will take all columns of data except `child_col` and `parent_col`
allow_duplicates (bool): allow duplicate intermediate nodes such that child node will
be tagged to multiple parent nodes, defaults to False
node_type (Type[Node]): node type of tree to be created, defaults to Node
node_type (Type[Node]): node type of tree to be created, defaults to ``Node``

Returns:
(Node)
Expand Down
Loading