@@ -89,36 +89,38 @@ def __post_init__(self, parameters: Mapping[str, Any]) -> None:
8989 self ._field_path [path_index ] = InterpolatedString .create (
9090 self .field_path [path_index ], parameters = parameters
9191 )
92-
92+
9393 if self .expand_records_from_field :
9494 self ._expand_path = [
95- InterpolatedString .create (path , parameters = parameters )
95+ InterpolatedString .create (path , parameters = parameters )
9696 for path in self .expand_records_from_field
9797 ]
9898 else :
9999 self ._expand_path = None
100100
101- def _expand_record (self , record : MutableMapping [Any , Any ]) -> Iterable [MutableMapping [Any , Any ]]:
101+ def _expand_record (
102+ self , record : MutableMapping [Any , Any ]
103+ ) -> Iterable [MutableMapping [Any , Any ]]:
102104 """Expand a record by extracting items from a nested array field."""
103105 if not self ._expand_path :
104106 yield record
105107 return
106-
108+
107109 expand_path = [path .eval (self .config ) for path in self ._expand_path ]
108-
110+
109111 try :
110112 nested_array = dpath .get (record , expand_path )
111113 except (KeyError , TypeError ):
112114 yield record
113115 return
114-
116+
115117 if not isinstance (nested_array , list ):
116118 yield record
117119 return
118-
120+
119121 if len (nested_array ) == 0 :
120122 return
121-
123+
122124 for item in nested_array :
123125 if isinstance (item , dict ):
124126 expanded_record = dict (item )
0 commit comments