From c90904a7223321ec97cc2c05d13c3b46802e69ae Mon Sep 17 00:00:00 2001 From: Kay Date: Sat, 2 May 2026 08:58:57 +0800 Subject: [PATCH 1/3] bump: v1.4.1 --- CHANGELOG.md | 5 ++++- bigtree/__init__.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a9aa643..932f1da8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ 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). ## [Unreleased] + +## [1.4.1] - 2026-05-02 ### Changed: - Tree Search: Modify type hint to include returning None - Misc: Clean up and remove redundant lines. @@ -912,7 +914,8 @@ ignore null attribute columns. - Utility Iterator: Tree traversal methods. - Workflow To Do App: Tree use case with to-do list implementation. -[Unreleased]: https://github.com/kayjan/bigtree/compare/1.4.0...HEAD +[Unreleased]: https://github.com/kayjan/bigtree/compare/1.4.1...HEAD +[1.4.1]: https://github.com/kayjan/bigtree/compare/1.4.0...1.4.1 [1.4.0]: https://github.com/kayjan/bigtree/compare/1.3.1...1.4.0 [1.3.1]: https://github.com/kayjan/bigtree/compare/1.3.0...1.3.1 [1.3.0]: https://github.com/kayjan/bigtree/compare/1.2.0...1.3.0 diff --git a/bigtree/__init__.py b/bigtree/__init__.py index 4ceec3c6..a143f2dd 100644 --- a/bigtree/__init__.py +++ b/bigtree/__init__.py @@ -1,4 +1,4 @@ -__version__ = "1.4.0" +__version__ = "1.4.1" from bigtree._globals import Globals from bigtree.binarytree.binarytree import BinaryTree From cf1ae041f24e744ca2887522ad4b28136c3e74af Mon Sep 17 00:00:00 2001 From: Kay Date: Wed, 6 May 2026 02:14:21 +0800 Subject: [PATCH 2/3] docs: enhance mypy - warn if no return --- bigtree/node/basenode.py | 2 ++ bigtree/tree/helper.py | 3 ++- bigtree/tree/search.py | 10 +++------- pyproject.toml | 1 - 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bigtree/node/basenode.py b/bigtree/node/basenode.py index 84a7eda0..37bde59c 100644 --- a/bigtree/node/basenode.py +++ b/bigtree/node/basenode.py @@ -458,6 +458,7 @@ def left_sibling(self: T) -> T | None: child_idx = children.index(self) if child_idx: return self.parent.children[child_idx - 1] + return None @property def right_sibling(self: T) -> T | None: @@ -471,6 +472,7 @@ def right_sibling(self: T) -> T | None: child_idx = children.index(self) if child_idx + 1 < len(children): return self.parent.children[child_idx + 1] + return None @property def node_path(self: T) -> Iterable[T]: diff --git a/bigtree/tree/helper.py b/bigtree/tree/helper.py index 314ed4b8..d216663e 100644 --- a/bigtree/tree/helper.py +++ b/bigtree/tree/helper.py @@ -441,7 +441,7 @@ def get_tree_diff( aggregate: bool = False, attr_list: Iterable[str] | None = None, fallback_sep: str = "/", -) -> node.Node: +) -> node.Node | None: """Get difference of `tree` to `other_tree`, changes are relative to `tree`. Compares the difference in tree structure (default), but can also compare tree attributes using `attr_list`. @@ -692,3 +692,4 @@ def get_tree_diff( _node = search.find_full_path(tree_diff, path) _node.name += " (~)" return tree_diff + return None diff --git a/bigtree/tree/search.py b/bigtree/tree/search.py index e85b2fce..b93e5199 100644 --- a/bigtree/tree/search.py +++ b/bigtree/tree/search.py @@ -117,8 +117,7 @@ def find(tree: T, condition: Callable[[T], bool], max_depth: int = 0) -> T | Non Search result """ result = findall(tree, condition, max_depth, max_count=1) - if result: - return result[0] + return result[0] if result else None def find_name(tree: NodeT, name: str, max_depth: int = 0) -> NodeT | None: @@ -206,9 +205,7 @@ def find_relative_path(tree: NodeT, path_name: str) -> NodeT | None: Search result """ result = find_relative_paths(tree, path_name, max_count=1) - - if result: - return result[0] + return result[0] if result else None def find_relative_paths( @@ -532,8 +529,7 @@ def find_child( Search result """ result = find_children(tree, condition, max_count=1) - if result: - return result[0] + return result[0] if result else None def find_child_by_name(tree: NodeT | DAGNodeT, name: str) -> NodeT | DAGNodeT | None: diff --git a/pyproject.toml b/pyproject.toml index 992a7481..d05c1d7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,7 +169,6 @@ profile = "black" ignore_missing_imports = true strict = true strict_optional = false -warn_no_return = false disallow_untyped_calls = false [tool.ruff] From 1f0da7c6fe5161e16d149ce92d93be6a4129b566 Mon Sep 17 00:00:00 2001 From: Kay Date: Wed, 6 May 2026 02:18:18 +0800 Subject: [PATCH 3/3] docs: update CHANGELOG --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 932f1da8..092da0f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,13 @@ 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). ## [Unreleased] +### Changed: +- Tree Helper: Tree diff modify type hint to include returning None. +- Misc: Mypy type checks to remove ignoring warn_no_return. ## [1.4.1] - 2026-05-02 ### Changed: -- Tree Search: Modify type hint to include returning None +- Tree Search: Modify type hint to include returning None. - Misc: Clean up and remove redundant lines. ## [1.4.0] - 2026-03-24