Skip to content

Commit

Permalink
Fix EqualizeMessenger type annotations (#3401)
Browse files Browse the repository at this point in the history
* Fix EqualizeMessenger type annotations.

* Change keep_dist typing to Optional[bool].

---------

Co-authored-by: Ben Zickel <[email protected]>
  • Loading branch information
BenZickel and Ben Zickel authored Sep 24, 2024
1 parent b3c7851 commit 0d3243a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyro/poutine/equalize_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
self,
sites: Union[str, List[str]],
type: Optional[str] = "sample",
keep_dist: bool = False,
keep_dist: Optional[bool] = False,
) -> None:
super().__init__()
self.sites = [sites] if isinstance(sites, str) else sites
Expand Down
5 changes: 4 additions & 1 deletion pyro/poutine/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,16 @@ def escape( # type: ignore[empty-body]
def equalize(
sites: Union[str, List[str]],
type: Optional[str],
) -> ConditionMessenger: ...
keep_dist: Optional[bool],
) -> EqualizeMessenger: ...


@overload
def equalize(
fn: Callable[_P, _T],
sites: Union[str, List[str]],
type: Optional[str],
keep_dist: Optional[bool],
) -> Callable[_P, _T]: ...


Expand All @@ -322,6 +324,7 @@ def equalize( # type: ignore[empty-body]
fn: Callable[_P, _T],
sites: Union[str, List[str]],
type: Optional[str],
keep_dist: Optional[bool],
) -> Union[EqualizeMessenger, Callable[_P, _T]]: ...


Expand Down

0 comments on commit 0d3243a

Please sign in to comment.