@@ -166,15 +166,11 @@ def ATTR_BUILDER(element, attribute, t):
166166 o += f'{ TABS (t )} elif isinstance(item, int):\n '
167167 o += f'{ TABS (t )} array.append({ attribute .type [12 :- 1 ]} (item))\n '
168168 if 'types.Real' in attribute .type :
169- o += f'{ TABS (t )} elif isinstance(item, int):\n '
170- o += f'{ TABS (t )} array.append({ attribute .type [12 :- 1 ]} (item))\n '
171- o += f'{ TABS (t )} elif isinstance(item, float):\n '
169+ o += f'{ TABS (t )} elif isinstance(item, int) or isinstance(item, float):\n '
172170 o += f'{ TABS (t )} array.append({ attribute .type [12 :- 1 ]} (item))\n '
173171
174172 o += f'{ TABS (t )} elif isinstance(item, str):\n '
175173 o += f'{ TABS (t )} array.append({ attribute .type [12 :- 1 ]} .from_mcnp(item))\n '
176- o += f'{ TABS (t )} else:\n '
177- o += f'{ TABS (t )} raise TypeError\n '
178174 o += f'{ TABS (t )} { attribute .name } = types.Tuple(array)\n '
179175 else :
180176 o += f'{ TABS (t )} if isinstance({ attribute .name } , { attribute .type } ):\n '
@@ -184,15 +180,11 @@ def ATTR_BUILDER(element, attribute, t):
184180 o += f'{ TABS (t )} elif isinstance({ attribute .name } , int):\n '
185181 o += f'{ TABS (t )} { attribute .name } = { attribute .type } ({ attribute .name } )\n '
186182 if 'types.Real' in attribute .type :
187- o += f'{ TABS (t )} elif isinstance({ attribute .name } , int):\n '
188- o += f'{ TABS (t )} { attribute .name } = { attribute .type } ({ attribute .name } )\n '
189- o += f'{ TABS (t )} elif isinstance({ attribute .name } , float):\n '
183+ o += f'{ TABS (t )} elif isinstance({ attribute .name } , int) or isinstance({ attribute .name } , float):\n '
190184 o += f'{ TABS (t )} { attribute .name } = { attribute .type } ({ attribute .name } )\n '
191185
192186 o += f'{ TABS (t )} elif isinstance({ attribute .name } , str):\n '
193187 o += f'{ TABS (t )} { attribute .name } = { attribute .type } .from_mcnp({ attribute .name } )\n '
194- o += f'{ TABS (t )} else:\n '
195- o += f'{ TABS (t )} raise TypeError\n '
196188
197189 return o .strip ()
198190
0 commit comments