@@ -15,7 +15,7 @@ class attributes and more subclassing than
15
15
import getopt
16
16
import re
17
17
import textwrap
18
- from typing import Union , Optional , List , Tuple , Dict
18
+ from typing import Union , Optional , Tuple , Any , List , Dict
19
19
20
20
21
21
class OptionError (Exception ):
@@ -85,7 +85,7 @@ def validate(self, value) -> bool:
85
85
return True
86
86
return False
87
87
88
- def validate_form_value (self , value : any ) -> bool :
88
+ def validate_form_value (self , value : Any ) -> bool :
89
89
"""
90
90
validation of option value received through a
91
91
web form. May need to be different from CLI,
@@ -96,7 +96,7 @@ def validate_form_value(self, value: any) -> bool:
96
96
"""
97
97
return self .validate (value )
98
98
99
- def _validate (self , value : any ) -> Tuple [bool , any ]:
99
+ def _validate (self , value : Any ) -> Tuple [bool , Any ]:
100
100
"""
101
101
no-op default
102
102
@@ -145,7 +145,7 @@ def format_help(self, indent: int = 30, linewidth: int = 80) -> list:
145
145
146
146
return h_wrap
147
147
148
- def format_tag_value (self , value : any ) -> str :
148
+ def format_tag_value (self , value : Any ) -> str :
149
149
"""
150
150
format the default value for insertion into form tag
151
151
@@ -156,7 +156,7 @@ def format_tag_value(self, value: any) -> str:
156
156
return ""
157
157
return str (value )
158
158
159
- def format_tag (self , value : any = None ) -> Tuple [str , str , str , str ]:
159
+ def format_tag (self , value : Any = None ) -> Tuple [str , str , str , str ]:
160
160
"""
161
161
render a html form tag
162
162
@@ -184,7 +184,7 @@ def _default(self) -> bool:
184
184
"""
185
185
return False
186
186
187
- def validate (self , value : any = None ) -> bool :
187
+ def validate (self , value : Any = None ) -> bool :
188
188
"""
189
189
value should be empty; we accept and discard it.
190
190
we simply switch the default value.
@@ -195,7 +195,7 @@ def validate(self, value: any = None) -> bool:
195
195
self .value = not self .default
196
196
return True
197
197
198
- def validate_form_value (self , value : any ) -> bool :
198
+ def validate_form_value (self , value : Any ) -> bool :
199
199
"""
200
200
if a value arrives through a web form, the box has been
201
201
ticked, so we set to True regardless of default. The passed
@@ -258,7 +258,7 @@ def _validate(self, value: str) -> Tuple[bool, str]:
258
258
"""
259
259
return True , value .lower ()
260
260
261
- def format_tag (self , value : any = None ) -> Tuple [str , str , str , str ]:
261
+ def format_tag (self , value : Any = None ) -> Tuple [str , str , str , str ]:
262
262
"""
263
263
:param value: value
264
264
:return: (key, tag, form text, help text)
@@ -294,7 +294,7 @@ class TypeOption(Option):
294
294
r"""<input type="text" name="%(key)s" value="%(value)s" size="8"/>"""
295
295
)
296
296
297
- def _validate (self , value : any ) -> Tuple [bool , any ]:
297
+ def _validate (self , value : Any ) -> Tuple [bool , Any ]:
298
298
"""
299
299
:param value: any value
300
300
:return: (bool, value)
0 commit comments