---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 openmc.ParticleFilter({"neutron"})
File ~/dev/pers-openmc/openmc/filter.py:114, in Filter.__init__(self, bins, filter_id)
113 def __init__(self, bins, filter_id=None):
--> 114 self.bins = bins
115 self.id = filter_id
File ~/dev/pers-openmc/openmc/filter.py:767, in ParticleFilter.bins(self, bins)
764 @Filter.bins.setter
765 def bins(self, bins):
766 bins = np.atleast_1d(bins)
--> 767 cv.check_iterable_type('filter bins', bins, str)
768 for edge in bins:
769 cv.check_value('filter bin', edge, _PARTICLES)
File ~/dev/pers-openmc/openmc/checkvalue.py:132, in check_iterable_type(name, value, expected_type, min_depth, max_depth)
128 if len(tree) > max_depth:
129 msg = (f'Error setting {name}: Found an iterable at '
130 f'{ind_str}, items in that iterable exceed the '
131 f'maximum depth of {max_depth}')
--> 132 raise TypeError(msg)
134 else:
135 # This item is completely unexpected.
136 msg = (f'Error setting {name}: Items must be of type '
137 f'"{expected_type.__name__}", but item at {ind_str} is '
138 f'of type "{type(current_item).__name__}"')
TypeError: Error setting filter bins: Found an iterable at [0], items in that iterable exceed the maximum depth of 1
In [3]: openmc.ParticleFilter({"neutron", "photon"})
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 openmc.ParticleFilter({"neutron", "photon"})
File ~/dev/pers-openmc/openmc/filter.py:114, in Filter.__init__(self, bins, filter_id)
113 def __init__(self, bins, filter_id=None):
--> 114 self.bins = bins
115 self.id = filter_id
File ~/dev/pers-openmc/openmc/filter.py:767, in ParticleFilter.bins(self, bins)
764 @Filter.bins.setter
765 def bins(self, bins):
766 bins = np.atleast_1d(bins)
--> 767 cv.check_iterable_type('filter bins', bins, str)
768 for edge in bins:
769 cv.check_value('filter bin', edge, _PARTICLES)
File ~/dev/pers-openmc/openmc/checkvalue.py:132, in check_iterable_type(name, value, expected_type, min_depth, max_depth)
128 if len(tree) > max_depth:
129 msg = (f'Error setting {name}: Found an iterable at '
130 f'{ind_str}, items in that iterable exceed the '
131 f'maximum depth of {max_depth}')
--> 132 raise TypeError(msg)
134 else:
135 # This item is completely unexpected.
136 msg = (f'Error setting {name}: Items must be of type '
137 f'"{expected_type.__name__}", but item at {ind_str} is '
138 f'of type "{type(current_item).__name__}"')
TypeError: Error setting filter bins: Found an iterable at [0], items in that iterable exceed the maximum depth of 1
Bug Description
When passing a set to an argument that is expecting an iterable a
TypeError
is raised.Steps to Reproduce
Returns:
Environment
Openmc: 0.14.1-dev