Skip to content

Commit

Permalink
docs: 🏷️ improve type hints for internal TorchRandomWrapper object.
Browse files Browse the repository at this point in the history
  • Loading branch information
qthequartermasterman committed May 14, 2024
1 parent 12ec834 commit af953ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hypothesis_torch/register_random_torch_state.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Register a random.Random-compatible shim for `torch.random` with Hypothesis."""

from typing import Any, Callable

import hypothesis
import hypothesis.internal.entropy
import torch
Expand All @@ -11,6 +13,10 @@ class TorchRandomWrapper:
Hypothesis's random state manager requires a random.Random-compatible object.
"""

seed: Callable[..., Any]
getstate: Callable[[], Any]
setstate: Callable[..., Any]

def __init__(self) -> None:
"""Initialize the TorchRandomWrapper."""
self.seed = torch.random.manual_seed
Expand Down

0 comments on commit af953ce

Please sign in to comment.