Skip to content

Commit 7c3fb12

Browse files
committed
TypeError: format -> f-strings
1 parent 5cc8fdc commit 7c3fb12

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

pymc3/distributions/continuous.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,9 +1309,7 @@ def logcdf(self, value):
13091309
# incomplete_beta function can only handle scalar values (see #4342)
13101310
if np.ndim(value):
13111311
raise TypeError(
1312-
"Beta.logcdf expects a scalar value but received a {}-dimensional object.".format(
1313-
np.ndim(value)
1314-
)
1312+
f"Beta.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
13151313
)
13161314

13171315
a = self.alpha
@@ -1979,9 +1977,7 @@ def logcdf(self, value):
19791977
# incomplete_beta function can only handle scalar values (see #4342)
19801978
if np.ndim(value):
19811979
raise TypeError(
1982-
"StudentT.logcdf expects a scalar value but received a {}-dimensional object.".format(
1983-
np.ndim(value)
1984-
)
1980+
f"StudentT.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
19851981
)
19861982

19871983
nu = self.nu

pymc3/distributions/discrete.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ def logcdf(self, value):
166166
# incomplete_beta function can only handle scalar values (see #4342)
167167
if np.ndim(value):
168168
raise TypeError(
169-
"Binomial.logcdf expects a scalar value but received a {}-dimensional object.".format(
170-
np.ndim(value)
171-
)
169+
f"Binomial.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
172170
)
173171

174172
n = self.n
@@ -336,9 +334,7 @@ def logcdf(self, value):
336334
# logcdf can only handle scalar values at the moment
337335
if np.ndim(value):
338336
raise TypeError(
339-
"BetaBinomial.logcdf expects a scalar value but received a {}-dimensional object.".format(
340-
np.ndim(value)
341-
)
337+
f"BetaBinomial.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
342338
)
343339

344340
alpha = self.alpha
@@ -910,9 +906,7 @@ def logcdf(self, value):
910906
# incomplete_beta function can only handle scalar values (see #4342)
911907
if np.ndim(value):
912908
raise TypeError(
913-
"NegativeBinomial.logcdf expects a scalar value but received a {}-dimensional object.".format(
914-
np.ndim(value)
915-
)
909+
f"NegativeBinomial.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
916910
)
917911

918912
# TODO: avoid `p` recomputation if distribution was defined in terms of `p`
@@ -1166,9 +1160,7 @@ def logcdf(self, value):
11661160
# logcdf can only handle scalar values at the moment
11671161
if np.ndim(value):
11681162
raise TypeError(
1169-
"BetaBinomial.logcdf expects a scalar value but received a {}-dimensional object.".format(
1170-
np.ndim(value)
1171-
)
1163+
f"HyperGeometric.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
11721164
)
11731165

11741166
# TODO: Use lower upper in locgdf for smarter logsumexp?
@@ -1743,9 +1735,7 @@ def logcdf(self, value):
17431735
# logcdf can only handle scalar values due to limitation in Binomial.logcdf
17441736
if np.ndim(value):
17451737
raise TypeError(
1746-
"ZeroInflatedBinomial.logcdf expects a scalar value but received a {}-dimensional object.".format(
1747-
np.ndim(value)
1748-
)
1738+
f"ZeroInflatedBinomial.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
17491739
)
17501740

17511741
psi = self.psi
@@ -1913,9 +1903,7 @@ def logcdf(self, value):
19131903
# logcdf can only handle scalar values due to limitation in NegativeBinomial.logcdf
19141904
if np.ndim(value):
19151905
raise TypeError(
1916-
"ZeroInflatedNegativeBinomial.logcdf expects a scalar value but received a {}-dimensional object.".format(
1917-
np.ndim(value)
1918-
)
1906+
f"ZeroInflatedNegativeBinomial.logcdf expects a scalar value but received a {np.ndim(value)}-dimensional object."
19191907
)
19201908
psi = self.psi
19211909

0 commit comments

Comments
 (0)