File tree Expand file tree Collapse file tree 2 files changed +98
-8
lines changed Expand file tree Collapse file tree 2 files changed +98
-8
lines changed Original file line number Diff line number Diff line change 44"""
55
66from attrs import NOTHING , Attribute , fields_dict
7- from xattree import array as xattree_array
8- from xattree import coord as xattree_coord
9- from xattree import dim as xattree_dim
10- from xattree import field as xattree_field
7+
8+ from flopy4 .spec import array as flopy_array
9+ from flopy4 .spec import coord as flopy_coord
10+ from flopy4 .spec import dim as flopy_dim
11+ from flopy4 .spec import field as flopy_field
1112
1213
1314def field (
@@ -24,7 +25,7 @@ def field(
2425 if block :
2526 metadata = metadata or {}
2627 metadata ["block" ] = block
27- return xattree_field (
28+ return flopy_field (
2829 default = default ,
2930 validator = validator ,
3031 converter = converter ,
@@ -49,7 +50,7 @@ def dim(
4950 if block :
5051 metadata = metadata or {}
5152 metadata ["block" ] = block
52- return xattree_dim (
53+ return flopy_dim (
5354 scope = scope ,
5455 coord = coord ,
5556 default = default ,
@@ -72,7 +73,7 @@ def coord(
7273 if block :
7374 metadata = metadata or {}
7475 metadata ["block" ] = block
75- return xattree_coord (
76+ return flopy_coord (
7677 scope = scope ,
7778 default = default ,
7879 repr = repr ,
@@ -96,7 +97,7 @@ def array(
9697 if block :
9798 metadata = metadata or {}
9899 metadata ["block" ] = block
99- return xattree_array (
100+ return flopy_array (
100101 cls = cls ,
101102 dims = dims ,
102103 default = default ,
Original file line number Diff line number Diff line change 1+ """Wrap `xattree` and `attrs` specification utilities."""
2+
3+ from attrs import NOTHING
4+ from xattree import array as xattree_array
5+ from xattree import coord as xattree_coord
6+ from xattree import dim as xattree_dim
7+ from xattree import field as xattree_field
8+
9+
10+ def field (
11+ default = NOTHING ,
12+ validator = None ,
13+ converter = None ,
14+ repr = True ,
15+ eq = True ,
16+ init = True ,
17+ metadata = None ,
18+ ):
19+ """Define a field."""
20+ return xattree_field (
21+ default = default ,
22+ validator = validator ,
23+ converter = converter ,
24+ repr = repr ,
25+ eq = eq ,
26+ init = init ,
27+ metadata = metadata ,
28+ )
29+
30+
31+ def dim (
32+ scope = None ,
33+ coord : bool | str = True ,
34+ default = NOTHING ,
35+ repr = True ,
36+ eq = True ,
37+ init = True ,
38+ metadata = None ,
39+ ):
40+ """Define a dimension field."""
41+ return xattree_dim (
42+ scope = scope ,
43+ coord = coord ,
44+ default = default ,
45+ repr = repr ,
46+ eq = eq ,
47+ init = init ,
48+ metadata = metadata ,
49+ )
50+
51+
52+ def coord (
53+ scope = None ,
54+ default = NOTHING ,
55+ repr = True ,
56+ eq = True ,
57+ metadata = None ,
58+ ):
59+ """Define a coordinate field."""
60+ return xattree_coord (
61+ scope = scope ,
62+ default = default ,
63+ repr = repr ,
64+ eq = eq ,
65+ metadata = metadata ,
66+ )
67+
68+
69+ def array (
70+ cls = None ,
71+ dims = None ,
72+ default = NOTHING ,
73+ validator = None ,
74+ converter = None ,
75+ repr = True ,
76+ eq = None ,
77+ metadata = None ,
78+ ):
79+ """Define an array field."""
80+ return xattree_array (
81+ cls = cls ,
82+ dims = dims ,
83+ default = default ,
84+ validator = validator ,
85+ converter = converter ,
86+ repr = repr ,
87+ eq = eq ,
88+ metadata = metadata ,
89+ )
You can’t perform that action at this time.
0 commit comments