aboutsummaryrefslogtreecommitdiffstats
path: root/bsie/utils/node.py
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2022-12-18 14:22:31 +0100
committerMatthias Baumgartner <dev@igsor.net>2022-12-18 14:22:31 +0100
commit7582c280ad5324a2f0427999911c7e7abc14a6ab (patch)
tree0a59bbfe1c44d3497daad9f25ff9e7eb2bf9eb82 /bsie/utils/node.py
parentcb49e4567a18de6851286ff672e54f9a91865fe9 (diff)
parent057e09d6537bf5c39815661a75819081e3e5fda7 (diff)
downloadbsie-7582c280ad5324a2f0427999911c7e7abc14a6ab.tar.gz
bsie-7582c280ad5324a2f0427999911c7e7abc14a6ab.tar.bz2
bsie-7582c280ad5324a2f0427999911c7e7abc14a6ab.zip
Merge branch 'develop' into main
Diffstat (limited to 'bsie/utils/node.py')
-rw-r--r--bsie/utils/node.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/bsie/utils/node.py b/bsie/utils/node.py
new file mode 100644
index 0000000..ecf39cd
--- /dev/null
+++ b/bsie/utils/node.py
@@ -0,0 +1,53 @@
+"""Lighweight Node to bridge to BSFS.
+
+Part of the bsie module.
+A copy of the license is provided with the project.
+Author: Matthias Baumgartner, 2022
+"""
+# imports
+import typing
+
+# bsie imports
+from bsie.utils import bsfs
+
+# exports
+__all__: typing.Sequence[str] = (
+ 'Node',
+ )
+
+
+## code ##
+
+class Node():
+ """Lightweight Node, disconnected from any bsfs structures."""
+
+ # node type.
+ node_type: bsfs.URI
+
+ # node URI.
+ uri: bsfs.URI
+
+ def __init__(
+ self,
+ node_type: bsfs.URI,
+ uri: bsfs.URI,
+ ):
+ # assign members
+ self.node_type = bsfs.URI(node_type)
+ self.uri = bsfs.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'{bsfs.typename(self)}({self.node_type}, {self.uri})'
+
+ def __repr__(self) -> str:
+ return f'{bsfs.typename(self)}({self.node_type}, {self.uri})'
+
+## EOF ##