Skip to content

Commit

Permalink
Merge pull request #137 from CellProfiler/issues/4674_425
Browse files Browse the repository at this point in the history
Don't break when loading with pipes in notes, 4.2.5 edition
  • Loading branch information
bethac07 authored Dec 14, 2022
2 parents bbbf3a2 + 00f154c commit b7fb32b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cellprofiler_core/pipeline/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,15 @@ def setup_module(
raise ValueError("Invalid format for attributes: %s" % attribute_string)
# Fix for array dtypes which contain split separator
attribute_string = attribute_string.replace("dtype='|S", "dtype='S")
attribute_strings = attribute_string[1:-1].split("|")
if len(re.split("(?P<note>\|notes:\[.*?\]\|)",attribute_string)) ==3:
# 4674- sometimes notes have pipes
prenote,note,postnote = re.split("(?P<note>\|notes:\[.*?\]\|)",attribute_string)
attribute_strings = prenote[1:].split("|")
attribute_strings += [note[1:-1]]
attribute_strings += postnote[:-1].split("|")
else:
#old or weird pipeline without notes
attribute_strings = attribute_string[1:-1].split("|")
variable_revision_number = None
# make batch_state decodable from text pipelines
# NOTE, MAGIC HERE: These variables are **necessary**, even though they
Expand Down

0 comments on commit b7fb32b

Please sign in to comment.