Skip to content

Commit 59e0e40

Browse files
committed
Allow iteration over IDSMetadata children
1 parent 0fe1e35 commit 59e0e40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

imaspy/ids_metadata.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from enum import Enum
88
from functools import lru_cache
99
from pathlib import Path
10-
from typing import Any, Dict, Optional, Tuple, Type
10+
from typing import Any, Dict, Iterator, Optional, Tuple, Type
1111
from xml.etree.ElementTree import Element
1212

1313
from imaspy.ids_coordinates import IDSCoordinate
@@ -271,6 +271,9 @@ def __copy__(self):
271271
def __deepcopy__(self, memo: dict):
272272
return self # IDSMetadata is immutable
273273

274+
def __iter__(self) -> Iterator["IDSMetadata"]:
275+
return iter(self._children.values())
276+
274277
def __getitem__(self, path):
275278
item = self
276279
for part in re.split("[./]", path):

0 commit comments

Comments
 (0)