Skip to content

Commit f96594b

Browse files
Run pydocstyle in pre-commit (#6382)
* Run `pydocstyle` in pre-commit * Remove pydocstyle settings from `setup.cfg` Includes docstring formatting to reduce the number of error codes that had to be silenced for pydocstyle to be happy. Closes #6378
1 parent adf6fff commit f96594b

30 files changed

+63
-64
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ repos:
3535
args: [--rcfile=.pylintrc]
3636
files: ^pymc/
3737
exclude: (?x)(pymc/_version.py)
38+
- repo: https://github.com/PyCQA/pydocstyle
39+
rev: 6.1.1
40+
hooks:
41+
- id: pydocstyle
42+
args:
43+
- --ignore=D100,D101,D102,D103,D104,D105,D107,D200,D202,D203,D204,D205,D209,D212,D213,D301,D400,D401,D403,D413,D415,D417
44+
files: ^pymc/
45+
exclude: ^pymc/tests/
3846
- repo: https://github.com/MarcoGorelli/madforhooks
3947
rev: 0.3.0
4048
hooks:

pymc/blocking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def rmap(
7979
"""Map 1D concatenated array to a dictionary of variables in their original spaces.
8080
8181
Parameters
82-
==========
82+
----------
8383
array
8484
The array to map.
8585
start_point

pymc/distributions/continuous.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,6 @@ class LogNormal(PositiveContinuous):
15931593
15941594
Examples
15951595
--------
1596-
15971596
.. code-block:: python
15981597
15991598
# Example to show that we pass in only ``sigma`` or ``tau`` but not both.

pymc/distributions/discrete.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,6 @@ class OrderedLogistic:
15491549
15501550
Examples
15511551
--------
1552-
15531552
.. code-block:: python
15541553
15551554
# Generate data for a simple 1 dimensional example problem

pymc/distributions/dist_math.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,19 @@ def grad(self, inp, grads):
355355
def random_choice(p, size):
356356
"""Return draws from categorical probability functions
357357
358-
Args:
359-
p: array
360-
Probability of each class. If p.ndim > 1, the last axis is
361-
interpreted as the probability of each class, and numpy.random.choice
362-
is iterated for every other axis element.
363-
size: int or tuple
364-
Shape of the desired output array. If p is multidimensional, size
365-
should broadcast with p.shape[:-1].
366-
367-
Returns:
368-
random sample: array
358+
Parameters
359+
----------
360+
p : array
361+
Probability of each class. If p.ndim > 1, the last axis is
362+
interpreted as the probability of each class, and numpy.random.choice
363+
is iterated for every other axis element.
364+
size : int or tuple
365+
Shape of the desired output array. If p is multidimensional, size
366+
should broadcast with p.shape[:-1].
367+
368+
Returns
369+
-------
370+
random_sample : array
369371
370372
"""
371373
k = p.shape[-1]

pymc/distributions/distribution.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def _get_measurable_outputs_symbolic_random_variable(op, node):
413413
@node_rewriter([SymbolicRandomVariable])
414414
def inline_symbolic_random_variable(fgraph, node):
415415
"""
416-
This optimization expands the internal graph of a SymbolicRV when obtaining the logp
416+
Optimization that expands the internal graph of a SymbolicRV when obtaining the logp
417417
graph, if the flag `inline_logprob` is True.
418418
"""
419419
op = node.op
@@ -828,7 +828,6 @@ class CustomDist:
828828
829829
Examples
830830
--------
831-
832831
Create a CustomDist that wraps a black-box logp function. This variable cannot be
833832
used in prior or posterior predictive sampling because no random function was provided
834833

pymc/distributions/multivariate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ class OrderedMultinomial:
796796
797797
Examples
798798
--------
799-
800799
.. code-block:: python
801800
802801
# Generate data for a simple 1 dimensional example problem

pymc/distributions/transforms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ class Interval(IntervalTransform):
240240
241241
Examples
242242
--------
243-
244243
Create an interval transform between -1 and +1
245244
246245
.. code-block:: python

pymc/distributions/truncated.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030

3131

3232
class TruncatedRV(SymbolicRandomVariable):
33-
"""An `Op` constructed from an PyTensor graph that represents a truncated univariate
34-
random variable."""
33+
"""
34+
An `Op` constructed from an PyTensor graph
35+
that represents a truncated univariate random variable.
36+
"""
3537

3638
default_output = 1
3739
base_rv_op = None

pymc/gp/util.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def plot_gp_dist(
188188
):
189189
"""A helper function for plotting 1D GP posteriors from trace
190190
191-
Parameters
191+
Parameters
192192
----------
193193
ax: axes
194194
Matplotlib axes.
@@ -213,7 +213,6 @@ def plot_gp_dist(
213213
214214
Returns
215215
-------
216-
217216
ax: Matplotlib axes
218217
"""
219218
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)