Apply suggestions from code review

Incorporating suggestions from @paulromano

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Patrick Shriwise 2022-11-23 21:23:36 -06:00
parent 1e7dbe99cf
commit d034e1de9c
4 changed files with 11 additions and 15 deletions

View file

@ -256,7 +256,7 @@ class Geometry:
----------
path : str, optional
Path to geometry XML file
materials : dict
materials : dict
Dictionary mapping material ID strings to :class:`openmc.Material`
instances (defined in :math:`openmc.Geometry.from_xml`)

View file

@ -228,8 +228,7 @@ class Model:
model.settings = openmc.Settings.from_xml_element(root.find('settings'))
model.materials = openmc.Materials.from_xml_element(root.find('materials'))
materials = {str(m.id): m for m in model.materials}
model.geometry = \
openmc.Geometry.from_xml_element(root.find('geometry'), materials)
model.geometry = .Geometry.from_xml_element(root.find('geometry'), materials)
# gather meshses from other classes before reading the tally node
meshes = {}
@ -542,8 +541,7 @@ class Model:
materials = openmc.Materials(self.geometry.get_all_materials()
.values())
with open(d, 'w', encoding='utf-8',
errors='xmlcharrefreplace') as fh:
with open(d, 'w', encoding='utf-8', errors='xmlcharrefreplace') as fh:
# write the XML header
fh.write("<?xml version='1.0' encoding='utf-8'?>\n")
fh.write("<model>\n")

View file

@ -55,16 +55,16 @@ class ModelXMLTestHarness(PyAPITestHarness):
models = [
'adj_cell_rotation_model',
'lattice_mult_model',
'energy_laws_model',
'photon_prod_model'
'adj_cell_rotation_model',
'lattice_mult_model',
'energy_laws_model',
'photon_prod_model'
]
paths = [
'../adj_cell_rotation',
'../lattice_multiple',
'../energy_laws',
'../photon_production'
'../adj_cell_rotation',
'../lattice_multiple',
'../energy_laws',
'../photon_production'
]

View file

@ -7,8 +7,6 @@ import pytest
import openmc
import openmc.lib
from .. import cdtemp
@pytest.fixture(scope='function')
def pin_model_attributes():