File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -84,28 +84,27 @@ def remove(self, item):
84
84
litem = self .iterator .next ()
85
85
if (type (item ) == str and type (litem ) == str and litem == item ) or \
86
86
("instance" in item .__dict__ and litem .instance == item .instance ):
87
-
87
+
88
88
self .iterator .remove ()
89
-
90
-
89
+
91
90
'''
92
91
Warning, list.remove(self, item) will fail because python yield
93
92
a new reference at each loop. So wee need to loop again into the python list,
94
93
get the new reference and remove it. Demo:
95
-
94
+
96
95
print(item.instance)
97
96
print(litem.instance)
98
- print(litem.instance == item.instance)
99
-
100
- RETURNS:
101
-
97
+ print(litem.instance == item.instance)
98
+
99
+ RETURNS:
100
+
102
101
<Swig Object of type 'struct xccdf_refine_value *' at 0x7ff85ed73bd0>
103
102
<Swig Object of type 'struct xccdf_refine_value *' at 0x7ff85ed73c90>
104
103
True
105
104
'''
106
-
105
+
107
106
for i in self [:]:
108
- if "instance" in item .__dict__ and i .instance == item .instance :
107
+ if "instance" in item .__dict__ and i .instance == item .instance :
109
108
list .remove (self , i )
110
109
111
110
except NameError :
@@ -124,8 +123,6 @@ def generate(self, iterator):
124
123
125
124
while iterator .has_more ():
126
125
list .append (self , iterator .next ())
127
-
128
-
129
126
130
127
def append (self , item , n = 1 ):
131
128
"""This function is not allowed. Please use appropriate function from library."""
You can’t perform that action at this time.
0 commit comments