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

Update to black v22.6 #1396

Merged
merged 3 commits into from
Aug 30, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/black.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
with:
python-version: '3.11'
- name: Install Black
run: pip install 'black==20.8b1' 'click==8.0.1'
run: pip install 'black==22.6.0'
- name: Run black --check .
run: black --check .
6 changes: 3 additions & 3 deletions armi/bookkeeping/memoryProfiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ def _printFullMemoryBreakdown(self, reportSize=True, printReferrers=False):
"UNIQUE_INSTANCE_COUNT: {:60s} {:10d} {:10.1f} MB".format(
counter.classType.__name__,
counter.count,
counter.memSize / (1024 ** 2.0),
counter.memSize / (1024**2.0),
)
)
if printReferrers and counter.memSize / (1024 ** 2.0) > 100:
if printReferrers and counter.memSize / (1024**2.0) > 100:
referrers = gc.get_referrers(counter.first)
runLog.info(" Referrers of first one: ")
for referrer in referrers:
Expand Down Expand Up @@ -342,7 +342,7 @@ def __init__(self):
self.processMemoryInMB: Optional[float] = None
if _havePsutil:
self.percentNodeRamUsed = psutil.virtual_memory().percent
self.processMemoryInMB = psutil.Process().memory_info().rss / (1012.0 ** 2)
self.processMemoryInMB = psutil.Process().memory_info().rss / (1012.0**2)

def __isub__(self, other):
if self.percentNodeRamUsed is not None and other.percentNodeRamUsed is not None:
Expand Down
12 changes: 6 additions & 6 deletions armi/materials/air.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def pseudoDensity(
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("pseudoDensity", Tk)
inv_Tk = 1.0 / getTk(Tc, Tk)
rho_kgPerM3 = 1.15675e03 * inv_Tk ** 2 + 3.43413e02 * inv_Tk + 2.99731e-03
rho_kgPerM3 = 1.15675e03 * inv_Tk**2 + 3.43413e02 * inv_Tk + 2.99731e-03
return rho_kgPerM3 / G_PER_CM3_TO_KG_PER_M3

def specificVolumeLiquid(self, Tk=None, Tc=None):
Expand Down Expand Up @@ -114,8 +114,8 @@ def thermalConductivity(self, Tk=None, Tc=None):
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("thermal conductivity", Tk)
thermalConductivity = (
2.13014e-08 * Tk ** 3
- 6.31916e-05 * Tk ** 2
2.13014e-08 * Tk**3
- 6.31916e-05 * Tk**2
+ 1.11629e-01 * Tk
- 2.00043e00
)
Expand Down Expand Up @@ -145,9 +145,9 @@ def heatCapacity(self, Tk=None, Tc=None):
return (
sum(
[
+1.38642e-13 * Tk ** 4,
-6.47481e-10 * Tk ** 3,
+1.02345e-06 * Tk ** 2,
+1.38642e-13 * Tk**4,
-6.47481e-10 * Tk**3,
+1.02345e-06 * Tk**2,
-4.32829e-04 * Tk,
+1.06133e00,
]
Expand Down
2 changes: 1 addition & 1 deletion armi/materials/be9.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tk)
return 1e-4 * (8.4305 + 1.1464e-2 * Tk - 2.9752e-6 * Tk ** 2)
return 1e-4 * (8.4305 + 1.1464e-2 * Tk - 2.9752e-6 * Tk**2)
2 changes: 1 addition & 1 deletion armi/materials/copper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tk)
return 5.0298e-07 * Tk ** 2 + 1.3042e-03 * Tk - 4.3097e-01
return 5.0298e-07 * Tk**2 + 1.3042e-03 * Tk - 4.3097e-01
2 changes: 1 addition & 1 deletion armi/materials/graphite.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
From [INL-EXT-16-38241]_, page 4.
"""
Tc = units.getTc(Tc, Tk)
return 100 * (-1.454e-4 + 4.812e-6 * Tc + 1.145e-9 * Tc ** 2)
return 100 * (-1.454e-4 + 4.812e-6 * Tc + 1.145e-9 * Tc**2)
14 changes: 7 additions & 7 deletions armi/materials/hastelloyN.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def thermalConductivity(self, Tk=None, Tc=None):
Tc = getTc(Tc, Tk)
Tk = getTk(Tc=Tc)
self.checkPropertyTempRange("thermal conductivity", Tk)
return 1.92857e-05 * Tc ** 2 + 3.12857e-03 * Tc + 1.17743e01 # W/m-K
return 1.92857e-05 * Tc**2 + 3.12857e-03 * Tc + 1.17743e01 # W/m-K

def heatCapacity(self, Tk=None, Tc=None):
r"""
Expand All @@ -112,11 +112,11 @@ def heatCapacity(self, Tk=None, Tc=None):
return (
+3.19981e02
+ 2.47421e00 * Tc
- 2.49306e-02 * Tc ** 2
+ 1.32517e-04 * Tc ** 3
- 3.58872e-07 * Tc ** 4
+ 4.69003e-10 * Tc ** 5
- 2.32692e-13 * Tc ** 6
- 2.49306e-02 * Tc**2
+ 1.32517e-04 * Tc**3
- 3.58872e-07 * Tc**4
+ 4.69003e-10 * Tc**5
- 2.32692e-13 * Tc**6
)

def linearExpansionPercent(self, Tk=None, Tc=None):
Expand Down Expand Up @@ -157,4 +157,4 @@ def meanCoefficientThermalExpansion(self, Tk=None, Tc=None):
Tc = getTc(Tc, Tk)
Tk = getTk(Tc=Tc)
self.checkPropertyTempRange("thermal expansion", Tk)
return 2.60282e-12 * Tc ** 2 + 7.69859e-10 * Tc + 1.21036e-05
return 2.60282e-12 * Tc**2 + 7.69859e-10 * Tc + 1.21036e-05
8 changes: 4 additions & 4 deletions armi/materials/ht9.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
tk = units.getTk(Tc, Tk)
self.checkPropertyTempRange("linear expansion", tk)
return -0.16256 + 1.62307e-4 * tk + 1.42357e-6 * tk ** 2 - 5.50344e-10 * tk ** 3
return -0.16256 + 1.62307e-4 * tk + 1.42357e-6 * tk**2 - 5.50344e-10 * tk**3

def thermalConductivity(self, Tk=None, Tc=None):
"""
Expand All @@ -80,7 +80,7 @@ def thermalConductivity(self, Tk=None, Tc=None):
return (
29.65
- 6.668e-2 * Tk
+ 2.184e-4 * Tk ** 2
- 2.527e-7 * Tk ** 3
+ 9.621e-11 * Tk ** 4
+ 2.184e-4 * Tk**2
- 2.527e-7 * Tk**3
+ 9.621e-11 * Tk**4
)
6 changes: 3 additions & 3 deletions armi/materials/inconel600.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def thermalConductivity(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("thermal conductivity", Tc)
thermalCond = 3.4938e-6 * Tc ** 2 + 1.3403e-2 * Tc + 14.572
thermalCond = 3.4938e-6 * Tc**2 + 1.3403e-2 * Tc + 14.572
return thermalCond # W/m-C

def polyfitHeatCapacity(self, power=2):
Expand Down Expand Up @@ -133,7 +133,7 @@ def heatCapacity(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("heat capacity", Tc)
heatCapacity = 7.4021e-6 * Tc ** 2 + 0.20573 * Tc + 441.3
heatCapacity = 7.4021e-6 * Tc**2 + 0.20573 * Tc + 441.3
return heatCapacity # J/kg-C

def polyfitLinearExpansionPercent(self, power=2):
Expand Down Expand Up @@ -195,7 +195,7 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tc)
linExpPercent = 3.722e-7 * Tc ** 2 + 1.303e-3 * Tc - 2.863e-2
linExpPercent = 3.722e-7 * Tc**2 + 1.303e-3 * Tc - 2.863e-2
return linExpPercent

def linearExpansion(self, Tk=None, Tc=None):
Expand Down
6 changes: 3 additions & 3 deletions armi/materials/inconel625.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def thermalConductivity(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("thermal conductivity", Tc)
thermalCond = 2.7474e-6 * Tc ** 2 + 0.012907 * Tc + 9.62532
thermalCond = 2.7474e-6 * Tc**2 + 0.012907 * Tc + 9.62532
return thermalCond # W/m-C

def polyfitHeatCapacity(self, power=2):
Expand Down Expand Up @@ -162,7 +162,7 @@ def heatCapacity(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("heat capacity", Tc)
heatCapacity = -5.3777e-6 * Tc ** 2 + 0.25 * Tc + 404.26
heatCapacity = -5.3777e-6 * Tc**2 + 0.25 * Tc + 404.26
return heatCapacity # J/kg-C

def polyfitLinearExpansionPercent(self, power=2):
Expand Down Expand Up @@ -224,7 +224,7 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tc)
linExpPercent = 5.083e-7 * Tc ** 2 + 1.125e-3 * Tc - 1.804e-2
linExpPercent = 5.083e-7 * Tc**2 + 1.125e-3 * Tc - 1.804e-2
return linExpPercent

def linearExpansion(self, Tk=None, Tc=None):
Expand Down
4 changes: 2 additions & 2 deletions armi/materials/inconel800.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def meanCoefficientThermalExpansion(self, Tk=None, Tc=None):
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("thermal expansion", Tc)
return (
2.52525e-14 * Tc ** 3
- 3.77814e-11 * Tc ** 2
2.52525e-14 * Tc**3
- 3.77814e-11 * Tc**2
+ 2.06360e-08 * Tc
+ 1.28071e-05
)
6 changes: 3 additions & 3 deletions armi/materials/inconelX750.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def thermalConductivity(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("thermal conductivity", Tc)
thermalCond = 1.4835e-6 * Tc ** 2 + 1.2668e-2 * Tc + 11.632
thermalCond = 1.4835e-6 * Tc**2 + 1.2668e-2 * Tc + 11.632
return thermalCond # W/m-C

def polyfitHeatCapacity(self, power=3):
Expand Down Expand Up @@ -164,7 +164,7 @@ def heatCapacity(self, Tk=None, Tc=None):
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("heat capacity", Tc)
heatCapacity = (
9.2261e-7 * Tc ** 3 - 9.6368e-4 * Tc ** 2 + 4.7778e-1 * Tc + 420.55
9.2261e-7 * Tc**3 - 9.6368e-4 * Tc**2 + 4.7778e-1 * Tc + 420.55
)
return heatCapacity # J/kg-C

Expand Down Expand Up @@ -227,7 +227,7 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Tc = getTc(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tc)
linExpPercent = 6.8378e-7 * Tc ** 2 + 1.056e-3 * Tc - 1.3161e-2
linExpPercent = 6.8378e-7 * Tc**2 + 1.056e-3 * Tc - 1.3161e-2
return linExpPercent

def linearExpansion(self, Tk=None, Tc=None):
Expand Down
2 changes: 1 addition & 1 deletion armi/materials/lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ def heatCapacity(self, Tk=None, Tc=None):
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("heat capacity", Tk)

return 162.9 - 3.022e-2 * Tk + 8.341e-6 * Tk ** 2
return 162.9 - 3.022e-2 * Tk + 8.341e-6 * Tk**2
2 changes: 1 addition & 1 deletion armi/materials/leadBismuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def heatCapacity(self, Tk=None, Tc=None):
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("heat capacity", Tk)

return 159 - 2.72e-2 * Tk + 7.12e-6 * Tk ** 2
return 159 - 2.72e-2 * Tk + 7.12e-6 * Tk**2

def thermalConductivity(self, Tk=None, Tc=None):
r"""Thermal conductivity in W/m/K from Sobolev.
Expand Down
2 changes: 1 addition & 1 deletion armi/materials/mgO.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
Tc = getTc(Tc, Tk)
Tk = getTk(Tc=Tc)
self.checkPropertyTempRange("linear expansion percent", Tk)
return 1.0489e-5 * Tc + 6.0458e-9 * Tc ** 2 - 2.6875e-12 * Tc ** 3
return 1.0489e-5 * Tc + 6.0458e-9 * Tc**2 - 2.6875e-12 * Tc**3
4 changes: 2 additions & 2 deletions armi/materials/mox.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ def meltingPoint(self):
return (
3120.0
- 655.3 * molFracPuO2
+ 336.4 * molFracPuO2 ** 2
- 99.9 * molFracPuO2 ** 3
+ 336.4 * molFracPuO2**2
- 99.9 * molFracPuO2**3
)
2 changes: 1 addition & 1 deletion armi/materials/potassium.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def pseudoDensity(self, Tk=None, Tc=None):
Tc = getTc(Tc, Tk)
Tk = getTk(Tc=Tc)
self.checkPropertyTempRange("density", Tc)
return 0.8415 - 2.172e-4 * Tc - 2.70e-8 * Tc ** 2 + 4.77e-12 * Tc ** 3
return 0.8415 - 2.172e-4 * Tc - 2.70e-8 * Tc**2 + 4.77e-12 * Tc**3
2 changes: 1 addition & 1 deletion armi/materials/scandiumOxide.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tk)
return 2.6045e-07 * Tk ** 2 + 4.6374e-04 * Tk - 1.4696e-01
return 2.6045e-07 * Tk**2 + 4.6374e-04 * Tk - 1.4696e-01
6 changes: 3 additions & 3 deletions armi/materials/sodium.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def enthalpy(self, Tk=None, Tc=None):
enthalpy = (
-365.77
+ 1.6582 * Tk
- 4.2395e-4 * Tk ** 2
+ 1.4847e-7 * Tk ** 3
- 4.2395e-4 * Tk**2
+ 1.4847e-7 * Tk**3
+ 2992.6 / Tk
)
enthalpy = enthalpy * 1000 # convert from kJ/kg to kJ/kg
Expand All @@ -126,6 +126,6 @@ def thermalConductivity(self, Tk=None, Tc=None):
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("thermal conductivity", Tk)
thermalConductivity = (
124.67 - 0.11381 * Tk + 5.5226e-5 * Tk ** 2 - 1.1842e-8 * Tk ** 3
124.67 - 0.11381 * Tk + 5.5226e-5 * Tk**2 - 1.1842e-8 * Tk**3
)
return thermalConductivity
2 changes: 1 addition & 1 deletion armi/materials/uranium.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def thermalConductivity(self, Tk: float = None, Tc: float = None) -> float:
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("thermal conductivity", Tk)

kU = 21.73 + (0.01591 * Tk) + (0.000005907 * Tk ** 2)
kU = 21.73 + (0.01591 * Tk) + (0.000005907 * Tk**2)
return kU

def heatCapacity(self, Tk: float = None, Tc: float = None) -> float:
Expand Down
10 changes: 5 additions & 5 deletions armi/materials/uraniumOxide.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def density(self, Tk: float = None, Tc: float = None) -> float:
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("density", Tk)

return (-1.01147e-7 * Tk ** 2 - 1.29933e-4 * Tk + 1.09805e1) * self.getTD()
return (-1.01147e-7 * Tk**2 - 1.29933e-4 * Tk + 1.09805e1) * self.getTD()

def heatCapacity(self, Tk: float = None, Tc: float = None) -> float:
"""
Expand All @@ -184,7 +184,7 @@ def heatCapacity(self, Tk: float = None, Tc: float = None) -> float:
* math.exp(hcc.theta / Tk)
/ (math.exp(hcc.theta / Tk) - 1.0) ** 2
+ 2 * hcc.c2 * Tk
+ hcc.c3 * hcc.Ea * math.exp(-hcc.Ea / Tk) / Tk ** 2
+ hcc.c3 * hcc.Ea * math.exp(-hcc.Ea / Tk) / Tk**2
)
return specificHeatCapacity

Expand All @@ -197,7 +197,7 @@ def linearExpansion(self, Tk: float = None, Tc: float = None) -> float:
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("linear expansion", Tk)

return 1.06817e-12 * Tk ** 2 - 1.37322e-9 * Tk + 1.02863e-5
return 1.06817e-12 * Tk**2 - 1.37322e-9 * Tk + 1.02863e-5

def linearExpansionPercent(self, Tk: float = None, Tc: float = None) -> float:
"""
Expand All @@ -210,11 +210,11 @@ def linearExpansionPercent(self, Tk: float = None, Tc: float = None) -> float:

if Tk >= 273.0 and Tk < 923.0:
return (
-2.66e-03 + 9.802e-06 * Tk - 2.705e-10 * Tk ** 2 + 4.391e-13 * Tk ** 3
-2.66e-03 + 9.802e-06 * Tk - 2.705e-10 * Tk**2 + 4.391e-13 * Tk**3
) * 100.0
else:
return (
-3.28e-03 + 1.179e-05 * Tk - 2.429e-09 * Tk ** 2 + 1.219e-12 * Tk ** 3
-3.28e-03 + 1.179e-05 * Tk - 2.429e-09 * Tk**2 + 1.219e-12 * Tk**3
) * 100.0

def thermalConductivity(self, Tk: float = None, Tc: float = None) -> float:
Expand Down
28 changes: 14 additions & 14 deletions armi/materials/water.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def vaporPressure(self, Tk: float = None, Tc: float = None) -> float:

sum_coefficients = (
a1 * tau
+ a2 * tau ** 1.5
+ a3 * tau ** 3
+ a4 * tau ** 3.5
+ a5 * tau ** 4
+ a6 * tau ** 7.5
+ a2 * tau**1.5
+ a3 * tau**3
+ a4 * tau**3.5
+ a5 * tau**4
+ a6 * tau**7.5
)
log_vapor_pressure = T_ratio * sum_coefficients
vapor_pressure = self.VAPOR_PRESSURE_CRITICAL_PA * math.e ** (
Expand Down Expand Up @@ -198,11 +198,11 @@ def auxiliaryQuantitySpecificEnthalpy(

normalized_alpha = (
self.d["alpha"]
+ self.d[1] * theta ** -19
+ self.d[1] * theta**-19
+ self.d[2] * theta
+ self.d[3] * theta ** 4.5
+ self.d[4] * theta ** 5.0
+ self.d[5] * theta ** 54.5
+ self.d[3] * theta**4.5
+ self.d[4] * theta**5.0
+ self.d[5] * theta**54.5
)

# past the supercritical point tau's raised to .5 cause complex #'s
Expand Down Expand Up @@ -240,11 +240,11 @@ def auxiliaryQuantitySpecificEntropy(

normalized_phi = (
self.d["phi"]
+ 19.0 / 20.0 * self.d[1] * theta ** -20.0
+ 19.0 / 20.0 * self.d[1] * theta**-20.0
+ self.d[2] * math.log(theta)
+ 9.0 / 7.0 * self.d[3] * theta ** 3.5
+ 5.0 / 4.0 * self.d[4] * theta ** 4.0
+ 109.0 / 107.0 * self.d[5] * theta ** 53.5
+ 9.0 / 7.0 * self.d[3] * theta**3.5
+ 5.0 / 4.0 * self.d[4] * theta**4.0
+ 109.0 / 107.0 * self.d[5] * theta**53.5
)

# past the supercritical point tau's raised to .5 cause complex #'s
Expand Down Expand Up @@ -435,6 +435,6 @@ def pseudoDensity(self, Tk: float = None, Tc: float = None) -> float:

# past the supercritical point tau's raised to .5 cause complex #'s
return (
math.e ** log_normalized_rho.real
math.e**log_normalized_rho.real
* self.DENSITY_CRITICAL_GPERCUBICCENTIMETER
)
2 changes: 1 addition & 1 deletion armi/materials/yttriumOxide.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ def linearExpansionPercent(self, Tk=None, Tc=None):
Tk = getTk(Tc, Tk)
self.checkPropertyTempRange("linear expansion percent", Tk)

return 1.4922e-07 * Tk ** 2 + 6.2448e-04 * Tk - 1.8414e-01
return 1.4922e-07 * Tk**2 + 6.2448e-04 * Tk - 1.8414e-01
Loading