Skip to content

Commit

Permalink
feat(nml): invalidate cached property when new segment is added
Browse files Browse the repository at this point in the history
Since the property is now out of date.
  • Loading branch information
sanjayankur31 committed Sep 12, 2024
1 parent a1ece67 commit da396c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions neuroml/nml/helper_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,12 @@ def add_segment(
self.morphology.segments.append(segment)
# remove cached property since it is now outdated
try:
del self.__dict__['segment_ids_vs_segments']
except KeyError:
pass
if optimise_segment_groups:
self.optimise_segment_groups()
Expand Down
8 changes: 7 additions & 1 deletion neuroml/nml/nml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

#
# Generated Wed Sep 11 17:09:38 2024 by generateDS.py version 2.44.1.
# Generated Thu Sep 12 16:44:57 2024 by generateDS.py version 2.44.1.
# Python 3.11.9 (main, Aug 23 2024, 00:00:00) [GCC 14.2.1 20240801 (Red Hat 14.2.1-1)]
#
# Command line options:
Expand Down Expand Up @@ -49179,6 +49179,12 @@ def add_segment(

self.morphology.segments.append(segment)

# remove cached property since it is now outdated
try:
del self.__dict__["segment_ids_vs_segments"]
except KeyError:
pass

if optimise_segment_groups:
self.optimise_segment_groups()

Expand Down

0 comments on commit da396c4

Please sign in to comment.