Revert changes to iterables.
parent
78a480aa08
commit
c12336b55a
|
@ -185,25 +185,30 @@ def _iterate_over_values(dict_values, tuple_to_find):
|
||||||
item.get(val) == tuple_to_find[1]):
|
item.get(val) == tuple_to_find[1]):
|
||||||
return idx
|
return idx
|
||||||
elif isinstance(pv, dict):
|
elif isinstance(pv, dict):
|
||||||
for idx, item in enumerate(sorted(pv.keys())):
|
if pv.get(tuple_to_find[0]) is not None:
|
||||||
if ((item == tuple_to_find[0] and str.isdigit(item)) and
|
for idx, item in enumerate(sorted(pv.keys())):
|
||||||
(pv[item] == tuple_to_find[1])):
|
if ((item == tuple_to_find[0] and str.isdigit(item)) and
|
||||||
return int(tuple_to_find[0])
|
(pv[item] == tuple_to_find[1])):
|
||||||
elif pv[item] == tuple_to_find[1]:
|
return int(tuple_to_find[0])
|
||||||
return idx
|
elif pv[item] == tuple_to_find[1]:
|
||||||
|
return idx
|
||||||
for item in pv.values():
|
for item in pv.values():
|
||||||
if isinstance(item, _STIXBase):
|
if isinstance(item, _STIXBase):
|
||||||
return find_property_index(
|
index = find_property_index(
|
||||||
item,
|
item,
|
||||||
item.object_properties(),
|
item.object_properties(),
|
||||||
tuple_to_find
|
tuple_to_find
|
||||||
)
|
)
|
||||||
|
if index is not None:
|
||||||
|
return index
|
||||||
elif isinstance(item, dict):
|
elif isinstance(item, dict):
|
||||||
return find_property_index(
|
index = find_property_index(
|
||||||
item,
|
item,
|
||||||
item.keys(),
|
item.keys(),
|
||||||
tuple_to_find
|
tuple_to_find
|
||||||
)
|
)
|
||||||
|
if index is not None:
|
||||||
|
return index
|
||||||
|
|
||||||
|
|
||||||
def find_property_index(obj, properties, tuple_to_find):
|
def find_property_index(obj, properties, tuple_to_find):
|
||||||
|
|
Loading…
Reference in New Issue