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

Add types for Node.predecessor(), Tree._clone(), Tree.subtree() and Tree.to_dict() #237

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lawrence-law
Copy link

Hi @caesar0301, following #232 I found some functions that I use in treelib which were left untyped, so I added type annotations to them.

Hopefully these are correct and it helps. I ran scripts/flake8.sh and no issues were flagged, but there isn't coverage around the actual typing itself.

@lawrence-law lawrence-law requested a review from liamlundy as a code owner March 4, 2025 11:22
@@ -118,7 +118,7 @@ def _clone(
identifier: Optional[str] = None,
with_tree: bool = False,
deep: bool = False,
):
) -> "Tree":
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would normally use -> Tree here and import __future__.annotations but I'm not sure if that's supported by all versions of Python that treelib supports, so this felt a little bit safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant