@@ -685,22 +685,25 @@ def find_leafref_path_target_paths(self, leafref_path: str) -> List[str]:
685
685
raise self .error ("leafref_path not found" )
686
686
687
687
node_set = ffi .new ("struct ly_set **" )
688
- if (lib .lysc_node_lref_targets (node , node_set ) != lib .LY_SUCCESS or
689
- node_set [0 ] == ffi .NULL or node_set [0 ].count == 0 ):
688
+ if (
689
+ lib .lysc_node_lref_targets (node , node_set ) != lib .LY_SUCCESS
690
+ or node_set [0 ] == ffi .NULL
691
+ or node_set [0 ].count == 0 ):
690
692
raise self .error ("leafref_path does not contain any leafref targets" )
691
693
692
694
node_set = node_set [0 ]
693
695
for i in range (node_set .count ):
694
- path = lib .lysc_path (node_set .snodes [i ], lib .LYSC_PATH_DATA , ffi .NULL , 0 );
696
+ path = lib .lysc_path (node_set .snodes [i ], lib .LYSC_PATH_DATA , ffi .NULL , 0 )
695
697
out .append (c2str (path ))
696
698
lib .free (path )
697
699
698
700
lib .ly_set_free (node_set , ffi .NULL )
699
701
700
702
return out
701
703
702
-
703
- def find_backlinks_paths (self , match_path : str = None , match_ancestors : bool = False ) -> List [str ]:
704
+ def find_backlinks_paths (
705
+ self , match_path : str = None , match_ancestors : bool = False
706
+ ) -> List [str ]:
704
707
"""
705
708
Search entire schema for nodes that contain leafrefs and return as a
706
709
list of schema node paths.
@@ -739,13 +742,18 @@ def find_backlinks_paths(self, match_path: str = None, match_ancestors: bool = F
739
742
raise self .error ("match_path not found" )
740
743
741
744
node_set = ffi .new ("struct ly_set **" )
742
- if (lib .lysc_node_lref_backlinks (self .cdata , match_node , match_ancestors , node_set )
743
- != lib .LY_SUCCESS or node_set [0 ] == ffi .NULL or node_set [0 ].count == 0 ):
745
+ if (
746
+ lib .lysc_node_lref_backlinks (
747
+ self .cdata , match_node , match_ancestors , node_set
748
+ )
749
+ != lib .LY_SUCCESS
750
+ or node_set [0 ] == ffi .NULL
751
+ or node_set [0 ].count == 0 ):
744
752
raise self .error ("backlinks not found" )
745
753
746
754
node_set = node_set [0 ]
747
755
for i in range (node_set .count ):
748
- path = lib .lysc_path (node_set .snodes [i ], lib .LYSC_PATH_DATA , ffi .NULL , 0 );
756
+ path = lib .lysc_path (node_set .snodes [i ], lib .LYSC_PATH_DATA , ffi .NULL , 0 )
749
757
out .append (c2str (path ))
750
758
lib .free (path )
751
759
0 commit comments