@@ -371,7 +371,7 @@ def capital(self):
371371
372372
373373int_re = re .compile (
374- r"\b((int(eger)?)|size|length|max|min|num(ber)?)\b" , flags = re .IGNORECASE
374+ r"\b((int(eger)?)|size|length|max|min|( num(ber)?) )\b" , flags = re .IGNORECASE
375375)
376376str_re = re .compile (r"\bstr(ing)?\b" , flags = re .IGNORECASE )
377377float_re = re .compile (r"\b(float|decimal)\b" , flags = re .IGNORECASE )
@@ -384,8 +384,11 @@ def capital(self):
384384default_re = re .compile (
385385 r"default(?: value)?(?:[:=] ?| )([^ )\]]+)" , flags = re .IGNORECASE
386386)
387- float_re = re .compile (r"[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)" , flags = re .IGNORECASE )
388- int_re = re .compile (r"[+-]?([0-9]+[^.0-9])" , flags = re .IGNORECASE )
387+ float_num_re = re .compile (
388+ r"[+-]?(([0-9]*\.[0-9]+)|((?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)))" ,
389+ flags = re .IGNORECASE ,
390+ )
391+ int_num_re = re .compile (r"([+-]?[0-9]+)" , flags = re .IGNORECASE )
389392
390393
391394def infer_type (string ) -> typing .Optional [cli_types .CliType ]:
@@ -416,7 +419,13 @@ def infer_type(string) -> typing.Optional[cli_types.CliType]:
416419 elif str_re .search (string ):
417420 return cli_types .CliString ()
418421 else :
419- return None
422+ if float_num_re .search (string ):
423+ return cli_types .CliFloat ()
424+ elif int_num_re .search (string ):
425+ print ("int num" )
426+ return cli_types .CliInteger ()
427+ else :
428+ return None
420429
421430
422431@yaml_object (yaml )
0 commit comments