Skip to content

Commit a10d7b4

Browse files
committed
make short notation work again for dicts
1 parent 0e66ff4 commit a10d7b4

File tree

1 file changed

+11
-8
lines changed
  • src/pynxtools/dataconverter/readers

1 file changed

+11
-8
lines changed

src/pynxtools/dataconverter/readers/utils.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,17 @@ def update_config(key, value, rkey):
255255
create_link_dict=create_link_dict,
256256
)
257257
)
258-
elif create_link_dict and isinstance(value, str) and value.startswith("@link:"):
259-
flattened_config[key] = {"link": value[6:]}
260258
else:
261-
flattened_config[key] = value
259+
if rkey is not None and isinstance(value, str):
260+
value = value.replace("*", rkey)
261+
if (
262+
create_link_dict
263+
and isinstance(value, str)
264+
and value.startswith("@link:")
265+
):
266+
flattened_config[key] = {"link": value[6:]}
267+
else:
268+
flattened_config[key] = value
262269

263270
for key, value in json_data.items():
264271
if base_key is not None:
@@ -274,11 +281,7 @@ def update_config(key, value, rkey):
274281
expand_keys = expand_match.group(1).split(",")
275282
for ekey in expand_keys:
276283
rkey = key.replace(expand_match.group(0), ekey)
277-
278-
if isinstance(value, str):
279-
evalue = value.replace("*", ekey)
280-
281-
update_config(rkey, evalue, ekey)
284+
update_config(rkey, value, ekey)
282285
continue
283286

284287
update_config(key, value, None)

0 commit comments

Comments
 (0)