From 0dd8f70939d8103e11b205b559c2e71a254e4f22 Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 1 Aug 2022 09:22:10 -0500 Subject: [PATCH] add paulromano's 2nd round of suggestions --- openmc/material.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/openmc/material.py b/openmc/material.py index 9ba7360ff3..6c26416801 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -408,6 +408,8 @@ class Material(IDManagerMixin): def add_components(self, components: dict, percent_type: str = 'ao'): """ Add multiple elements or nuclides to a material + .. versionadded:: 0.13.1 + Parameters ---------- components : dict of str to float or dict @@ -442,17 +444,14 @@ class Material(IDManagerMixin): raise ValueError("An entry in the dictionary does not have " "a required key: 'percent'") - percent = params.pop('percent') - args = (percent, percent_type) + params['percent_type'] = percent_type ## check if nuclide if str.isdigit(component[-1]): - self.add_nuclide(component, *args) + self.add_nuclide(component, **params) else: # is element kwargs = params - self.add_element(component, *args, **kwargs) - - params['percent'] = percent + self.add_element(component, **params) def remove_nuclide(self, nuclide: str): """Remove a nuclide from the material