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
4949.. automethod:: tmuxp.cli.utils.get_config_dir
5050```
5151
52- ``` {eval-rst}
53- .. automethod:: tmuxp.cli.utils._validate_choices
54- ```
55-
5652``` {eval-rst}
5753.. automethod:: tmuxp.cli.import_config.get_teamocil_dir
5854```
Original file line number Diff line number Diff line change @@ -430,7 +430,6 @@ def load_workspace(
430430 )
431431 options = ["y" , "n" , "a" ]
432432 choice = prompt_choices (msg , choices = options )
433- # value_proc=_validate_choices(options))
434433
435434 if choice == "y" :
436435 _load_attached (builder , detached )
@@ -450,7 +449,6 @@ def load_workspace(
450449 choice = prompt_choices (
451450 "Error loading workspace. (k)ill, (a)ttach, (d)etach?" ,
452451 choices = ["k" , "a" , "d" ],
453- # value_proc=_validate_choices(["k", "a", "d"]),
454452 default = "k" ,
455453 )
456454
Original file line number Diff line number Diff line change 66
77from colorama import Fore
88
9- from .. import config , log
9+ from .. import log
1010from .constants import VALID_CONFIG_DIR_FILE_EXTENSIONS
1111
1212logger = logging .getLogger (__name__ )
@@ -63,33 +63,6 @@ def get_config_dir() -> str:
6363 return path
6464
6565
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-
9366def get_abs_path (config : str ) -> str :
9467 path = os .path
9568 join , isabs = path .join , path .isabs
Original file line number Diff line number Diff line change 2424 load_workspace ,
2525)
2626from tmuxp .cli .utils import (
27- _validate_choices ,
2827 get_abs_path ,
2928 get_config_dir ,
3029 is_pure_name ,
@@ -1152,16 +1151,6 @@ def test_get_teamocil_dir(monkeypatch: pytest.MonkeyPatch) -> None:
11521151 assert get_teamocil_dir () == os .path .expanduser ("~/.teamocil/" )
11531152
11541153
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-
11651154def test_pass_config_dir_ClickPath (
11661155 tmp_path : pathlib .Path ,
11671156 monkeypatch : pytest .MonkeyPatch ,
You can’t perform that action at this time.
0 commit comments