1- from collections .abc import Collection
2- from typing import ParamSpec , TypeVar
1+ from collections .abc import Callable , Collection
32
43import click
54from rra_tools .cli_tools import (
65 RUN_ALL ,
7- ClickOption ,
86 convert_choice ,
97 with_choice ,
108 with_debugger ,
1816 with_verbose ,
1917)
2018
21- _T = TypeVar ("_T" )
22- _P = ParamSpec ("_P" )
2319
24-
25- def with_crs (
20+ def with_crs [** P , T ](
2621 choices : Collection [str ],
2722 * ,
2823 allow_all : bool = False ,
29- ) -> ClickOption [ _P , _T ]:
24+ ) -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
3025 return with_choice (
3126 "crs" ,
3227 allow_all = allow_all ,
@@ -37,11 +32,11 @@ def with_crs(
3732 )
3833
3934
40- def with_measure (
35+ def with_measure [ ** P , T ] (
4136 choices : Collection [str ],
4237 * ,
4338 allow_all : bool = False ,
44- ) -> ClickOption [ _P , _T ]:
39+ ) -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
4540 return with_choice (
4641 "measure" ,
4742 "m" ,
@@ -52,11 +47,11 @@ def with_measure(
5247 )
5348
5449
55- def with_time_point (
50+ def with_time_point [ ** P , T ] (
5651 choices : Collection [str ] | None = None ,
5752 * ,
5853 allow_all : bool = False ,
59- ) -> ClickOption [ _P , _T ]:
54+ ) -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
6055 return with_choice (
6156 "time_point" ,
6257 "t" ,
@@ -67,11 +62,11 @@ def with_time_point(
6762 )
6863
6964
70- def with_version (
65+ def with_version [ ** P , T ] (
7166 choices : Collection [str ],
7267 * ,
7368 allow_all : bool = False ,
74- ) -> ClickOption [ _P , _T ]:
69+ ) -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
7570 return with_choice (
7671 "version" ,
7772 allow_all = allow_all ,
@@ -81,7 +76,7 @@ def with_version(
8176 )
8277
8378
84- def with_tile_size () -> ClickOption [ _P , _T ]:
79+ def with_tile_size [ ** P , T ] () -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
8580 return click .option (
8681 "--tile-size" ,
8782 type = int ,
@@ -91,7 +86,7 @@ def with_tile_size() -> ClickOption[_P, _T]:
9186 )
9287
9388
94- def with_block_size () -> ClickOption [ _P , _T ]:
89+ def with_block_size [ ** P , T ] () -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
9590 return click .option (
9691 "--block-size" ,
9792 type = int ,
@@ -101,7 +96,7 @@ def with_block_size() -> ClickOption[_P, _T]:
10196 )
10297
10398
104- def with_block_key () -> ClickOption [ _P , _T ]:
99+ def with_block_key [ ** P , T ] () -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
105100 return click .option (
106101 "--block-key" ,
107102 "-b" ,
@@ -111,11 +106,11 @@ def with_block_key() -> ClickOption[_P, _T]:
111106 )
112107
113108
114- def with_resolution (
109+ def with_resolution [ ** P , T ] (
115110 choices : Collection [str ],
116111 * ,
117112 allow_all : bool = False ,
118- ) -> ClickOption [ _P , _T ]:
113+ ) -> Callable [[ Callable [ P , T ]], Callable [ P , T ] ]:
119114 return with_choice (
120115 "resolution" ,
121116 allow_all = allow_all ,
@@ -126,7 +121,6 @@ def with_resolution(
126121
127122__all__ = [
128123 "RUN_ALL" ,
129- "ClickOption" ,
130124 "convert_choice" ,
131125 "with_block_key" ,
132126 "with_block_size" ,
0 commit comments