Skip to content

Commit e461eea

Browse files
twieckimichaelosthege
authored andcommitted
⬆️ UPGRADE: Autoupdate pre-commit config
1 parent a90457a commit e461eea

24 files changed

+56
-70
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ^(docs/logos|pymc3/tests/data)/
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v3.4.0
4+
rev: v4.0.1
55
hooks:
66
- id: check-merge-conflict
77
- id: check-toml
@@ -19,16 +19,16 @@ repos:
1919
- id: isort
2020
name: isort
2121
- repo: https://github.com/asottile/pyupgrade
22-
rev: v2.11.0
22+
rev: v2.19.4
2323
hooks:
2424
- id: pyupgrade
2525
args: [--py37-plus]
2626
- repo: https://github.com/psf/black
27-
rev: 20.8b1
27+
rev: 21.6b0
2828
hooks:
2929
- id: black
3030
- repo: https://github.com/PyCQA/pylint
31-
rev: pylint-2.7.4
31+
rev: v2.8.3
3232
hooks:
3333
- id: pylint
3434
args: [--rcfile=.pylintrc]

docs/source/sphinxext/gallery_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def build_gallery(srcdir, gallery):
187187
with open(table_of_contents_file) as toc:
188188
table_of_contents = toc.read()
189189

190-
js_contents = "Gallery.examples = {}\n{}".format(json.dumps(data), table_of_contents)
190+
js_contents = f"Gallery.examples = {json.dumps(data)}\n{table_of_contents}"
191191

192192
with open(js_file, "w") as js:
193193
js.write(js_contents)

pymc3/aesaraf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def grad(self, inp, grads):
543543
return grads
544544

545545
def c_code(self, node, name, inp, out, sub):
546-
return "{z} = {x};".format(x=inp[0], z=out[0])
546+
return f"{out[0]} = {inp[0]};"
547547

548548
def __eq__(self, other):
549549
return isinstance(self, type(other))

pymc3/backends/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def __getattr__(self, name):
365365
return self.get_values(name)
366366
if name in self.stat_names:
367367
return self.get_sampler_stats(name)
368-
raise AttributeError("'{}' object has no attribute '{}'".format(type(self).__name__, name))
368+
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
369369

370370
def __len__(self):
371371
chain = self.chains[-1]

pymc3/distributions/bart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def get_residuals_loo(self, tree):
164164
return R_j
165165

166166
def draw_leaf_value(self, idx_data_points):
167-
""" Draw the residual mean."""
167+
"""Draw the residual mean."""
168168
R_j = self.get_residuals()[idx_data_points]
169169
draw = self.mean(R_j)
170170
return draw

pymc3/distributions/mixture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def comp_dists(self, comp_dists):
187187
# All component distributions must broadcast with each other
188188
try:
189189
self._broadcast_shape = np.broadcast(
190-
*[np.empty(shape) for shape in self._comp_dist_shapes]
190+
*(np.empty(shape) for shape in self._comp_dist_shapes)
191191
).shape
192192
except Exception:
193193
raise TypeError(

pymc3/distributions/shape_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def broadcast_dist_samples_to(to_shape, samples, size=None):
426426

427427

428428
def convert_dims(dims: Dims) -> Optional[WeakDims]:
429-
""" Process a user-provided dims variable into None or a valid dims tuple. """
429+
"""Process a user-provided dims variable into None or a valid dims tuple."""
430430
if dims is None:
431431
return None
432432

@@ -444,7 +444,7 @@ def convert_dims(dims: Dims) -> Optional[WeakDims]:
444444

445445

446446
def convert_shape(shape: Shape) -> Optional[WeakShape]:
447-
""" Process a user-provided shape variable into None or a valid shape object. """
447+
"""Process a user-provided shape variable into None or a valid shape object."""
448448
if shape is None:
449449
return None
450450

@@ -466,7 +466,7 @@ def convert_shape(shape: Shape) -> Optional[WeakShape]:
466466

467467

468468
def convert_size(size: Size) -> Optional[StrongSize]:
469-
""" Process a user-provided size variable into None or a valid size object. """
469+
"""Process a user-provided size variable into None or a valid size object."""
470470
if size is None:
471471
return None
472472

pymc3/distributions/timeseries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ def logp(self, value):
158158
"""
159159
if self.constant:
160160
x = at.add(
161-
*[self.rho[i + 1] * value[self.p - (i + 1) : -(i + 1)] for i in range(self.p)]
161+
*(self.rho[i + 1] * value[self.p - (i + 1) : -(i + 1)] for i in range(self.p))
162162
)
163163
eps = value[self.p :] - self.rho[0] - x
164164
else:
165165
if self.p == 1:
166166
x = self.rho * value[:-1]
167167
else:
168168
x = at.add(
169-
*[self.rho[i] * value[self.p - (i + 1) : -(i + 1)] for i in range(self.p)]
169+
*(self.rho[i] * value[self.p - (i + 1) : -(i + 1)] for i in range(self.p))
170170
)
171171
eps = value[self.p :] - x
172172

pymc3/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ImputationWarning(UserWarning):
4343

4444

4545
class ShapeWarning(UserWarning):
46-
""" Something that could lead to shape problems down the line. """
46+
"""Something that could lead to shape problems down the line."""
4747

4848
pass
4949

pymc3/gp/cov.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def __array_wrap__(self, result):
158158
class Combination(Covariance):
159159
def __init__(self, factor_list):
160160
input_dim = max(
161-
[factor.input_dim for factor in factor_list if isinstance(factor, Covariance)]
161+
factor.input_dim for factor in factor_list if isinstance(factor, Covariance)
162162
)
163163
super().__init__(input_dim=input_dim)
164164
self.factor_list = []

0 commit comments

Comments
 (0)