Skip to content

Commit 157c29a

Browse files
committed
Try setting rv_op: Any = None
1 parent 2e84b30 commit 157c29a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pymc/distributions/distribution.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from abc import ABCMeta
2222
from collections.abc import Callable, Sequence
2323
from functools import singledispatch
24-
from typing import TypeAlias
24+
from typing import Any, TypeAlias
2525

2626
import numpy as np
2727

@@ -122,6 +122,8 @@ def __new__(cls, name, bases, clsdict):
122122
)
123123

124124
class_change_dist_size = clsdict.get("change_dist_size")
125+
if class_change_dist_size is not None:
126+
raise ValueError("HAHAHA")
125127
if class_change_dist_size:
126128

127129
@_change_dist_size.register(rv_type)
@@ -423,8 +425,12 @@ def change_symbolic_rv_size(op: SymbolicRandomVariable, rv, new_size, expand) ->
423425
class Distribution(metaclass=DistributionMeta):
424426
"""Statistical distribution"""
425427

426-
rv_op: Callable[..., TensorVariable]
427-
rv_type: MetaType
428+
# rv_op and _type are set to None via the DistributionMeta.__new__
429+
# if not specified as class attributes in subclasses of Distribution.
430+
# rv_op can either be a class (see the Normal class) or a method
431+
# (see the Censored class), both callable to return a TensorVariable.
432+
rv_op: Any = None
433+
rv_type: MetaType | None = None
428434

429435
def __new__(
430436
cls,

0 commit comments

Comments
 (0)