From e174a25585e64eb1b0759440cad48d642dd31829 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Fri, 25 Nov 2022 14:31:29 +0100 Subject: use schema and predicate types in extractors --- bsie/utils/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bsie/utils/node.py') diff --git a/bsie/utils/node.py b/bsie/utils/node.py index 60863a4..3a0f06b 100644 --- a/bsie/utils/node.py +++ b/bsie/utils/node.py @@ -12,7 +12,7 @@ from bsie.utils.bsfs import URI # exports __all__: typing.Sequence[str] = ( - 'Node' + 'Node', ) -- cgit v1.2.3 From 9ce32829b2bb85907a34a543bfcaa9183d1e362c Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Fri, 25 Nov 2022 14:39:18 +0100 Subject: string conversion and equality checks --- bsie/utils/node.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bsie/utils/node.py') diff --git a/bsie/utils/node.py b/bsie/utils/node.py index 3a0f06b..c9c494f 100644 --- a/bsie/utils/node.py +++ b/bsie/utils/node.py @@ -7,8 +7,8 @@ Author: Matthias Baumgartner, 2022 # imports import typing -# inner-module imports -from bsie.utils.bsfs import URI +# bsie imports +from bsie.utils.bsfs import URI, typename # exports __all__: typing.Sequence[str] = ( @@ -36,4 +36,18 @@ class Node(): self.node_type = URI(node_type) self.uri = URI(uri) + def __eq__(self, other: typing.Any) -> bool: + return isinstance(other, Node) \ + and other.node_type == self.node_type \ + and other.uri == self.uri + + def __hash__(self) -> int: + return hash((type(self), self.node_type, self.uri)) + + def __str__(self) -> str: + return f'{typename(self)}({self.node_type}, {self.uri})' + + def __repr__(self) -> str: + return f'{typename(self)}({self.node_type}, {self.uri})' + ## EOF ## -- cgit v1.2.3