Skip to content

Commit af04458

Browse files
authored
Propapagate type aliases through sphinx (#453)
* type annotations fix in dynamical systems * add type aliases for interventional * add type aliases for observational * add counterfactual doc type aliases * lint
1 parent bf0674c commit af04458

File tree

12 files changed

+40
-2
lines changed

12 files changed

+40
-2
lines changed

chirho/counterfactual/handlers/counterfactual.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from typing import Any, Dict, Generic, Mapping, TypeVar
24

35
import pyro

chirho/counterfactual/handlers/explanation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import collections.abc
24
import contextlib
35
import functools

chirho/counterfactual/ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import functools
24
from typing import Optional, Tuple, TypeVar
35

chirho/dynamical/handlers/interruption.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import numbers
24
import typing
35
from typing import Callable, Generic, Tuple, TypeVar, Union

chirho/dynamical/ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import numbers
24
from typing import Callable, Mapping, Optional, Tuple, TypeVar, Union
35

chirho/interventional/handlers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import collections
24
import functools
35
from typing import Callable, Dict, Generic, Hashable, Mapping, Optional, TypeVar
@@ -41,7 +43,7 @@ def _intervene_atom(
4143
def _intervene_atom_distribution(
4244
obs: pyro.distributions.Distribution,
4345
act: Optional[AtomicIntervention[pyro.distributions.Distribution]] = None,
44-
**kwargs
46+
**kwargs,
4547
) -> pyro.distributions.Distribution:
4648
"""
4749
Intervene on a distribution in a probabilistic program.
@@ -70,7 +72,7 @@ def _dict_intervene(
7072
def _intervene_callable(
7173
obs: collections.abc.Callable,
7274
act: Optional[CompoundIntervention[T]] = None,
73-
**call_kwargs
75+
**call_kwargs,
7476
) -> Callable[..., T]:
7577
if act is None:
7678
return obs

chirho/interventional/ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import functools
24
from typing import Callable, Hashable, Mapping, Optional, Tuple, TypeVar, Union
35

chirho/observational/handlers/condition.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from typing import Callable, Generic, Hashable, Mapping, TypeVar, Union
24

35
import pyro

chirho/observational/handlers/soft_conditioning.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import functools
24
import operator
35
from typing import Callable, Literal, Optional, Protocol, TypedDict, TypeVar, Union

chirho/observational/internals.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from typing import Mapping, Optional, TypeVar
24

35
import pyro

0 commit comments

Comments
 (0)