Use empty-argument form of super()

This commit is contained in:
Paul Romano 2017-12-24 16:34:25 +07:00
parent 1ccf6c3e5e
commit deab4b3d33
26 changed files with 142 additions and 169 deletions

View file

@ -2,8 +2,9 @@ sudo: required
dist: trusty
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
addons:
apt:
packages:

View file

@ -81,7 +81,7 @@ class Cell(_FortranObjectWithID):
index = mapping[uid]._index
if index not in cls.__instances:
instance = super(Cell, cls).__new__(cls)
instance = super().__new__(cls)
instance._index = index
if uid is not None:
instance.id = uid

View file

@ -87,7 +87,7 @@ class Filter(_FortranObjectWithID):
index = mapping[uid]._index
if index not in cls.__instances:
instance = super(Filter, cls).__new__(cls)
instance = super().__new__(cls)
instance._index = index
if uid is not None:
instance.id = uid
@ -110,7 +110,7 @@ class EnergyFilter(Filter):
filter_type = 'energy'
def __init__(self, bins=None, uid=None, new=True, index=None):
super(EnergyFilter, self).__init__(uid, new, index)
super().__init__(uid, new, index)
if bins is not None:
self.bins = bins
@ -167,7 +167,7 @@ class MaterialFilter(Filter):
filter_type = 'material'
def __init__(self, bins=None, uid=None, new=True, index=None):
super(MaterialFilter, self).__init__(uid, new, index)
super().__init__(uid, new, index)
if bins is not None:
self.bins = bins

View file

@ -58,7 +58,7 @@ class Nuclide(_FortranObject):
def __new__(cls, *args):
if args not in cls.__instances:
instance = super(Nuclide, cls).__new__(cls)
instance = super().__new__(cls)
cls.__instances[args] = instance
return cls.__instances[args]

View file

@ -172,7 +172,7 @@ class Tally(_FortranObjectWithID):
index = mapping[uid]._index
if index not in cls.__instances:
instance = super(Tally, cls).__new__(cls)
instance = super().__new__(cls)
instance._index = index
if uid is not None:
instance.id = uid

View file

@ -288,7 +288,7 @@ class CheckedList(list):
"""
def __init__(self, expected_type, name, items=[]):
super(CheckedList, self).__init__()
super().__init__()
self.expected_type = expected_type
self.name = name
for item in items:
@ -319,7 +319,7 @@ class CheckedList(list):
"""
check_type(self.name, item, self.expected_type)
super(CheckedList, self).append(item)
super().append(item)
def insert(self, index, item):
"""Insert item before index
@ -333,4 +333,4 @@ class CheckedList(list):
"""
check_type(self.name, item, self.expected_type)
super(CheckedList, self).insert(index, item)
super().insert(index, item)

View file

@ -34,7 +34,7 @@ class AngleDistribution(EqualityMixin):
"""
def __init__(self, energy, mu):
super(AngleDistribution, self).__init__()
super().__init__()
self.energy = energy
self.mu = mu

View file

@ -45,7 +45,7 @@ class CorrelatedAngleEnergy(AngleEnergy):
"""
def __init__(self, breakpoints, interpolation, energy, energy_out, mu):
super(CorrelatedAngleEnergy, self).__init__()
super().__init__()
self.breakpoints = breakpoints
self.interpolation = interpolation
self.energy = energy

View file

@ -114,7 +114,7 @@ class ArbitraryTabulated(EnergyDistribution):
"""
def __init__(self, energy, pdf):
super(ArbitraryTabulated, self).__init__()
super().__init__()
self.energy = energy
self.pdf = pdf
@ -182,7 +182,7 @@ class GeneralEvaporation(EnergyDistribution):
"""
def __init__(self, theta, g, u):
super(GeneralEvaporation, self).__init__()
super().__init__()
self.theta = theta
self.g = g
self.u = u
@ -245,7 +245,7 @@ class MaxwellEnergy(EnergyDistribution):
"""
def __init__(self, theta, u):
super(MaxwellEnergy, self).__init__()
super().__init__()
self.theta = theta
self.u = u
@ -378,7 +378,7 @@ class Evaporation(EnergyDistribution):
"""
def __init__(self, theta, u):
super(Evaporation, self).__init__()
super().__init__()
self.theta = theta
self.u = u
@ -514,7 +514,7 @@ class WattEnergy(EnergyDistribution):
"""
def __init__(self, a, b, u):
super(WattEnergy, self).__init__()
super().__init__()
self.a = a
self.b = b
self.u = u
@ -682,7 +682,7 @@ class MadlandNix(EnergyDistribution):
"""
def __init__(self, efl, efh, tm):
super(MadlandNix, self).__init__()
super().__init__()
self.efl = efl
self.efh = efh
self.tm = tm
@ -805,7 +805,7 @@ class DiscretePhoton(EnergyDistribution):
"""
def __init__(self, primary_flag, energy, atomic_weight_ratio):
super(DiscretePhoton, self).__init__()
super().__init__()
self.primary_flag = primary_flag
self.energy = energy
self.atomic_weight_ratio = atomic_weight_ratio
@ -914,7 +914,7 @@ class LevelInelastic(EnergyDistribution):
"""
def __init__(self, threshold, mass_ratio):
super(LevelInelastic, self).__init__()
super().__init__()
self.threshold = threshold
self.mass_ratio = mass_ratio
@ -1019,7 +1019,7 @@ class ContinuousTabular(EnergyDistribution):
"""
def __init__(self, breakpoints, interpolation, energy, energy_out):
super(ContinuousTabular, self).__init__()
super().__init__()
self.breakpoints = breakpoints
self.interpolation = interpolation
self.energy = energy

View file

@ -53,7 +53,7 @@ class KalbachMann(AngleEnergy):
def __init__(self, breakpoints, interpolation, energy, energy_out,
precompound, slope):
super(KalbachMann, self).__init__()
super().__init__()
self.breakpoints = breakpoints
self.interpolation = interpolation
self.energy = energy

View file

@ -44,7 +44,7 @@ class LaboratoryAngleEnergy(AngleEnergy):
"""
def __init__(self, breakpoints, interpolation, energy, mu, energy_out):
super(LaboratoryAngleEnergy, self).__init__()
super().__init__()
self.breakpoints = breakpoints
self.interpolation = interpolation
self.energy = energy

View file

@ -288,8 +288,8 @@ class MultiLevelBreitWigner(ResonanceRange):
"""
def __init__(self, target_spin, energy_min, energy_max, channel, scattering):
super(MultiLevelBreitWigner, self).__init__(
target_spin, energy_min, energy_max, channel, scattering)
super().__init__(target_spin, energy_min, energy_max, channel,
scattering)
self.parameters = None
self.q_value = {}
self.atomic_weight_ratio = None
@ -490,8 +490,8 @@ class SingleLevelBreitWigner(MultiLevelBreitWigner):
"""
def __init__(self, target_spin, energy_min, energy_max, channel, scattering):
super(SingleLevelBreitWigner, self).__init__(
target_spin, energy_min, energy_max, channel, scattering)
super().__init__(target_spin, energy_min, energy_max, channel,
scattering)
# Set resonance reconstruction function
if _reconstruct:
@ -549,8 +549,8 @@ class ReichMoore(ResonanceRange):
"""
def __init__(self, target_spin, energy_min, energy_max, channel, scattering):
super(ReichMoore, self).__init__(
target_spin, energy_min, energy_max, channel, scattering)
super().__init__(target_spin, energy_min, energy_max, channel,
scattering)
self.parameters = None
self.angle_distribution = False
self.num_l_convergence = 0
@ -724,8 +724,7 @@ class RMatrixLimited(ResonanceRange):
"""
def __init__(self, energy_min, energy_max, particle_pairs, spin_groups):
super(RMatrixLimited, self).__init__(0.0, energy_min, energy_max,
None, None)
super().__init__(0.0, energy_min, energy_max, None, None)
self.reduced_width = False
self.formalism = 3
self.particle_pairs = particle_pairs
@ -931,8 +930,7 @@ class Unresolved(ResonanceRange):
"""
def __init__(self, target_spin, energy_min, energy_max, scatter):
super(Unresolved, self).__init__(
target_spin, energy_min, energy_max, None, scatter)
super().__init__(target_spin, energy_min, energy_max, None, scatter)
self.energies = None
self.parameters = None
self.add_to_background = False

View file

@ -29,7 +29,7 @@ class Element(str):
def __new__(cls, name):
cv.check_type('element name', name, str)
cv.check_length('element name', name, 1, 2)
return super(Element, cls).__new__(cls, name)
return super().__new__(cls, name)
@property
def name(self):

View file

@ -64,8 +64,7 @@ class FilterMeta(ABCMeta):
namespace[func_name].__doc__ = old_doc
# Make the class.
return super(FilterMeta, cls).__new__(cls, name, bases, namespace,
**kwargs)
return super().__new__(cls, name, bases, namespace, **kwargs)
class Filter(IDManagerMixin, metaclass=FilterMeta):
@ -672,7 +671,7 @@ class MeshFilter(Filter):
def __init__(self, mesh, filter_id=None):
self.mesh = mesh
super(MeshFilter, self).__init__(mesh.id, filter_id)
super().__init__(mesh.id, filter_id)
@classmethod
def from_hdf5(cls, group, **kwargs):
@ -869,7 +868,7 @@ class RealFilter(Filter):
# This logic is used when merging tallies with real filters
return self.bins[0] >= other.bins[-1]
else:
return super(RealFilter, self).__gt__(other)
return super().__gt__(other)
@property
def num_bins(self):
@ -1127,7 +1126,7 @@ class DistribcellFilter(Filter):
def __init__(self, cell, filter_id=None):
self._paths = None
super(DistribcellFilter, self).__init__(cell, filter_id)
super().__init__(cell, filter_id)
@classmethod
def from_hdf5(cls, group, **kwargs):

View file

@ -489,7 +489,7 @@ class RectLattice(Lattice):
"""
def __init__(self, lattice_id=None, name=''):
super(RectLattice, self).__init__(lattice_id, name)
super().__init__(lattice_id, name)
# Initialize Lattice class attributes
self._lower_left = None
@ -820,7 +820,7 @@ class HexLattice(Lattice):
"""
def __init__(self, lattice_id=None, name=''):
super(HexLattice, self).__init__(lattice_id, name)
super().__init__(lattice_id, name)
# Initialize Lattice class attributes
self._num_rings = None

View file

@ -18,7 +18,7 @@ class Macroscopic(str):
def __new__(cls, name):
check_type('name', name, str)
return super(Macroscopic, cls).__new__(cls, name)
return super().__new__(cls, name)
@property
def name(self):

View file

@ -885,7 +885,7 @@ class Materials(cv.CheckedList):
"""
def __init__(self, materials=None):
super(Materials, self).__init__(Material, 'materials collection')
super().__init__(Material, 'materials collection')
self._cross_sections = None
self._multipole_library = None
@ -954,7 +954,7 @@ class Materials(cv.CheckedList):
Material to append
"""
super(Materials, self).append(material)
super().append(material)
def insert(self, index, material):
"""Insert material before index
@ -967,7 +967,7 @@ class Materials(cv.CheckedList):
Material to insert
"""
super(Materials, self).insert(index, material)
super().insert(index, material)
def remove_material(self, material):
"""Remove a material from the file

View file

@ -129,8 +129,8 @@ class MDGXS(MGXS):
def __init__(self, domain=None, domain_type=None, energy_groups=None,
delayed_groups=None, by_nuclide=False, name='',
num_polar=1, num_azimuthal=1):
super(MDGXS, self).__init__(domain, domain_type, energy_groups,
by_nuclide, name, num_polar, num_azimuthal)
super().__init__(domain, domain_type, energy_groups, by_nuclide, name,
num_polar, num_azimuthal)
self._delayed_groups = None
@ -547,7 +547,7 @@ class MDGXS(MGXS):
"""
merged_mdgxs = super(MDGXS, self).merge(other)
merged_mdgxs = super().merge(other)
# Merge delayed groups
if self.delayed_groups != other.delayed_groups:
@ -577,7 +577,7 @@ class MDGXS(MGXS):
"""
if self.delayed_groups is None:
super(MDGXS, self).print_xs(subdomains, nuclides, xs_type)
super().print_xs(subdomains, nuclides, xs_type)
return
# Construct a collection of the subdomains to report
@ -1007,9 +1007,8 @@ class ChiDelayed(MDGXS):
def __init__(self, domain=None, domain_type=None, energy_groups=None,
delayed_groups=None, by_nuclide=False, name='',
num_polar=1, num_azimuthal=1):
super(ChiDelayed, self).__init__(domain, domain_type, energy_groups,
delayed_groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, energy_groups, delayed_groups,
by_nuclide, name, num_polar, num_azimuthal)
self._rxn_type = 'chi-delayed'
self._estimator = 'analog'
@ -1055,7 +1054,7 @@ class ChiDelayed(MDGXS):
# Compute chi
self._xs_tally = self.rxn_rate_tally / delayed_nu_fission_in
super(ChiDelayed, self)._compute_xs()
super()._compute_xs()
# Add the coarse energy filter back to the nu-fission tally
delayed_nu_fission_in.filters.append(energy_filter)
@ -1127,8 +1126,7 @@ class ChiDelayed(MDGXS):
delayed_nu_fission_in.remove_filter(energy_filter)
# Call super class method and null out derived tallies
slice_xs = super(ChiDelayed, self).get_slice(nuclides, groups,
delayed_groups)
slice_xs = super().get_slice(nuclides, groups, delayed_groups)
slice_xs._rxn_rate_tally = None
slice_xs._xs_tally = None
@ -1521,10 +1519,8 @@ class DelayedNuFissionXS(MDGXS):
def __init__(self, domain=None, domain_type=None, energy_groups=None,
delayed_groups=None, by_nuclide=False, name='',
num_polar=1, num_azimuthal=1):
super(DelayedNuFissionXS, self).__init__(domain, domain_type,
energy_groups, delayed_groups,
by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, energy_groups, delayed_groups,
by_nuclide, name, num_polar, num_azimuthal)
self._rxn_type = 'delayed-nu-fission'
@ -1657,9 +1653,8 @@ class Beta(MDGXS):
def __init__(self, domain=None, domain_type=None, energy_groups=None,
delayed_groups=None, by_nuclide=False, name='',
num_polar=1, num_azimuthal=1):
super(Beta, self).__init__(domain, domain_type, energy_groups,
delayed_groups, by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, energy_groups, delayed_groups,
by_nuclide, name, num_polar, num_azimuthal)
self._rxn_type = 'beta'
@property
@ -1685,7 +1680,7 @@ class Beta(MDGXS):
# Compute beta
self._xs_tally = self.rxn_rate_tally / nu_fission
super(Beta, self)._compute_xs()
super()._compute_xs()
return self._xs_tally
@ -1841,9 +1836,8 @@ class DecayRate(MDGXS):
def __init__(self, domain=None, domain_type=None, energy_groups=None,
delayed_groups=None, by_nuclide=False, name='',
num_polar=1, num_azimuthal=1):
super(DecayRate, self).__init__(domain, domain_type, energy_groups,
delayed_groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, energy_groups, delayed_groups,
by_nuclide, name, num_polar, num_azimuthal)
self._rxn_type = 'decay-rate'
@property
@ -1878,7 +1872,7 @@ class DecayRate(MDGXS):
# Compute the decay rate
self._xs_tally = self.rxn_rate_tally / delayed_nu_fission
super(DecayRate, self)._compute_xs()
super()._compute_xs()
return self._xs_tally
@ -2261,8 +2255,7 @@ class MatrixMDGXS(MDGXS):
"""
# Call super class method and null out derived tallies
slice_xs = super(MatrixMDGXS, self).get_slice(nuclides, in_groups,
delayed_groups)
slice_xs = super().get_slice(nuclides, in_groups, delayed_groups)
slice_xs._rxn_rate_tally = None
slice_xs._xs_tally = None
@ -2609,12 +2602,8 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS):
def __init__(self, domain=None, domain_type=None, energy_groups=None,
delayed_groups=None, by_nuclide=False, name='',
num_polar=1, num_azimuthal=1):
super(DelayedNuFissionMatrixXS, self).__init__(domain, domain_type,
energy_groups,
delayed_groups,
by_nuclide, name,
num_polar,
num_azimuthal)
super().__init__(domain, domain_type, energy_groups, delayed_groups,
by_nuclide, name, num_polar, num_azimuthal)
self._rxn_type = 'delayed-nu-fission'
self._hdf5_key = 'delayed-nu-fission matrix'
self._estimator = 'analog'

View file

@ -2292,7 +2292,7 @@ class MatrixMGXS(MGXS):
"""
# Call super class method and null out derived tallies
slice_xs = super(MatrixMGXS, self).get_slice(nuclides, in_groups)
slice_xs = super().get_slice(nuclides, in_groups)
slice_xs._rxn_rate_tally = None
slice_xs._xs_tally = None
@ -2567,9 +2567,8 @@ class TotalXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(TotalXS, self).__init__(domain, domain_type,
groups, by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._rxn_type = 'total'
@ -2704,9 +2703,8 @@ class TransportXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None, nu=False,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(TransportXS, self).__init__(domain, domain_type,
groups, by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
# Use tracklength estimators for the total MGXS term, and
# analog estimators for the transport correction term
@ -2715,7 +2713,7 @@ class TransportXS(MGXS):
self.nu = nu
def __deepcopy__(self, memo):
clone = super(TransportXS, self).__deepcopy__(memo)
clone = super().__deepcopy__(memo)
clone._nu = self.nu
return clone
@ -2912,9 +2910,8 @@ class AbsorptionXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(AbsorptionXS, self).__init__(domain, domain_type,
groups, by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._rxn_type = 'absorption'
@ -3039,9 +3036,8 @@ class CaptureXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(CaptureXS, self).__init__(domain, domain_type,
groups, by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._rxn_type = 'capture'
@property
@ -3194,16 +3190,15 @@ class FissionXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None, nu=False,
prompt=False, by_nuclide=False, name='', num_polar=1,
num_azimuthal=1):
super(FissionXS, self).__init__(domain, domain_type,
groups, by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._nu = False
self._prompt = False
self.nu = nu
self.prompt = prompt
def __deepcopy__(self, memo):
clone = super(FissionXS, self).__deepcopy__(memo)
clone = super().__deepcopy__(memo)
clone._nu = self.nu
clone._prompt = self.prompt
return clone
@ -3362,9 +3357,8 @@ class KappaFissionXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(KappaFissionXS, self).__init__(domain, domain_type,
groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._rxn_type = 'kappa-fission'
@ -3495,13 +3489,12 @@ class ScatterXS(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1,
num_azimuthal=1, nu=False):
super(ScatterXS, self).__init__(domain, domain_type,
groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self.nu = nu
def __deepcopy__(self, memo):
clone = super(ScatterXS, self).__deepcopy__(memo)
clone = super().__deepcopy__(memo)
clone._nu = self.nu
return clone
@ -3712,9 +3705,8 @@ class ScatterMatrixXS(MatrixMGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1,
num_azimuthal=1, nu=False):
super(ScatterMatrixXS, self).__init__(domain, domain_type,
groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._formulation = 'simple'
self._correction = 'P0'
self._scatter_format = 'legendre'
@ -3725,7 +3717,7 @@ class ScatterMatrixXS(MatrixMGXS):
self.nu = nu
def __deepcopy__(self, memo):
clone = super(ScatterMatrixXS, self).__deepcopy__(memo)
clone = super().__deepcopy__(memo)
clone._formulation = self.formulation
clone._correction = self.correction
clone._scatter_format = self.scatter_format
@ -3816,7 +3808,7 @@ class ScatterMatrixXS(MatrixMGXS):
@property
def tally_keys(self):
if self.formulation == 'simple':
return super(ScatterMatrixXS, self).tally_keys
return super().tally_keys
else:
# Add keys for groupwise scattering cross section
tally_keys = ['flux (tracklength)', 'scatter']
@ -4146,7 +4138,7 @@ class ScatterMatrixXS(MatrixMGXS):
[score_prefix + '{}'.format(i)
for i in range(self.legendre_order + 1)]
super(ScatterMatrixXS, self).load_from_statepoint(statepoint)
super().load_from_statepoint(statepoint)
def get_slice(self, nuclides=[], in_groups=[], out_groups=[],
legendre_order='same'):
@ -4186,7 +4178,7 @@ class ScatterMatrixXS(MatrixMGXS):
"""
# Call super class method and null out derived tallies
slice_xs = super(ScatterMatrixXS, self).get_slice(nuclides, in_groups)
slice_xs = super().get_slice(nuclides, in_groups)
slice_xs._rxn_rate_tally = None
slice_xs._xs_tally = None
@ -4477,8 +4469,7 @@ class ScatterMatrixXS(MatrixMGXS):
"""
df = super(ScatterMatrixXS, self).get_pandas_dataframe(
groups, nuclides, xs_type, paths)
df = super().get_pandas_dataframe(groups, nuclides, xs_type, paths)
if self.scatter_format == 'legendre':
# Add a moment column to dataframe
@ -4802,9 +4793,8 @@ class MultiplicityMatrixXS(MatrixMGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(MultiplicityMatrixXS, self).__init__(domain, domain_type, groups,
by_nuclide, name, num_polar,
num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._rxn_type = 'multiplicity matrix'
self._estimator = 'analog'
self._valid_estimators = ['analog']
@ -4839,7 +4829,7 @@ class MultiplicityMatrixXS(MatrixMGXS):
# Compute the multiplicity
self._xs_tally = self.rxn_rate_tally / scatter
super(MultiplicityMatrixXS, self)._compute_xs()
super()._compute_xs()
return self._xs_tally
@ -4968,9 +4958,8 @@ class ScatterProbabilityMatrix(MatrixMGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(ScatterProbabilityMatrix, self).__init__(
domain, domain_type, groups, by_nuclide,
name, num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide,
name, num_polar, num_azimuthal)
self._rxn_type = 'scatter'
self._hdf5_key = 'scatter probability matrix'
@ -5012,7 +5001,7 @@ class ScatterProbabilityMatrix(MatrixMGXS):
# Compute the group-to-group probabilities
self._xs_tally = self.tallies[self.rxn_type] / norm
super(ScatterProbabilityMatrix, self)._compute_xs()
super()._compute_xs()
return self._xs_tally
@ -5142,9 +5131,8 @@ class NuFissionMatrixXS(MatrixMGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1,
num_azimuthal=1, prompt=False):
super(NuFissionMatrixXS, self).__init__(domain, domain_type,
groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
if not prompt:
self._rxn_type = 'nu-fission'
self._hdf5_key = 'nu-fission matrix'
@ -5165,7 +5153,7 @@ class NuFissionMatrixXS(MatrixMGXS):
self._prompt = prompt
def __deepcopy__(self, memo):
clone = super(NuFissionMatrixXS, self).__deepcopy__(memo)
clone = super().__deepcopy__(memo)
clone._prompt = self.prompt
return clone
@ -5299,8 +5287,8 @@ class Chi(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
prompt=False, by_nuclide=False, name='', num_polar=1,
num_azimuthal=1):
super(Chi, self).__init__(domain, domain_type, groups, by_nuclide,
name, num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
if not prompt:
self._rxn_type = 'chi'
else:
@ -5310,7 +5298,7 @@ class Chi(MGXS):
self.prompt = prompt
def __deepcopy__(self, memo):
clone = super(Chi, self).__deepcopy__(memo)
clone = super().__deepcopy__(memo)
clone._prompt = self.prompt
return clone
@ -5440,7 +5428,7 @@ class Chi(MGXS):
nu_fission_in.remove_filter(energy_filter)
# Call super class method and null out derived tallies
slice_xs = super(Chi, self).get_slice(nuclides, groups)
slice_xs = super().get_slice(nuclides, groups)
slice_xs._rxn_rate_tally = None
slice_xs._xs_tally = None
@ -5718,8 +5706,7 @@ class Chi(MGXS):
"""
# Build the dataframe using the parent class method
df = super(Chi, self).get_pandas_dataframe(
groups, nuclides, xs_type, paths=paths)
df = super().get_pandas_dataframe(groups, nuclides, xs_type, paths=paths)
# If user requested micro cross sections, multiply by the atom
# densities to cancel out division made by the parent class method
@ -5877,9 +5864,8 @@ class InverseVelocity(MGXS):
def __init__(self, domain=None, domain_type=None, groups=None,
by_nuclide=False, name='', num_polar=1, num_azimuthal=1):
super(InverseVelocity, self).__init__(domain, domain_type,
groups, by_nuclide, name,
num_polar, num_azimuthal)
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
self._rxn_type = 'inverse-velocity'
def get_units(self, xs_type='macro'):

View file

@ -45,7 +45,7 @@ class TRISO(openmc.Cell):
def __init__(self, outer_radius, fill, center=(0., 0., 0.)):
self._surface = openmc.Sphere(R=outer_radius)
super(TRISO, self).__init__(fill=fill, region=-self._surface)
super().__init__(fill=fill, region=-self._surface)
self.center = np.asarray(center)
@property
@ -245,7 +245,7 @@ class _CubicDomain(_Domain):
"""
def __init__(self, length, particle_radius, center=[0., 0., 0.]):
super(_CubicDomain, self).__init__(particle_radius, center)
super().__init__(particle_radius, center)
self.length = length
@property
@ -324,7 +324,7 @@ class _CylindricalDomain(_Domain):
"""
def __init__(self, length, radius, particle_radius, center=[0., 0., 0.]):
super(_CylindricalDomain, self).__init__(particle_radius, center)
super().__init__(particle_radius, center)
self.length = length
self.radius = radius
@ -414,7 +414,7 @@ class _SphericalDomain(_Domain):
"""
def __init__(self, radius, particle_radius, center=[0., 0., 0.]):
super(_SphericalDomain, self).__init__(particle_radius, center)
super().__init__(particle_radius, center)
self.radius = radius
@property

View file

@ -32,7 +32,7 @@ class Nuclide(str):
'"{}" is being renamed as "{}".'.format(orig_name, name)
warnings.warn(msg)
return super(Nuclide, cls).__new__(cls, name)
return super().__new__(cls, name)
@property
def name(self):

View file

@ -673,7 +673,7 @@ class Plots(cv.CheckedList):
"""
def __init__(self, plots=None):
super(Plots, self).__init__(Plot, 'plots collection')
super().__init__(Plot, 'plots collection')
self._plots_file = ET.Element("plots")
if plots is not None:
self += plots
@ -704,7 +704,7 @@ class Plots(cv.CheckedList):
Plot to append
"""
super(Plots, self).append(plot)
super().append(plot)
def insert(self, index, plot):
"""Insert plot before index
@ -717,7 +717,7 @@ class Plots(cv.CheckedList):
Plot to insert
"""
super(Plots, self).insert(index, plot)
super().insert(index, plot)
def remove_plot(self, plot):
"""Remove a plot from the file.

View file

@ -75,7 +75,7 @@ class PolarAzimuthal(UnitSphere):
"""
def __init__(self, mu=None, phi=None, reference_uvw=[0., 0., 1.]):
super(PolarAzimuthal, self).__init__(reference_uvw)
super().__init__(reference_uvw)
if mu is not None:
self.mu = mu
else:
@ -128,7 +128,7 @@ class Isotropic(UnitSphere):
"""
def __init__(self):
super(Isotropic, self).__init__()
super().__init__()
def to_xml_element(self):
"""Return XML representation of the isotropic distribution
@ -161,7 +161,7 @@ class Monodirectional(UnitSphere):
def __init__(self, reference_uvw=[1., 0., 0.]):
super(Monodirectional, self).__init__(reference_uvw)
super().__init__(reference_uvw)
def to_xml_element(self):
"""Return XML representation of the monodirectional distribution
@ -222,7 +222,7 @@ class CartesianIndependent(Spatial):
def __init__(self, x, y, z):
super(CartesianIndependent, self).__init__()
super().__init__()
self.x = x
self.y = y
self.z = z
@ -298,7 +298,7 @@ class Box(Spatial):
def __init__(self, lower_left, upper_right, only_fissionable=False):
super(Box, self).__init__()
super().__init__()
self.lower_left = lower_left
self.upper_right = upper_right
self.only_fissionable = only_fissionable
@ -371,7 +371,7 @@ class Point(Spatial):
"""
def __init__(self, xyz=(0., 0., 0.)):
super(Point, self).__init__()
super().__init__()
self.xyz = xyz
@property

View file

@ -57,7 +57,7 @@ class Discrete(Univariate):
"""
def __init__(self, x, p):
super(Discrete, self).__init__()
super().__init__()
self.x = x
self.p = p
@ -131,7 +131,7 @@ class Uniform(Univariate):
"""
def __init__(self, a=0.0, b=1.0):
super(Uniform, self).__init__()
super().__init__()
self.a = a
self.b = b
@ -202,7 +202,7 @@ class Maxwell(Univariate):
"""
def __init__(self, theta):
super(Maxwell, self).__init__()
super().__init__()
self.theta = theta
def __len__(self):
@ -262,7 +262,7 @@ class Watt(Univariate):
"""
def __init__(self, a=0.988e6, b=2.249e-6):
super(Watt, self).__init__()
super().__init__()
self.a = a
self.b = b
@ -342,7 +342,7 @@ class Tabular(Univariate):
def __init__(self, x, p, interpolation='linear-linear',
ignore_negative=False):
super(Tabular, self).__init__()
super().__init__()
self._ignore_negative = ignore_negative
self.x = x
self.p = p
@ -470,7 +470,7 @@ class Mixture(Univariate):
"""
def __init__(self, probability, distribution):
super(Mixture, self).__init__()
super().__init__()
self.probability = probability
self.distribution = distribution

View file

@ -326,7 +326,7 @@ class Plane(Surface):
def __init__(self, surface_id=None, boundary_type='transmission',
A=1., B=0., C=0., D=0., name=''):
super(Plane, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._type = 'plane'
self._coeff_keys = ['A', 'B', 'C', 'D']
@ -410,7 +410,7 @@ class Plane(Surface):
XML element containing source data
"""
element = super(Plane, self).to_xml_element()
element = super().to_xml_element()
# Add periodic surface pair information
if self.boundary_type == 'periodic':
@ -460,7 +460,7 @@ class XPlane(Plane):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., name=''):
super(XPlane, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._type = 'x-plane'
self._coeff_keys = ['x0']
@ -566,7 +566,7 @@ class YPlane(Plane):
def __init__(self, surface_id=None, boundary_type='transmission',
y0=0., name=''):
# Initialize YPlane class attributes
super(YPlane, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._type = 'y-plane'
self._coeff_keys = ['y0']
@ -672,7 +672,7 @@ class ZPlane(Plane):
def __init__(self, surface_id=None, boundary_type='transmission',
z0=0., name=''):
# Initialize ZPlane class attributes
super(ZPlane, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._type = 'z-plane'
self._coeff_keys = ['z0']
@ -773,7 +773,7 @@ class Cylinder(Surface, metaclass=ABCMeta):
"""
def __init__(self, surface_id=None, boundary_type='transmission',
R=1., name=''):
super(Cylinder, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._coeff_keys = ['R']
self.r = R
@ -833,7 +833,7 @@ class XCylinder(Cylinder):
def __init__(self, surface_id=None, boundary_type='transmission',
y0=0., z0=0., R=1., name=''):
super(XCylinder, self).__init__(surface_id, boundary_type, R, name=name)
super().__init__(surface_id, boundary_type, R, name=name)
self._type = 'x-cylinder'
self._coeff_keys = ['y0', 'z0', 'R']
@ -955,7 +955,7 @@ class YCylinder(Cylinder):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., z0=0., R=1., name=''):
super(YCylinder, self).__init__(surface_id, boundary_type, R, name=name)
super().__init__(surface_id, boundary_type, R, name=name)
self._type = 'y-cylinder'
self._coeff_keys = ['x0', 'z0', 'R']
@ -1077,7 +1077,7 @@ class ZCylinder(Cylinder):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., y0=0., R=1., name=''):
super(ZCylinder, self).__init__(surface_id, boundary_type, R, name=name)
super().__init__(surface_id, boundary_type, R, name=name)
self._type = 'z-cylinder'
self._coeff_keys = ['x0', 'y0', 'R']
@ -1203,7 +1203,7 @@ class Sphere(Surface):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., y0=0., z0=0., R=1., name=''):
super(Sphere, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._type = 'sphere'
self._coeff_keys = ['x0', 'y0', 'z0', 'R']
@ -1350,7 +1350,7 @@ class Cone(Surface, metaclass=ABCMeta):
"""
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., y0=0., z0=0., R2=1., name=''):
super(Cone, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._coeff_keys = ['x0', 'y0', 'z0', 'R2']
self.x0 = x0
@ -1445,7 +1445,7 @@ class XCone(Cone):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., y0=0., z0=0., R2=1., name=''):
super(XCone, self).__init__(surface_id, boundary_type, x0, y0,
super().__init__(surface_id, boundary_type, x0, y0,
z0, R2, name=name)
self._type = 'x-cone'
@ -1521,7 +1521,7 @@ class YCone(Cone):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., y0=0., z0=0., R2=1., name=''):
super(YCone, self).__init__(surface_id, boundary_type, x0, y0, z0,
super().__init__(surface_id, boundary_type, x0, y0, z0,
R2, name=name)
self._type = 'y-cone'
@ -1597,7 +1597,7 @@ class ZCone(Cone):
def __init__(self, surface_id=None, boundary_type='transmission',
x0=0., y0=0., z0=0., R2=1., name=''):
super(ZCone, self).__init__(surface_id, boundary_type, x0, y0, z0,
super().__init__(surface_id, boundary_type, x0, y0, z0,
R2, name=name)
self._type = 'z-cone'
@ -1662,7 +1662,7 @@ class Quadric(Surface):
def __init__(self, surface_id=None, boundary_type='transmission',
a=0., b=0., c=0., d=0., e=0., f=0., g=0.,
h=0., j=0., k=0., name=''):
super(Quadric, self).__init__(surface_id, boundary_type, name=name)
super().__init__(surface_id, boundary_type, name=name)
self._type = 'quadric'
self._coeff_keys = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k']

View file

@ -3242,7 +3242,7 @@ class Tallies(cv.CheckedList):
"""
def __init__(self, tallies=None):
super(Tallies, self).__init__(Tally, 'tallies collection')
super().__init__(Tally, 'tallies collection')
if tallies is not None:
self += tallies
@ -3299,10 +3299,10 @@ class Tallies(cv.CheckedList):
# If no mergeable tally was found, simply add this tally
if not merged:
super(Tallies, self).append(tally)
super().append(tally)
else:
super(Tallies, self).append(tally)
super().append(tally)
def insert(self, index, item):
"""Insert tally before index
@ -3315,7 +3315,7 @@ class Tallies(cv.CheckedList):
Tally to insert
"""
super(Tallies, self).insert(index, item)
super().insert(index, item)
def remove_tally(self, tally):
"""Remove a tally from the collection