Skip to content

Commit 60a375b

Browse files
committed
remove pylint and isort mentions
1 parent 10b5bb1 commit 60a375b

19 files changed

+20
-47
lines changed

docs/source/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
""" Sphinx configuration file.
22
3-
isort:skip_file
43
"""
54
#!/usr/bin/env python3
65
#
@@ -19,7 +18,7 @@
1918
import os
2019
from pathlib import Path
2120

22-
import pymc # isort:skip
21+
import pymc
2322

2423
# -- General configuration ------------------------------------------------
2524

pymc/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# pylint: disable=wildcard-import
1615

1716
import logging
1817

pymc/backends/arviz.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import logging
1616
import warnings
1717

18-
from typing import ( # pylint: disable=unused-import
18+
from typing import (
1919
TYPE_CHECKING,
2020
Any,
2121
Dict,
@@ -41,14 +41,14 @@
4141
from pymc.util import get_default_varnames
4242

4343
if TYPE_CHECKING:
44-
from pymc.backends.base import MultiTrace # pylint: disable=invalid-name
44+
from pymc.backends.base import MultiTrace
4545

4646
___all__ = [""]
4747

4848
_log = logging.getLogger(__name__)
4949

5050
# random variable object ...
51-
Var = Any # pylint: disable=invalid-name
51+
Var = Any
5252

5353

5454
def find_observations(model: "Model") -> Dict[str, Var]:
@@ -163,7 +163,7 @@ def insert(self, k: str, v, idx: int):
163163
self.trace_dict[k][idx, :] = v
164164

165165

166-
class InferenceDataConverter: # pylint: disable=too-many-instance-attributes
166+
class InferenceDataConverter:
167167
"""Encapsulate InferenceData specific logic."""
168168

169169
model: Optional[Model] = None

pymc/backends/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ def _set_sampler_vars(self, sampler_vars):
197197

198198
self.sampler_vars = sampler_vars
199199

200-
# pylint: disable=unused-argument
201200
def setup(self, draws, chain, sampler_vars=None) -> None:
202201
"""Perform chain-specific setup.
203202

pymc/gp/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from pymc.model import modelcontext
2828
from pymc.pytensorf import compile_pymc
2929

30-
_ = Distribution # keep both pylint and black happy
30+
_ = Distribution
3131

3232
JITTER_DEFAULT = 1e-6
3333

pymc/logprob/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
transformed_conditional_logp,
4343
)
4444

45-
# isort: off
4645
# Add rewrites to the DBs
4746
import pymc.logprob.binary
4847
import pymc.logprob.censoring
@@ -54,7 +53,6 @@
5453
import pymc.logprob.tensor
5554
import pymc.logprob.transforms
5655

57-
# isort: on
5856

5957
__all__ = (
6058
"logp",

pymc/logprob/rewriting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def apply(self, fgraph):
145145
continue
146146
if not any(out in rv_map_feature.needs_measuring for out in node.outputs):
147147
continue
148-
for node_rewriter in self.node_tracker.get_trackers(node.op): # noqa: F402
148+
for node_rewriter in self.node_tracker.get_trackers(node.op): # noqa F402
149149
node_rewriter_change = self.process_node(fgraph, node, node_rewriter)
150150
if not node_rewriter_change:
151151
continue

pymc/math.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
import pytensor
2222
import pytensor.sparse
2323
import pytensor.tensor as pt
24-
import pytensor.tensor.slinalg # pylint: disable=unused-import
24+
import pytensor.tensor.slinalg
2525
import scipy as sp
26-
import scipy.sparse # pylint: disable=unused-import
26+
import scipy.sparse
2727

2828
from pytensor.graph.basic import Apply
2929
from pytensor.graph.op import Op
3030

31-
# pylint: disable=unused-import
3231
from pytensor.tensor import (
3332
abs,
3433
and_,
@@ -99,7 +98,6 @@
9998

10099
from pymc.pytensorf import floatX, ix_, largest_common_dtype
101100

102-
# pylint: enable=unused-import
103101

104102
__all__ = [
105103
"abs",

pymc/model/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ContextMeta(type):
109109
the `with` statement.
110110
"""
111111

112-
def __new__(cls, name, bases, dct, **kwargs): # pylint: disable=unused-argument
112+
def __new__(cls, name, bases, dct, **kwargs):
113113
"""Add __enter__ and __exit__ methods to the class."""
114114

115115
def __enter__(self):
@@ -121,7 +121,7 @@ def __enter__(self):
121121
self._config_context.__enter__()
122122
return self
123123

124-
def __exit__(self, typ, value, traceback): # pylint: disable=unused-argument
124+
def __exit__(self, typ, value, traceback):
125125
self.__class__.context_class.get_contexts().pop()
126126
# self._pytensor_config is set in Model.__new__
127127
if self._config_context:
@@ -138,7 +138,7 @@ def __exit__(self, typ, value, traceback): # pylint: disable=unused-argument
138138

139139
# FIXME: is there a more elegant way to automatically add methods to the class that
140140
# are instance methods instead of class methods?
141-
def __init__(cls, name, bases, nmspc, context_class: Optional[Type] = None, **kwargs): # pylint: disable=unused-argument
141+
def __init__(cls, name, bases, nmspc, context_class: Optional[Type] = None, **kwargs):
142142
"""Add ``__enter__`` and ``__exit__`` methods to the new class automatically."""
143143
if context_class is not None:
144144
cls._context_class = context_class

pymc/sampling_jax.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# This file exists only for backward-compatibility with imports like
1515
# `import pymc.sampling_jax` or `from pymc import sampling_jax`.
1616

17-
# pylint: disable=wildcard-import
18-
# pylint: disable=unused-wildcard-import
1917
import warnings
2018

2119
warnings.warn("This module is deprecated, use pymc.sampling.jax", DeprecationWarning)

pymc/stats/log_likelihood.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def compute_log_likelihood(
6969
raise ValueError(f"var_names must refer to observed_RVs in the model. Got: {var_names}")
7070

7171
# We need to temporarily disable transforms, because the InferenceData only keeps the untransformed values
72-
# pylint: disable=used-before-assignment
7372
try:
7473
original_rvs_to_values = model.rvs_to_values
7574
original_rvs_to_transforms = model.rvs_to_transforms
@@ -89,7 +88,6 @@ def compute_log_likelihood(
8988
finally:
9089
model.rvs_to_values = original_rvs_to_values
9190
model.rvs_to_transforms = original_rvs_to_transforms
92-
# pylint: enable=used-before-assignment
9391

9492
# Ignore Deterministics
9593
posterior_values = posterior[[rv.name for rv in model.free_RVs]]

tests/backends/test_arviz.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# pylint: disable=no-member, invalid-name, redefined-outer-name, protected-access, too-many-public-methods
1514
import warnings
1615

1716
from typing import Dict, Tuple
@@ -359,9 +358,7 @@ def test_mv_missing_data_model(self):
359358
with model:
360359
mu = pm.Normal("mu", 0, 1, size=2)
361360
sd_dist = pm.HalfNormal.dist(1.0, size=2)
362-
# pylint: disable=unpacking-non-sequence
363361
chol, *_ = pm.LKJCholeskyCov("chol_cov", n=2, eta=1, sd_dist=sd_dist)
364-
# pylint: enable=unpacking-non-sequence
365362
with pytest.warns(ImputationWarning):
366363
y = pm.MvNormal("y", mu=mu, chol=chol, observed=data)
367364
inference_data = pm.sample(
@@ -443,7 +440,7 @@ def test_constant_data(self, use_context):
443440
y = pm.MutableData("y", [1.0, 2.0, 3.0])
444441
beta_sigma = pm.MutableData("beta_sigma", 1)
445442
beta = pm.Normal("beta", 0, beta_sigma)
446-
obs = pm.Normal("obs", x * beta, 1, observed=y) # pylint: disable=unused-variable
443+
obs = pm.Normal("obs", x * beta, 1, observed=y)
447444
trace = pm.sample(100, chains=2, tune=100, return_inferencedata=False)
448445
if use_context:
449446
inference_data = to_inference_data(trace=trace, log_likelihood=True)
@@ -466,7 +463,7 @@ def test_predictions_constant_data(self):
466463
x = pm.ConstantData("x", [1.0, 2.0, 3.0])
467464
y = pm.MutableData("y", [1.0, 2.0, 3.0])
468465
beta = pm.Normal("beta", 0, 1)
469-
obs = pm.Normal("obs", x * beta, 1, observed=y) # pylint: disable=unused-variable
466+
obs = pm.Normal("obs", x * beta, 1, observed=y)
470467
trace = pm.sample(100, tune=100, return_inferencedata=False)
471468
inference_data = to_inference_data(trace)
472469

@@ -478,7 +475,7 @@ def test_predictions_constant_data(self):
478475
x = pm.MutableData("x", [1.0, 2.0])
479476
y = pm.ConstantData("y", [1.0, 2.0])
480477
beta = pm.Normal("beta", 0, 1)
481-
obs = pm.Normal("obs", x * beta, 1, observed=y) # pylint: disable=unused-variable
478+
obs = pm.Normal("obs", x * beta, 1, observed=y)
482479
predictive_trace = pm.sample_posterior_predictive(
483480
inference_data, return_inferencedata=False
484481
)
@@ -506,7 +503,7 @@ def test_no_trace(self):
506503
x = pm.ConstantData("x", [1.0, 2.0, 3.0])
507504
y = pm.MutableData("y", [1.0, 2.0, 3.0])
508505
beta = pm.Normal("beta", 0, 1)
509-
obs = pm.Normal("obs", x * beta, 1, observed=y) # pylint: disable=unused-variable
506+
obs = pm.Normal("obs", x * beta, 1, observed=y)
510507
idata = pm.sample(100, tune=100)
511508
prior = pm.sample_prior_predictive(return_inferencedata=False)
512509
posterior_predictive = pm.sample_posterior_predictive(idata, return_inferencedata=False)
@@ -540,7 +537,7 @@ def test_priors_separation(self, use_context):
540537
x = pm.MutableData("x", [1.0, 2.0, 3.0])
541538
y = pm.ConstantData("y", [1.0, 2.0, 3.0])
542539
beta = pm.Normal("beta", 0, 1)
543-
obs = pm.Normal("obs", x * beta, 1, observed=y) # pylint: disable=unused-variable
540+
obs = pm.Normal("obs", x * beta, 1, observed=y)
544541
prior = pm.sample_prior_predictive(return_inferencedata=False)
545542

546543
test_dict = {

tests/distributions/test_continuous.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,6 @@ def test_moyal_icdf(self):
888888
def test_interpolated(self):
889889
for mu in R.vals:
890890
for sigma in Rplus.vals:
891-
# pylint: disable=cell-var-from-loop
892891
xmin = mu - 5 * sigma
893892
xmax = mu + 5 * sigma
894893

@@ -2371,7 +2370,6 @@ def interpolated_rng_fn(self, size, mu, sigma, rng):
23712370
def check_draws(self):
23722371
for mu in R.vals:
23732372
for sigma in Rplus.vals:
2374-
# pylint: disable=cell-var-from-loop
23752373
rng = self.get_random_state()
23762374

23772375
def ref_rand(size):

tests/distributions/test_multivariate.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,11 +1443,9 @@ def test_with_chol_rv(self):
14431443
with pm.Model() as model:
14441444
mu = pm.Normal("mu", 0.0, 1.0, size=3)
14451445
sd_dist = pm.Exponential.dist(1.0, size=3)
1446-
# pylint: disable=unpacking-non-sequence
14471446
chol, _, _ = pm.LKJCholeskyCov(
14481447
"chol_cov", n=3, eta=2, sd_dist=sd_dist, compute_corr=True
14491448
)
1450-
# pylint: enable=unpacking-non-sequence
14511449
mv = pm.MvNormal("mv", mu, chol=chol, size=4)
14521450
prior = pm.sample_prior_predictive(samples=10, return_inferencedata=False)
14531451

@@ -1459,11 +1457,9 @@ def test_with_cov_rv(
14591457
with pm.Model() as model:
14601458
mu = pm.Normal("mu", 0.0, 1.0, shape=3)
14611459
sd_dist = pm.Exponential.dist(1.0, shape=3)
1462-
# pylint: disable=unpacking-non-sequence
14631460
chol, corr, stds = pm.LKJCholeskyCov(
14641461
"chol_cov", n=3, eta=2, sd_dist=sd_dist, compute_corr=True
14651462
)
1466-
# pylint: enable=unpacking-non-sequence
14671463
mv = pm.MvNormal("mv", mu, cov=pm.math.dot(chol, chol.T), size=4)
14681464
prior = pm.sample_prior_predictive(samples=10, return_inferencedata=False)
14691465

tests/distributions/test_timeseries.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,9 @@ def test_mvgaussian_with_chol_cov_rv(self, param):
429429
with pm.Model() as model:
430430
mu = Normal("mu", 0.0, 1.0, shape=3)
431431
sd_dist = Exponential.dist(1.0, shape=3)
432-
# pylint: disable=unpacking-non-sequence
433432
chol, corr, stds = LKJCholeskyCov(
434433
"chol_cov", n=3, eta=2, sd_dist=sd_dist, compute_corr=True
435434
)
436-
# pylint: enable=unpacking-non-sequence
437435
with pytest.warns(UserWarning, match="Initial distribution not specified"):
438436
if param == "chol":
439437
mv = MvGaussianRandomWalk("mv", mu, chol=chol, shape=(10, 7, 3))

tests/logprob/test_transform_value.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def test_default_value_transform_logprob(pt_dist, dist_params, sp_dist, size):
257257
if a_val.ndim > 0:
258258

259259
def jacobian_estimate_novec(value):
260-
dim_diff = a_val.ndim - value.ndim # pylint: disable=cell-var-from-loop
260+
dim_diff = a_val.ndim - value.ndim
261261
if dim_diff > 0:
262262
# Make sure the dimensions match the expected input
263263
# dimensions for the compiled backward transform function

tests/model/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def test_multiple_observed_rv():
416416
y2_data = np.random.randn(100)
417417
with pm.Model() as model:
418418
mu = pm.Normal("mu")
419-
x = pm.CustomDist( # pylint: disable=unused-variable
419+
x = pm.CustomDist(
420420
"x", mu, logp=lambda value, mu: pm.Normal.logp(value, mu, 1.0), observed=0.1
421421
)
422422
assert not model["x"] == model["mu"]

tests/sampling/test_forward.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def test_lkj_cholesky_cov(self):
294294
with pm.Model() as model:
295295
mu = np.zeros(3)
296296
sd_dist = pm.Exponential.dist(1.0, size=3)
297-
chol, corr, stds = pm.LKJCholeskyCov( # pylint: disable=unpacking-non-sequence
297+
chol, corr, stds = pm.LKJCholeskyCov(
298298
"chol_packed", n=3, eta=2, sd_dist=sd_dist, compute_corr=True
299299
)
300300
chol_packed = model["chol_packed"]

versioneer.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,6 @@
273273
[travis-url]: https://travis-ci.com/github/python-versioneer/python-versioneer
274274
275275
"""
276-
# pylint:disable=invalid-name,import-outside-toplevel,missing-function-docstring
277-
# pylint:disable=missing-class-docstring,too-many-branches,too-many-statements
278-
# pylint:disable=raise-missing-from,too-many-lines,too-many-locals,import-error
279-
# pylint:disable=too-few-public-methods,redefined-outer-name,consider-using-with
280-
# pylint:disable=attribute-defined-outside-init,too-many-arguments
281276

282277
import configparser
283278
import errno

0 commit comments

Comments
 (0)