Skip to content

Commit 8f97062

Browse files
committed
docs: fix @copula docstring rendering (fenced Examples block)
The decorator docstring used a 'Usage:' section (not a Google section) with an unfenced indented code block, so mkdocstrings parsed it as Markdown and the Python comment '# Can instantiate...' rendered as a stray heading. Switch to a recognized 'Examples:' section with a fenced ```python block; the code now renders as code and the bogus heading is gone.
1 parent 5ec815c commit 8f97062

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎acopula/core.py‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,26 @@ def __call__(self, children: Iterable[Union["Node", "Leaf", jax.Array]]) -> "Nod
151151

152152

153153
def copula(cls):
154-
"""Decorator to create a copula class with dataclass-like syntax.
154+
"""Class decorator for defining a copula family with dataclass-style
155+
parameters.
155156
156-
Usage:
157+
Generates an ``__init__`` from the type-annotated class attributes,
158+
makes the class inherit from `Copula`, and registers the parameters —
159+
while preserving every user-defined method. Instances accept positional
160+
or keyword arguments.
161+
162+
Examples:
163+
```python
157164
@copula
158165
class Clayton:
159166
theta: float
160167
161-
def generator(self, u: jax.Array) -> jax.Array:
168+
def generator(self, u):
162169
return (1.0 + u) ** (-1.0 / self.theta)
163170
164-
# Can instantiate with positional or keyword arguments
165-
c1 = Clayton(2.0)
166-
c2 = Clayton(theta=2.0)
167-
168-
This automatically:
169-
- Makes the class inherit from Copula
170-
- Generates an __init__ method from type annotations
171-
- Preserves all user-defined methods
172-
- Handles parameter registration
171+
c1 = Clayton(2.0) # positional
172+
c2 = Clayton(theta=2.0) # keyword
173+
```
173174
"""
174175
# Get type annotations in definition order
175176
annotations = getattr(cls, "__annotations__", {})

0 commit comments

Comments
 (0)