1212import pickle
1313import warnings
1414from pathlib import Path
15- from typing import Union
15+ from typing import Optional , Union
1616
1717import numpy as np
1818
@@ -40,9 +40,6 @@ class StepTest(SequentialTestBase):
4040 use_p_norm (bool): whether to use p_norm shape (True) or partial sums of the zeta function (False).
4141 policy (List[ArrayLike]): the evaluation decision-making algorithm. Length n_max, each element is an associated array.
4242 need_new_policy (bool): indicator that a policy has not been previously synthesized for these test parameters.
43- _state (ArrayLike): internal state for a particular test. Set to np.zeros(2) when the test is reset.
44- _t (int): internal time state for a particular test. Set to 0 when the test is reset.
45- _current_decision (Decision): internal decision state for a particular test. Set to FailToDecide when test is reset.
4643 """
4744
4845 def __init__ (
@@ -52,7 +49,7 @@ def __init__(
5249 alpha : float ,
5350 shape_parameter : float = 0.0 ,
5451 use_p_norm : bool = False ,
55- random_seed : int = None ,
52+ random_seed : Optional [ int ] = None ,
5653 verbose : bool = False ,
5754 ) -> None :
5855 """Initializes the test object.
@@ -289,9 +286,10 @@ def load_existing_policy(
289286 self .policy = pickle .load (filename )
290287 self .need_new_policy = False
291288 except :
292- warnings .warn (f"Current policy path: { policy_path } " )
293- # "Unable to find policy with the assigned test parameters. An additional policy synthesis procedure may be required."
294- # f"Current policy path: {policy_path}"
289+ warnings .warn (
290+ f"Current policy path: { policy_path } "
291+ "Unable to find policy with the assigned test parameters. An additional policy synthesis procedure may be required."
292+ )
295293
296294 self .policy_path = policy_path
297295
@@ -315,9 +313,6 @@ class MirroredStepTest(StepTest):
315313 use_p_norm (bool): whether to use p_norm shape (True) or partial sums of the zeta function (False).
316314 policy (List[ArrayLike]): the evaluation decision-making algorithm. Length n_max, each element is an associated array.
317315 need_new_policy (bool): indicator that a policy has not been previously synthesized for these test parameters.
318- _state (ArrayLike): internal state for a particular test. Set to np.zeros(2) when the test is reset.
319- _t (int): internal time state for a particular test. Set to 0 when the test is reset.
320- _current_decision (Decision): internal decision state for a particular test. Set to FailToDecide when test is reset.
321316 """
322317
323318 def __init__ (
@@ -534,12 +529,3 @@ def step(
534529 result = TestResult (self ._current_decision , info )
535530
536531 return result
537-
538-
539- # if __name__ == "__main__":
540- # step = StepTest(Hypothesis.P0LessThanP1, 200, 0.05)
541- # print(step.policy_path)
542- # print()
543- # step = StepTest(Hypothesis.P0LessThanP1, 500, 0.05)
544- # print(step.policy_path)
545- # print()
0 commit comments