Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from typer.models import OptionInfo 

2from .enums import Activation 

3 

4 

5class Param(OptionInfo): 

6 def __init__( 

7 self, 

8 default=None, 

9 tune=False, 

10 tune_min=None, 

11 tune_max=None, 

12 tune_choices=None, 

13 log=False, # deprecated. use tune_log 

14 tune_log=False, 

15 distribution=None, 

16 annotation=None, 

17 **kwargs, 

18 ): 

19 super().__init__(default=default, **kwargs) 

20 self.tune = tune 

21 self.tune_log = tune_log or log 

22 self.tune_min = tune_min if tune_min is not None else self.min 

23 self.tune_max = tune_max if tune_max is not None else self.max 

24 self.annotation = annotation 

25 self.distribution = distribution 

26 self.tune_choices = tune_choices 

27 

28 if distribution: 

29 raise NotImplementedError("Distribution for parameters not implemented yet") 

30 

31 def check_choices(self): 

32 if self.tune_choices: 

33 return 

34 

35 if self.annotation == bool: 

36 self.tune_choices = [False, True] 

37 

38 elif self.annotation == Activation: 

39 self.tune_choices = Activation.default_tune_choices()