File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from collections .abc import Iterable
2+ from functools import cached_property
23from io import StringIO
34from math import log
45import re
@@ -339,7 +340,6 @@ def __init__(self, ev_or_filename):
339340 self .modes = []
340341 self .spectra = {}
341342 self .average_energies = {}
342- self ._sources = None
343343
344344 # Get head record
345345 items = get_head_record (file_obj )
@@ -506,14 +506,9 @@ def from_endf(cls, ev_or_filename):
506506 """
507507 return cls (ev_or_filename )
508508
509- @property
509+ @cached_property
510510 def sources (self ):
511511 """Radioactive decay source distributions"""
512- # If property has been computed already, return it
513- # TODO: Replace with functools.cached_property when support is Python 3.9+
514- if self ._sources is not None :
515- return self ._sources
516-
517512 sources = {}
518513 name = self .nuclide ['name' ]
519514 decay_constant = self .decay_constant .n
@@ -571,8 +566,7 @@ def sources(self):
571566 merged_sources [particle_type ] = combine_distributions (
572567 dist_list , [1.0 ]* len (dist_list ))
573568
574- self ._sources = merged_sources
575- return self ._sources
569+ return merged_sources
576570
577571
578572_DECAY_PHOTON_ENERGY = {}
You can’t perform that action at this time.
0 commit comments