Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unused method arguments #754

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions armi/bookkeeping/db/compareDB3.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,14 @@ def _compareTimeStep(
)

for aux in auxData:
_compareAuxData(out, refGroup[aux], srcGroup[aux], diffResults, exclusions)
_compareAuxData(out, refGroup[aux], srcGroup[aux], diffResults)


def _compareAuxData(
out: OutputWriter,
refGroup: h5py.Group,
srcGroup: h5py.Group,
diffResults: DiffResults,
exclusions: Sequence[Pattern],
):
"""
Compare auxiliary datasets, which aren't stored as Parameters on the Composite model.
Expand All @@ -278,7 +277,7 @@ def visitor(name, obj):
diffResults.addStructureDiffs(n)
matchedSets = set(srcData.keys()) & set(refData.keys())
for name in matchedSets:
_diffSimpleData(refData[name], srcData[name], out, diffResults)
_diffSimpleData(refData[name], srcData[name], diffResults)


def _compareSets(
Expand Down Expand Up @@ -411,9 +410,7 @@ def _diffSpecialData(
return


def _diffSimpleData(
ref: numpy.ndarray, src: numpy.ndarray, out: OutputWriter, diffResults: DiffResults
):
def _diffSimpleData(ref: numpy.ndarray, src: numpy.ndarray, diffResults: DiffResults):
paramName = ref.name.split("/")[-1]
compName = ref.name.split("/")[-2]

Expand Down Expand Up @@ -489,4 +486,4 @@ def _compareComponentData(
if srcSpecial or refSpecial:
_diffSpecialData(refDataset, srcDataset, out, diffResults)
else:
_diffSimpleData(refDataset, srcDataset, out, diffResults)
_diffSimpleData(refDataset, srcDataset, diffResults)
10 changes: 2 additions & 8 deletions armi/bookkeeping/memoryProfiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ def displayMemoryUsage(self, timeDescription):
runLog.important(
"----- Memory Usage Report at {} -----".format(timeDescription)
)
self._printFullMemoryBreakdown(
startsWith="", reportSize=self.cs["debugMemSize"]
)
self._printFullMemoryBreakdown(reportSize=self.cs["debugMemSize"])
self._reactorAssemblyTrackingBreakdown()
runLog.important(
"----- End Memory Usage Report at {} -----".format(timeDescription)
Expand Down Expand Up @@ -188,16 +186,12 @@ def checkAttr(subObj):
)
raise RuntimeError

def _printFullMemoryBreakdown(
self, startsWith="armi", reportSize=True, printReferrers=False
):
def _printFullMemoryBreakdown(self, reportSize=True, printReferrers=False):
"""
looks for any class from any module in the garbage collector and prints their count and size

Parameters
----------
startsWith : str, optional
limit to objects with classes that start with a certain string
reportSize : bool, optional
calculate size as well as counting individual objects.

Expand Down
6 changes: 2 additions & 4 deletions armi/bookkeeping/tests/test_memoryProfiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ def test_fullBreakdown(self):

# we should start at info level, and that should be working correctly
self.assertEqual(runLog.LOG.getVerbosity(), logging.INFO)
self.memPro._printFullMemoryBreakdown(
startsWith="armi.physics", reportSize=False
)
self.memPro._printFullMemoryBreakdown(reportSize=False)

# do some basic testing
self.assertTrue(mock._outputStream.count("UNIQUE_INSTANCE_COUNT") > 10)
Expand Down Expand Up @@ -73,7 +71,7 @@ def test_printFullMemoryBreakdown(self):

# we should start at info level, and that should be working correctly
self.assertEqual(runLog.LOG.getVerbosity(), logging.INFO)
self.memPro._printFullMemoryBreakdown(startsWith="", reportSize=True)
self.memPro._printFullMemoryBreakdown(reportSize=True)

# do some basic testing
self.assertIn("UNIQUE_INSTANCE_COUNT", mock._outputStream)
Expand Down
6 changes: 1 addition & 5 deletions armi/cases/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,8 @@ def checkInputs(self):

return not any(inspectorIssues)

def summarizeDesign(self, generateFullCoreMap=True, showBlockAxialMesh=True):
def summarizeDesign(self):
"""Uses the ReportInterface to create a fancy HTML page describing the design inputs."""

_ = reportsEntryPoint.createReportFromSettings(self.cs)

def buildCommand(self, python="python"):
Expand Down Expand Up @@ -629,10 +628,7 @@ def compare(
self,
that,
exclusion: Optional[Sequence[str]] = None,
weights=None,
tolerance=0.01,
timestepMatchup=None,
output="",
) -> int:
"""
Compare the output databases from two run cases. Return number of differences.
Expand Down
2 changes: 1 addition & 1 deletion armi/cases/tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_summarizeDesign(self):
cs = cs.modified(newSettings={"verbosity": "important"})
case = cases.Case(cs)
c2 = case.clone()
c2.summarizeDesign(True, True)
c2.summarizeDesign()
self.assertTrue(
os.path.exists(
os.path.join("{}-reports".format(c2.cs.caseTitle), "index.html")
Expand Down
4 changes: 1 addition & 3 deletions armi/cli/checkInputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def invoke(self):
hasIssues = "PASSED" if case.checkInputs() else "HAS ISSUES"
try:
if self.args.generate_design_summary:
case.summarizeDesign(
self.args.full_core_map, not self.args.disable_block_axial_mesh
)
case.summarizeDesign()
canStart = "PASSED"
else:
canStart = "UNKNOWN"
Expand Down
2 changes: 0 additions & 2 deletions armi/materials/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ def getLifeMetalConservativeFcciCoeff(self, Tk: float) -> float:
"""
Return the coefficient to be used in the LIFE-METAL correlation
"""

return 0.0

def yieldStrength(self, Tk: float = None, Tc: float = None) -> float:
Expand Down Expand Up @@ -500,7 +499,6 @@ def getMassFrac(

Notes
-----

self.p.massFrac are modified mass fractions that may not add up to 1.0
(for instance, after a axial expansion, the modified mass fracs will sum to less than one.
The alternative is to put a multiplier on the density. They're mathematically equivalent.
Expand Down
9 changes: 4 additions & 5 deletions armi/mpiActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ def _diagnosePickleError(o):

We also find that modifying the Python library as documented here tells us which
object can't be pickled by printing it out.

"""
checker = utils.tryPickleOnAllContents3
runLog.info("-------- Pickle Error Detection -------")
Expand All @@ -685,19 +684,19 @@ def _diagnosePickleError(o):
)
)
runLog.info("Scanning the Reactor for pickle errors")
checker(o.r, verbose=True)
checker(o.r)

runLog.info("Scanning All assemblies for pickle errors")
for a in o.r.core.getAssemblies(includeAll=True): # pylint: disable=no-member
checker(a, ignore=["blockStack"])
checker(a)

runLog.info("Scanning all blocks for pickle errors")
for b in o.r.core.getBlocks(includeAll=True): # pylint: disable=no-member
checker(b, ignore=["parentAssembly", "r"])
checker(b)

runLog.info("Scanning blocks by name for pickle errors")
for _bName, b in o.r.core.blocksByName.items(): # pylint: disable=no-member
checker(b, ignore=["parentAssembly", "r"])
checker(b)

runLog.info("Scanning the ISOTXS library for pickle errors")
checker(o.r.core.lib) # pylint: disable=no-member
Expand Down
16 changes: 4 additions & 12 deletions armi/reactor/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def getMgFlux(self, adjoint=False, average=False, volume=None, gamma=False):
flux = (flux + lastFlux) / 2.0
return flux

def setPinMgFluxes(self, fluxes, numPins, adjoint=False, gamma=False):
def setPinMgFluxes(self, fluxes, adjoint=False, gamma=False):
"""
Store the pin-detailed multi-group neutron flux

Expand All @@ -374,13 +374,8 @@ def setPinMgFluxes(self, fluxes, numPins, adjoint=False, gamma=False):
The block-level pin multigroup fluxes. fluxes[g][i] represents the flux in group g for pin i.
Flux units are the standard n/cm^2/s.
The "ARMI pin ordering" is used, which is counter-clockwise from 3 o'clock.

numPins : int
The number of pins in this block.

adjoint : bool, optional
Whether to set real or adjoint data.

gamma : bool, optional
Whether to set gamma or neutron data.

Expand Down Expand Up @@ -573,8 +568,8 @@ def coords(self, rotationDegreesCCW=0.0):
raise NotImplementedError("Cannot get coordinates with rotation.")
return self.spatialLocator.getGlobalCoordinates()

def setBuLimitInfo(self, cs):
r"""Sets burnup limit based on igniter, feed, etc. (will implement general grouping later)"""
def setBuLimitInfo(self):
r"""Sets burnup limit based on igniter, feed, etc."""
if self.p.buRate == 0:
# might be cycle 1 or a non-burning block
self.p.timeToLimit = 0.0
Expand Down Expand Up @@ -1033,16 +1028,14 @@ def mergeWithBlock(self, otherBlock, fraction):

self.setNumberDensities(newDensities)

def getComponentAreaFrac(self, typeSpec, exact=True):
def getComponentAreaFrac(self, typeSpec):
"""
Returns the area fraction of the specified component(s) among all components in the block.

Parameters
----------
typeSpec : Flags or list of Flags
Component types to look up
exact : bool, optional
Match exact names only

Examples
---------
Expand All @@ -1054,7 +1047,6 @@ def getComponentAreaFrac(self, typeSpec, exact=True):
float
The area fraction of the component.
"""

tFrac = sum(f for (c, f) in self.getVolumeFractions() if c.hasFlags(typeSpec))

if tFrac:
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/blueprints/blockBlueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def construct(
b.p.height = height
b.p.heightBOL = height # for fuel performance
b.p.xsType = xsType
b.setBuLimitInfo(cs)
b.setBuLimitInfo()
b = self._mergeComponents(b)
b.verifyBlockDims()
b.spatialGrid = spatialGrid
Expand Down
12 changes: 3 additions & 9 deletions armi/reactor/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,11 @@ class ZeroMassComponent(UnshapedVolumetricComponent):
"""

def getNumberDensity(self, *args, **kwargs):
"""
Always return 0 because this component has not mass
"""
"""Always return 0 because this component has not mass"""
return 0.0

def setNumberDensity(self, *args, **kwargs):
"""
Never add mass
"""
"""Never add mass"""
pass


Expand All @@ -288,9 +284,7 @@ class PositiveOrNegativeVolumeComponent(UnshapedVolumetricComponent):
"""

def _checkNegativeVolume(self, volume):
"""
Allow negative areas.
"""
"""Allow negative areas."""
pass


Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/converters/geometryConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ def convert(self, r=None):
geometry.DomainType.FULL_CORE, geometry.BoundaryType.NO_SYMMETRY
)

def restorePreviousGeometry(self, cs, r):
def restorePreviousGeometry(self, r):
"""Undo the changes made by convert by going back to 1/3 core."""
# remove the assemblies that were added when the conversion happened.
if bool(self.getNewAssembliesAdded()):
Expand Down
4 changes: 2 additions & 2 deletions armi/reactor/converters/tests/test_geometryConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def test_growToFullCoreFromThirdCore(self):
)

# Check that the geometry can be restored to a third core
changer.restorePreviousGeometry(self.o.cs, self.r)
changer.restorePreviousGeometry(self.r)
self.assertEqual(initialNumBlocks, len(self.r.core.getBlocks()))
self.assertEqual(
self.r.core.symmetry,
Expand Down Expand Up @@ -420,7 +420,7 @@ def test_skipGrowToFullCoreWhenAlreadyFullCore(self):
changer.convert(self.r)
self.assertEqual(self.r.core.symmetry.domain, geometry.DomainType.FULL_CORE)
self.assertEqual(initialNumBlocks, len(self.r.core.getBlocks()))
changer.restorePreviousGeometry(self.o.cs, self.r)
changer.restorePreviousGeometry(self.r)
self.assertEqual(initialNumBlocks, len(self.r.core.getBlocks()))
self.assertEqual(self.r.core.symmetry.domain, geometry.DomainType.FULL_CORE)

Expand Down
1 change: 0 additions & 1 deletion armi/reactor/grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,6 @@ def indicesOfBounds(self, rad0, rad1, theta0, theta1, sigma=1e-4):
Returns
-------
tuple : i, j, k of given bounds

"""
i = int(numpy.abs(self._bounds[0] - theta0).argmin())
j = int(numpy.abs(self._bounds[1] - rad0).argmin())
Expand Down
Loading