Hi @c0fec0de,
I've run into a case where a user named a node "." and the Resolver fails to retrieve the node, instead returning its parent node. Here's a MWE:
from anytree import Node, Resolver
# Create a tree structure
root = Node("root")
a1 = Node("a1", parent=root)
dot = Node(".", parent=a1)
# Create a resolver
resolver = Resolver('name')
# This finds the parent instead of the dot node
print(resolver.get(root, "/root/a1/."))
Would you be open to adding an option to the Resolver.get() method to disable pattern matching?
I'm thinking something like:
resolver.get(root, "/root/a1/.", strict=True)
to disable pattern matching. Not married to the strict name, just using it as an example. The default kwarg value could be False to ensure backwards compatibility. If you'd be amenable to something like this, I could put together a PR.
Alternatively, if there is a workaround for retrieving nodes in cases like this please let me know. I'd be open to using that method.
Appreciate your time,
Scott
Hi @c0fec0de,
I've run into a case where a user named a node "." and the Resolver fails to retrieve the node, instead returning its parent node. Here's a MWE:
Would you be open to adding an option to the
Resolver.get()method to disable pattern matching?I'm thinking something like:
resolver.get(root, "/root/a1/.", strict=True)to disable pattern matching. Not married to the
strictname, just using it as an example. The default kwarg value could be False to ensure backwards compatibility. If you'd be amenable to something like this, I could put together a PR.Alternatively, if there is a workaround for retrieving nodes in cases like this please let me know. I'd be open to using that method.
Appreciate your time,
Scott