##// END OF EJS Templates
tweak exceptions in %precision
MinRK -
Show More
@@ -3504,15 +3504,15 b' Defaulting color scheme to \'NoColor\'"""'
3504 fmt = s
3504 fmt = s
3505 try:
3505 try:
3506 fmt%3.14159
3506 fmt%3.14159
3507 except:
3507 except Exception:
3508 raise TypeError("Precision must be int or format string, not %r"%s)
3508 raise ValueError("Precision must be int or format string, not %r"%s)
3509 elif s:
3509 elif s:
3510 # otherwise, should be an int
3510 # otherwise, should be an int
3511 try:
3511 try:
3512 i = int(s)
3512 i = int(s)
3513 assert i >= 0
3513 assert i >= 0
3514 except:
3514 except (ValueError, AssertionError):
3515 raise TypeError("Precision must be non-negative int or format string, not %r"%s)
3515 raise ValueError("Precision must be non-negative int or format string, not %r"%s)
3516
3516
3517 fmt = '%%.%if'%i
3517 fmt = '%%.%if'%i
3518 if 'numpy' in sys.modules:
3518 if 'numpy' in sys.modules:
General Comments 0
You need to be logged in to leave comments. Login now