MCPcopy
hub / github.com/pydata/xarray / NodePath

Class NodePath

xarray/core/treenode.py:24–43  ·  view source on GitHub ↗

Represents a path from one node to another within a tree.

Source from the content-addressed store, hash-verified

22
23
24class NodePath(PurePosixPath):
25 """Represents a path from one node to another within a tree."""
26
27 def __init__(self, *pathsegments):
28 if sys.version_info >= (3, 12):
29 super().__init__(*pathsegments)
30 else:
31 super().__new__(PurePosixPath, *pathsegments)
32 if self.drive:
33 raise ValueError("NodePaths cannot have drives")
34
35 if self.root not in ["/", ""]:
36 raise ValueError(
37 'Root of NodePath can only be either "/" or "", with "" meaning the path is relative.'
38 )
39 # TODO should we also forbid suffixes to avoid node names with dots in them?
40
41 def absolute(self) -> Self:
42 """Convert into an absolute path."""
43 return type(self)("/", *self.parts)
44
45
46class TreeNode:

Callers 15

check_alignmentFunction · 0.90
_pre_attachMethod · 0.90
__getitem__Method · 0.90
__setitem__Method · 0.90
from_dictMethod · 0.90
matchMethod · 0.90
open_groups_as_dictMethod · 0.90
open_groups_as_dictMethod · 0.90
_iter_nc_groupsFunction · 0.90
open_groups_as_dictMethod · 0.90
open_groups_as_dictMethod · 0.90
_iter_zarr_groupsFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_nodepathFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…