Skip to content

Commit 59d8805

Browse files
authored
[ports] Split list/tuple value strings based on comma or semicolon (#494)
1 parent 6b826b9 commit 59d8805

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

py_trees/ports_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ def convert_str_to_type(
163163

164164
if origin is list:
165165
(inner_type,) = get_args(target_type) or (str,)
166-
parts = [p.strip() for p in value.split(",")] if value.strip() else []
166+
parts = [p.strip() for p in re.split(r"[,;]", value)] if value.strip() else []
167167
try:
168168
return [convert_str_to_type(p, inner_type, logger) for p in parts]
169169
except Exception:
170170
return [p.strip() for p in parts]
171171

172172
if origin is tuple:
173173
inner_types = get_args(target_type)
174-
parts = [p.strip() for p in value.split(",")]
174+
parts = [p.strip() for p in re.split(r"[,;]", value)]
175175
converted = []
176176
for i, p in enumerate(parts):
177177
t = inner_types[i] if i < len(inner_types) else str

0 commit comments

Comments
 (0)