Skip to content

Commit b7fb32b

Browse files
authored
Merge pull request #137 from CellProfiler/issues/4674_425
Don't break when loading with pipes in notes, 4.2.5 edition
2 parents bbbf3a2 + 00f154c commit b7fb32b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cellprofiler_core/pipeline/_pipeline.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,15 @@ def setup_module(
580580
raise ValueError("Invalid format for attributes: %s" % attribute_string)
581581
# Fix for array dtypes which contain split separator
582582
attribute_string = attribute_string.replace("dtype='|S", "dtype='S")
583-
attribute_strings = attribute_string[1:-1].split("|")
583+
if len(re.split("(?P<note>\|notes:\[.*?\]\|)",attribute_string)) ==3:
584+
# 4674- sometimes notes have pipes
585+
prenote,note,postnote = re.split("(?P<note>\|notes:\[.*?\]\|)",attribute_string)
586+
attribute_strings = prenote[1:].split("|")
587+
attribute_strings += [note[1:-1]]
588+
attribute_strings += postnote[:-1].split("|")
589+
else:
590+
#old or weird pipeline without notes
591+
attribute_strings = attribute_string[1:-1].split("|")
584592
variable_revision_number = None
585593
# make batch_state decodable from text pipelines
586594
# NOTE, MAGIC HERE: These variables are **necessary**, even though they

0 commit comments

Comments
 (0)