You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1,13 +1,20 @@
# Changelog
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.9.5] - 2023-07-13+### Added+- Misc: Added init files, add link to discussions to README and pyproject, add sphinx coverage shortcuts.+### Fixed+- [#66] DAGNode/Node: Children constructor to allow Iterable types, fixed issue of lists being mutable.+- [#67] Node: `path_name` to reduce number of recursive calls to root node for `sep`.+
## [0.9.4] - 2023-06-18
### Added
- Tree Constructor: `list_to_tree_by_relation` and `dataframe_to_tree_by_relation` method to allow duplicate intermediate nodes (default is false).
- DAG Exporter: Added `node_shape` parameter in `dag_to_dot` export function for easier way to customize node shape.
- Misc: More test cases.
- Misc: Added security instructions on how to raise vulnerabilities.
- Misc: Added Calendar workflow to documentation.
@@ -273,14 +280,15 @@
- Tree Exporter: To list, nested dictionary, pandas DataFrame.
- Tree Helper: Cloning, pruning trees, get difference between two trees.
- Tree Modifier: Shift and copy nodes within tree and between trees.
- Tree Search: Find single or multiple nodes based on name, attribute, or custom criteria.
- Utility Iterator: Tree traversal methods.
- Workflow To Do App: Tree use case with to-do list implementation.
+[0.9.5]: https://github.com/kayjan/bigtree/compare/0.9.4...0.9.5
[0.9.4]: https://github.com/kayjan/bigtree/compare/0.9.3...0.9.4
[0.9.3]: https://github.com/kayjan/bigtree/compare/0.9.2...0.9.3
[0.9.2]: https://github.com/kayjan/bigtree/compare/0.9.1...0.9.2
[0.9.1]: https://github.com/kayjan/bigtree/compare/0.9.0...0.9.1
[0.9.0]: https://github.com/kayjan/bigtree/compare/0.8.4...0.9.0
[0.8.4]: https://github.com/kayjan/bigtree/compare/0.8.3...0.8.4
[0.8.3]: https://github.com/kayjan/bigtree/compare/0.8.2...0.8.3
@@ -246,30 +246,30 @@
"""Do not allow `parents` attribute to be set
Args:
new_parent (Self): parent node
"""
raise ValueError("Attempting to set `parents` attribute, do you mean `parent`?")
- def __check_children_type(self: T, new_children: List[T]) -> None:+ def __check_children_type(self: T, new_children: Iterable[T]) -> None:
"""Check child type
Args:
- new_children (List[Self]): child node+ new_children (Iterable[Self]): child node
"""
- if not isinstance(new_children, list):+ if not isinstance(new_children, Iterable):
raise TypeError(
- f"Children input should be list type, received input type {type(new_children)}"+ f"Children input should be Iterable type, received input type {type(new_children)}"
)
- def __check_children_loop(self: T, new_children: List[T]) -> None:+ def __check_children_loop(self: T, new_children: Iterable[T]) -> None:
"""Check child loop
Args:
- new_children (List[Self]): child node+ new_children (Iterable[Self]): child node
"""
seen_children = []
for new_child in new_children:
# Check type
if not isinstance(new_child, BaseNode):
raise TypeError(
f"Expect input to be BaseNode type, received input type {type(new_child)}"
@@ -297,22 +297,23 @@
Returns:
(Tuple[Self, ...])
"""
return tuple(self.__children)
@children.setter
- def children(self: T, new_children: List[T]) -> None:+ def children(self: T, new_children: Iterable[T]) -> None:
"""Set child nodes
Args:
new_children (List[Self]): child node
"""
self.__check_children_type(new_children)
self.__check_children_loop(new_children)
+ new_children = list(new_children)
current_new_children = {
new_child: (new_child.parent.__children.index(new_child), new_child.parent)
for new_child in new_children
if new_child.parent is not None
}
current_new_orphan = [
@@ -351,29 +352,29 @@
@children.deleter
def children(self) -> None:
"""Delete child node(s)"""
for child in self.children:
child.parent.__children.remove(child) # type: ignore
child.__parent = None
- def __pre_assign_children(self: T, new_children: List[T]) -> None:+ def __pre_assign_children(self: T, new_children: Iterable[T]) -> None:
"""Custom method to check before attaching children
Can be overriden with `_BaseNode__pre_assign_children()`
Args:
- new_children (List[Self]): new children to be added+ new_children (Iterable[Self]): new children to be added
"""
pass
- def __post_assign_children(self: T, new_children: List[T]) -> None:+ def __post_assign_children(self: T, new_children: Iterable[T]) -> None:
"""Custom method to check after attaching children
Can be overriden with `_BaseNode__post_assign_children()`
Args:
- new_children (List[Self]): new children to be added+ new_children (Iterable[Self]): new children to be added
"""
pass
@property
def ancestors(self: T) -> Iterable[T]:
"""Get iterator to yield all ancestors of self, does not include self
@@ -236,30 +236,30 @@
Can be overriden with `_DAGNode__post_assign_parent()`
Args:
new_parents (List[Self]): new parents to be added
"""
pass
- def __check_children_type(self: T, new_children: List[T]) -> None:+ def __check_children_type(self: T, new_children: Iterable[T]) -> None:
"""Check child type
Args:
- new_children (List[Self]): child node+ new_children (Iterable[Self]): child node
"""
- if not isinstance(new_children, list):+ if not isinstance(new_children, Iterable):
raise TypeError(
- f"Children input should be list type, received input type {type(new_children)}"+ f"Children input should be Iterable type, received input type {type(new_children)}"
)
- def __check_children_loop(self: T, new_children: List[T]) -> None:+ def __check_children_loop(self: T, new_children: Iterable[T]) -> None:
"""Check child loop
Args:
- new_children (List[Self]): child node+ new_children (Iterable[Self]): child node
"""
seen_children = []
for new_child in new_children:
# Check type
if not isinstance(new_child, DAGNode):
raise TypeError(
f"Expect input to be DAGNode type, received input type {type(new_child)}"
@@ -287,19 +287,19 @@
Returns:
(Iterable[Self])
"""
return tuple(self.__children)
@children.setter
- def children(self: T, new_children: List[T]) -> None:+ def children(self: T, new_children: Iterable[T]) -> None:
"""Set child nodes
Args:
- new_children (List[Self]): child node+ new_children (Iterable[Self]): child node
"""
self.__check_children_type(new_children)
self.__check_children_loop(new_children)
current_children = list(self.children)
# Assign new children - rollback if error
@@ -315,24 +315,24 @@
# Reassign old children to self
for new_child in new_children:
if new_child not in current_children:
new_child.__parents.remove(self)
self.__children.remove(new_child)
raise TreeError(exc_info)
- def __pre_assign_children(self: T, new_children: List[T]) -> None:+ def __pre_assign_children(self: T, new_children: Iterable[T]) -> None:
"""Custom method to check before attaching children
Can be overriden with `_DAGNode__pre_assign_children()`
Args:
new_children (List[Self]): new children to be added
"""
pass
- def __post_assign_children(self: T, new_children: List[T]) -> None:+ def __post_assign_children(self: T, new_children: Iterable[T]) -> None:
"""Custom method to check after attaching children
Can be overriden with `_DAGNode__post_assign_children()`
Args:
new_children (List[Self]): new children to be added
"""
pass
@@ -110,17 +110,17 @@
@property
def path_name(self) -> str:
"""Get path name, separated by self.sep
Returns:
(str)
"""
- if self.parent is None:- return f"{self.sep}{self.name}"- return f"{self.parent.path_name}{self.sep}{self.name}"+ ancestors = [self] + list(self.ancestors)+ sep = ancestors[-1].sep+ return sep + sep.join([node.name for node in reversed(ancestors)])
def __pre_assign_children(self: T, new_children: List[T]) -> None:
"""Custom method to check before attaching children
Can be overriden with `_Node__pre_assign_children()`
Args:
new_children (List[Self]): new children to be added
@@ -46,15 +46,15 @@
ERROR_SET_DUPLICATE_CHILD = (
"Error setting child: Node cannot be added multiple times as a child"
)
ERROR_SET_DUPLICATE_PARENT = (
"Error setting parent: Node cannot be added multiple times as a parent"
)
- ERROR_CHILDREN_TYPE = "Children input should be list type, received input type"+ ERROR_CHILDREN_TYPE = "Children input should be Iterable type, received input type"
ERROR_BASENODE_CHILDREN_TYPE = (
"Expect input to be BaseNode type, received input type"
)
ERROR_BASENODE_PARENT_TYPE = (
"Expect input to be BaseNode type or NoneType, received input type"
)
@@ -7,14 +7,15 @@
----
Related Links:
- [Documentation](https://bigtree.readthedocs.io/en/latest/)
- [GitHub](https://github.com/kayjan/bigtree/)
- [Changelog](https://github.com/kayjan/bigtree/blob/master/CHANGELOG.md)
- [Issues](https://github.com/kayjan/bigtree/issues)
+- [Discussions](https://github.com/kayjan/bigtree/discussions)
- [Contributing](https://bigtree.readthedocs.io/en/latest/others/contributing.html)
- [PyPI](https://pypi.org/project/bigtree/)
- Articles
- [Python Tree Implementation with BigTree](https://towardsdatascience.com/python-tree-implementation-with-bigtree-13cdabd77adc#245a-94ae81f0b3f1)
- <div><p>If you want to support bigtree, <a href="https://www.buymeacoffee.com/kayjan"><img src="https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black" alt="Buy Me a Coffee" style="vertical-align:middle"></a></p></div>
----
html2text {}
@@ -1,17 +1,18 @@
# Big Tree Python Package Tree Implementation for Python, integrated with
Python list, dictionary, and pandas DataFrame. It is pythonic, making it easy
to learn and extendable to many types of workflows. ---- Related Links: -
[Documentation](https://bigtree.readthedocs.io/en/latest/) - [GitHub](https://
github.com/kayjan/bigtree/) - [Changelog](https://github.com/kayjan/bigtree/
blob/master/CHANGELOG.md) - [Issues](https://github.com/kayjan/bigtree/issues)
-- [Contributing](https://bigtree.readthedocs.io/en/latest/others/-contributing.html) - [PyPI](https://pypi.org/project/bigtree/) - Articles --[Python Tree Implementation with BigTree](https://towardsdatascience.com/-python-tree-implementation-with-bigtree-13cdabd77adc#245a-94ae81f0b3f1) -+- [Discussions](https://github.com/kayjan/bigtree/discussions) - [Contributing]+(https://bigtree.readthedocs.io/en/latest/others/contributing.html) - [PyPI]+(https://pypi.org/project/bigtree/) - Articles - [Python Tree Implementation+with BigTree](https://towardsdatascience.com/python-tree-implementation-with-+bigtree-13cdabd77adc#245a-94ae81f0b3f1) -
If you want to support bigtree,_�[_�B_�u_�y_� _�M_�e_� _�a_� _�C_�o_�f_�f_�e_�e_�]
---- ## Components There are 3 segments to Big Tree consisting of Tree, Binary
Tree, and Directed Acyclic Graph (DAG) implementation. For **Tree**
implementation, there are 8 main components. 1. [**Node**](https://
bigtree.readthedocs.io/en/latest/node.html) 1. ``BaseNode``, extendable class
2. ``Node``, BaseNode with node name attribute 2. [**Constructing Tree**]
(https://bigtree.readthedocs.io/en/latest/bigtree/tree/construct.html) 1. From
@@ -1,13 +1,14 @@
Metadata-Version: 2.1
Name: bigtree
-Version: 0.9.4+Version: 0.9.5
Summary: Tree Implementation for Python, integrated with Python list, dictionary, and pandas DataFrame.
Project-URL: Documentation, https://bigtree.readthedocs.io
Project-URL: Issues, https://github.com/kayjan/bigtree/issues
+Project-URL: Discussions, https://github.com/kayjan/bigtree/discussions
Project-URL: Source, https://github.com/kayjan/bigtree
Author-email: Kay Jan <[email protected]>
License-Expression: MIT
License-File: LICENSE
Keywords: bigtree,tree
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
@@ -34,14 +35,15 @@
----
Related Links:
- [Documentation](https://bigtree.readthedocs.io/en/latest/)
- [GitHub](https://github.com/kayjan/bigtree/)
- [Changelog](https://github.com/kayjan/bigtree/blob/master/CHANGELOG.md)
- [Issues](https://github.com/kayjan/bigtree/issues)
+- [Discussions](https://github.com/kayjan/bigtree/discussions)
- [Contributing](https://bigtree.readthedocs.io/en/latest/others/contributing.html)
- [PyPI](https://pypi.org/project/bigtree/)
- Articles
- [Python Tree Implementation with BigTree](https://towardsdatascience.com/python-tree-implementation-with-bigtree-13cdabd77adc#245a-94ae81f0b3f1)
- <div><p>If you want to support bigtree, <a href="https://www.buymeacoffee.com/kayjan"><img src="https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black" alt="Buy Me a Coffee" style="vertical-align:middle"></a></p></div>
----
html2text {}
@@ -1,12 +1,13 @@-Metadata-Version: 2.1 Name: bigtree Version: 0.9.4 Summary: Tree Implementation+Metadata-Version: 2.1 Name: bigtree Version: 0.9.5 Summary: Tree Implementation
for Python, integrated with Python list, dictionary, and pandas DataFrame.
Project-URL: Documentation, https://bigtree.readthedocs.io Project-URL: Issues,
-https://github.com/kayjan/bigtree/issues Project-URL: Source, https://-github.com/kayjan/bigtree Author-email: Kay Jan+https://github.com/kayjan/bigtree/issues Project-URL: Discussions, https://+github.com/kayjan/bigtree/discussions Project-URL: Source, https://github.com/+kayjan/bigtree Author-email: Kay Jan
gmail.com> License-Expression: MIT License-File: LICENSE Keywords: bigtree,tree
Classifier: Development Status :: 4 - Beta Classifier: Programming Language ::
Python Classifier: Programming Language :: Python :: 3.7 Classifier:
Programming Language :: Python :: 3.8 Classifier: Programming Language ::
Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier:
Programming Language :: Python :: 3.11 Classifier: Programming Language ::
Python :: Implementation :: CPython Classifier: Programming Language :: Python
@@ -15,18 +16,19 @@
pydot; extra == 'image' Description-Content-Type: text/markdown # Big Tree
Python Package Tree Implementation for Python, integrated with Python list,
dictionary, and pandas DataFrame. It is pythonic, making it easy to learn and
extendable to many types of workflows. ---- Related Links: - [Documentation]
(https://bigtree.readthedocs.io/en/latest/) - [GitHub](https://github.com/
kayjan/bigtree/) - [Changelog](https://github.com/kayjan/bigtree/blob/master/
CHANGELOG.md) - [Issues](https://github.com/kayjan/bigtree/issues) -
-[Contributing](https://bigtree.readthedocs.io/en/latest/others/-contributing.html) - [PyPI](https://pypi.org/project/bigtree/) - Articles --[Python Tree Implementation with BigTree](https://towardsdatascience.com/-python-tree-implementation-with-bigtree-13cdabd77adc#245a-94ae81f0b3f1) -+[Discussions](https://github.com/kayjan/bigtree/discussions) - [Contributing]+(https://bigtree.readthedocs.io/en/latest/others/contributing.html) - [PyPI]+(https://pypi.org/project/bigtree/) - Articles - [Python Tree Implementation+with BigTree](https://towardsdatascience.com/python-tree-implementation-with-+bigtree-13cdabd77adc#245a-94ae81f0b3f1) -
If you want to support bigtree,_�[_�B_�u_�y_� _�M_�e_� _�a_� _�C_�o_�f_�f_�e_�e_�]
---- ## Components There are 3 segments to Big Tree consisting of Tree, Binary
Tree, and Directed Acyclic Graph (DAG) implementation. For **Tree**
implementation, there are 8 main components. 1. [**Node**](https://
bigtree.readthedocs.io/en/latest/node.html) 1. ``BaseNode``, extendable class
2. ``Node``, BaseNode with node name attribute 2. [**Constructing Tree**]
(https://bigtree.readthedocs.io/en/latest/bigtree/tree/construct.html) 1. From