Skip to content

Commit

Permalink
Use Mapping instead of Dict in type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Aug 11, 2023
1 parent 9a3e474 commit 9999e0f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pymc_experimental/model_transform/conditioning.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional, Sequence, Union
from typing import Any, List, Mapping, Optional, Sequence, Union

from pymc import Model
from pymc.logprob.transforms import RVTransform
Expand Down Expand Up @@ -26,7 +26,9 @@
from pymc_experimental.utils.pytensorf import rvs_in_graph


def observe(model: Model, vars_to_observations: Dict[Union["str", TensorVariable], Any]) -> Model:
def observe(
model: Model, vars_to_observations: Mapping[Union["str", TensorVariable], Any]
) -> Model:
"""Convert free RVs or Deterministics to observed RVs.
Parameters
Expand Down Expand Up @@ -122,7 +124,9 @@ def replacement_fn(var, inner_replacements):


def do(
model: Model, vars_to_interventions: Dict[Union["str", TensorVariable], Any], prune_vars=False
model: Model,
vars_to_interventions: Mapping[Union["str", TensorVariable], Any],
prune_vars=False,
) -> Model:
"""Replace model variables by intervention variables.
Expand Down Expand Up @@ -217,7 +221,7 @@ def do(

def change_value_transforms(
model: Model,
vars_to_transforms: Dict[ModelVariable, Union[RVTransform, None]],
vars_to_transforms: Mapping[ModelVariable, Union[RVTransform, None]],
) -> Model:
"""Change the value variables transforms in the model
Expand Down

0 comments on commit 9999e0f

Please sign in to comment.