Skip to content
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.4.1] - 2026-05-02
### Changed:
- Tree Search: Modify type hint to include returning None
- 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.
- Misc: Clean up and remove redundant lines.

## [1.4.0] - 2026-03-24
Expand Down
2 changes: 2 additions & 0 deletions bigtree/node/basenode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]:
Expand Down
3 changes: 2 additions & 1 deletion bigtree/tree/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -692,3 +692,4 @@ def get_tree_diff(
_node = search.find_full_path(tree_diff, path)
_node.name += " (~)"
return tree_diff
return None
10 changes: 3 additions & 7 deletions bigtree/tree/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading