File tree Expand file tree Collapse file tree 4 files changed +1
-45
lines changed Expand file tree Collapse file tree 4 files changed +1
-45
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,6 @@ If you need an internal API stabilized please [file an issue](https://github.com
49
49
.. automethod:: tmuxp.cli.utils.get_config_dir
50
50
```
51
51
52
- ``` {eval-rst}
53
- .. automethod:: tmuxp.cli.utils._validate_choices
54
- ```
55
-
56
52
``` {eval-rst}
57
53
.. automethod:: tmuxp.cli.import_config.get_teamocil_dir
58
54
```
Original file line number Diff line number Diff line change @@ -430,7 +430,6 @@ def load_workspace(
430
430
)
431
431
options = ["y" , "n" , "a" ]
432
432
choice = prompt_choices (msg , choices = options )
433
- # value_proc=_validate_choices(options))
434
433
435
434
if choice == "y" :
436
435
_load_attached (builder , detached )
@@ -450,7 +449,6 @@ def load_workspace(
450
449
choice = prompt_choices (
451
450
"Error loading workspace. (k)ill, (a)ttach, (d)etach?" ,
452
451
choices = ["k" , "a" , "d" ],
453
- # value_proc=_validate_choices(["k", "a", "d"]),
454
452
default = "k" ,
455
453
)
456
454
Original file line number Diff line number Diff line change 6
6
7
7
from colorama import Fore
8
8
9
- from .. import config , log
9
+ from .. import log
10
10
from .constants import VALID_CONFIG_DIR_FILE_EXTENSIONS
11
11
12
12
logger = logging .getLogger (__name__ )
@@ -63,33 +63,6 @@ def get_config_dir() -> str:
63
63
return path
64
64
65
65
66
- def _validate_choices (options : t .List [str ]) -> t .Callable :
67
- """
68
- Callback wrapper for validating click.prompt input.
69
-
70
- Parameters
71
- ----------
72
- options : list
73
- List of allowed choices
74
-
75
- Returns
76
- -------
77
- :func:`callable`
78
- callback function for value_proc in :func:`click.prompt`.
79
-
80
- Raises
81
- ------
82
- :class:`click.BadParameter`
83
- """
84
-
85
- def func (value ):
86
- if value not in options :
87
- raise ValueError ("Possible choices are: {}." .format (", " .join (options )))
88
- return value
89
-
90
- return func
91
-
92
-
93
66
def get_abs_path (config : str ) -> str :
94
67
path = os .path
95
68
join , isabs = path .join , path .isabs
Original file line number Diff line number Diff line change 24
24
load_workspace ,
25
25
)
26
26
from tmuxp .cli .utils import (
27
- _validate_choices ,
28
27
get_abs_path ,
29
28
get_config_dir ,
30
29
is_pure_name ,
@@ -1152,16 +1151,6 @@ def test_get_teamocil_dir(monkeypatch: pytest.MonkeyPatch) -> None:
1152
1151
assert get_teamocil_dir () == os .path .expanduser ("~/.teamocil/" )
1153
1152
1154
1153
1155
- def test_validate_choices () -> None :
1156
- validate = _validate_choices (["choice1" , "choice2" ])
1157
-
1158
- assert validate ("choice1" )
1159
- assert validate ("choice2" )
1160
-
1161
- with pytest .raises (ValueError ):
1162
- assert validate ("choice3" )
1163
-
1164
-
1165
1154
def test_pass_config_dir_ClickPath (
1166
1155
tmp_path : pathlib .Path ,
1167
1156
monkeypatch : pytest .MonkeyPatch ,
You can’t perform that action at this time.
0 commit comments