Skip to content

Commit

Permalink
Try setting rv_op: Any = None
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasaarholt committed Sep 5, 2024
1 parent 2e84b30 commit 157c29a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pymc/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from abc import ABCMeta
from collections.abc import Callable, Sequence
from functools import singledispatch
from typing import TypeAlias
from typing import Any, TypeAlias

import numpy as np

Expand Down Expand Up @@ -122,6 +122,8 @@ def __new__(cls, name, bases, clsdict):
)

class_change_dist_size = clsdict.get("change_dist_size")
if class_change_dist_size is not None:
raise ValueError("HAHAHA")

Check warning on line 126 in pymc/distributions/distribution.py

View check run for this annotation

Codecov / codecov/patch

pymc/distributions/distribution.py#L126

Added line #L126 was not covered by tests
if class_change_dist_size:

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

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

def __new__(
cls,
Expand Down

0 comments on commit 157c29a

Please sign in to comment.