11from operator import contains
2- from typing import Callable , Container , Iterable , Optional , Sized
2+ from typing import Callable , Container , Iterable , Sized
33
44from ._core import ErrorMsg , Number , T , ValidationError , Validator
55from .numeric_arg_validators import (
@@ -85,7 +85,7 @@ def __call__(self, arg_value: T, arg_name: str):
8585
8686class MustBeEmpty (Validator ):
8787
88- def __init__ (self , * , err_msg : Optional [ str ] = None ):
88+ def __init__ (self , * , err_msg : str = "" ):
8989 """
9090 :param err_msg: Error message.
9191 """
@@ -102,7 +102,7 @@ def __call__(self, arg_value: Sized, arg_name: str, /):
102102
103103class MustBeNonEmpty (Validator ):
104104
105- def __init__ (self , * , err_msg : Optional [ str ] = None ):
105+ def __init__ (self , * , err_msg : str = "" ):
106106 """
107107 :param err_msg: Error message.
108108 """
@@ -122,7 +122,7 @@ class MustHaveLengthEqual(Validator):
122122 value.
123123 """
124124
125- def __init__ (self , value : int , * , err_msg : Optional [ str ] = None ):
125+ def __init__ (self , value : int , * , err_msg : str = "" ):
126126 """
127127 :param value: The length of the iterable.
128128 :param err_msg: Error message.
@@ -143,7 +143,7 @@ class MustHaveLengthGreaterThan(Validator):
143143 value.
144144 """
145145
146- def __init__ (self , value : int , * , err_msg : Optional [ str ] = None ):
146+ def __init__ (self , value : int , * , err_msg : str = "" ):
147147 """
148148 :param value: The length of the iterable.
149149 :param err_msg: Error message.
@@ -164,7 +164,7 @@ class MustHaveLengthGreaterThanOrEqual(Validator):
164164 the specified value.
165165 """
166166
167- def __init__ (self , value : int , * , err_msg : Optional [ str ] = None ):
167+ def __init__ (self , value : int , * , err_msg : str = "" ):
168168 """
169169 :param value: The length of the iterable.
170170 :param err_msg: Error message
@@ -185,7 +185,7 @@ class MustHaveLengthLessThan(Validator):
185185 value.
186186 """
187187
188- def __init__ (self , value : int , * , err_msg : Optional [ str ] = None ):
188+ def __init__ (self , value : int , * , err_msg : str = "" ):
189189 """
190190 :param value: The length of the iterable.
191191 :param err_msg: Error message.
@@ -206,7 +206,7 @@ class MustHaveLengthLessThanOrEqual(Validator):
206206 the specified value.
207207 """
208208
209- def __init__ (self , value : int , * , err_msg : Optional [ str ] = None ):
209+ def __init__ (self , value : int , * , err_msg : str = "" ):
210210 """
211211 :param value: The length of the iterable.
212212 :param err_msg: Error message.
@@ -234,7 +234,7 @@ def __init__(
234234 max_value : int ,
235235 min_inclusive : bool = True ,
236236 max_inclusive : bool = True ,
237- err_msg : Optional [ str ] = None ,
237+ err_msg : str = "" ,
238238 ):
239239 """
240240 :param min_value: The minimum value (inclusive or exclusive based
@@ -276,7 +276,7 @@ class MustHaveValuesGreaterThan(Validator):
276276 specified min_value.
277277 """
278278
279- def __init__ (self , min_value : Number , * , err_msg : Optional [ str ] = None ):
279+ def __init__ (self , min_value : Number , * , err_msg : str = "" ):
280280 """
281281 :param min_value: The minimum value the values in the iterable
282282 should be greater than.
@@ -298,7 +298,7 @@ class MustHaveValuesGreaterThanOrEqual(Validator):
298298 equal to the specified min_value.
299299 """
300300
301- def __init__ (self , min_value : Number , * , err_msg : Optional [ str ] = None ):
301+ def __init__ (self , min_value : Number , * , err_msg : str = "" ):
302302 """
303303 :param min_value: The minimum value the values in the iterable
304304 should be greater than or equal to.
@@ -320,7 +320,7 @@ class MustHaveValuesLessThan(Validator):
320320 specified max_value.
321321 """
322322
323- def __init__ (self , max_value : Number , * , err_msg : Optional [ str ] = None ):
323+ def __init__ (self , max_value : Number , * , err_msg : str = "" ):
324324 """
325325 :param max_value: The maximum value the values in the iterable
326326 should be less than.
@@ -342,7 +342,7 @@ class MustHaveValuesLessThanOrEqual(Validator):
342342 equal to the specified max_value.
343343 """
344344
345- def __init__ (self , max_value : Number , * , err_msg : Optional [ str ] = None ):
345+ def __init__ (self , max_value : Number , * , err_msg : str = "" ):
346346 """
347347 :param max_value: The maximum value the values in the iterable
348348 should be less than or equal to.
@@ -371,7 +371,7 @@ def __init__(
371371 max_value : Number ,
372372 min_inclusive : bool = True ,
373373 max_inclusive : bool = True ,
374- err_msg : Optional [ str ] = None ,
374+ err_msg : str = "" ,
375375 ):
376376 """
377377 :param min_value: The minimum value (inclusive or exclusive based
0 commit comments