Skip to content

Commit a337226

Browse files
samuel-gauthierrjarry
authored andcommitted
data: remove DDiff
DDiff is not used since the port to libyang 2. Also fix the DNode.diff return type, it is a DNode now, not a DDiff iterator. Fixes: 806be4c ("Port to libyang 2") Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
1 parent 26c875a commit a337226

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

libyang/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
DAnydata,
1010
DAnyxml,
1111
DContainer,
12-
DDiff,
1312
DLeaf,
1413
DLeafList,
1514
DList,
@@ -106,7 +105,6 @@
106105
"ConfigFalseRemoved",
107106
"Context",
108107
"DContainer",
109-
"DDiff",
110108
"DLeaf",
111109
"DLeafList",
112110
"DList",

libyang/data.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -187,37 +187,6 @@ def diff_flags(with_defaults: bool = False) -> int:
187187
return flags
188188

189189

190-
# -------------------------------------------------------------------------------------
191-
class DDiff:
192-
"""
193-
Data tree diff
194-
"""
195-
196-
__slots__ = ("dtype", "first", "second")
197-
198-
def __init__(self, dtype, first: Optional["DNode"], second: Optional["DNode"]):
199-
"""
200-
:arg dtype:
201-
The type of the diff
202-
:arg first:
203-
The first DNode
204-
:arg second:
205-
The second DNode
206-
"""
207-
self.dtype = dtype
208-
self.first = first
209-
self.second = second
210-
211-
def diff_type(self) -> str:
212-
"""Get diff type as string"""
213-
return hex(self.dtype)
214-
215-
def __repr__(self) -> str:
216-
return "<libyang.data.DDiff {} first={} second={}>".format(
217-
self.diff_type(), self.first, self.second
218-
)
219-
220-
221190
# -------------------------------------------------------------------------------------
222191
class DNode:
223192
"""
@@ -496,7 +465,7 @@ def diff(
496465
other: "DNode",
497466
no_siblings: bool = False,
498467
with_defaults: bool = False,
499-
) -> Iterator[DDiff]:
468+
) -> "DNode":
500469
flags = diff_flags(with_defaults=with_defaults)
501470
node_p = ffi.new("struct lyd_node **")
502471
if no_siblings:

0 commit comments

Comments
 (0)