##// END OF EJS Templates
add local numpy import
Peter Corke -
Show More
@@ -636,7 +636,6 b' class PlainTextFormatter(BaseFormatter):'
636
636
637 This parameter can be set via the '%precision' magic.
637 This parameter can be set via the '%precision' magic.
638 """
638 """
639
640 new = change['new']
639 new = change['new']
641 if '%' in new:
640 if '%' in new:
642 # got explicit format string
641 # got explicit format string
@@ -678,7 +677,9 b' class PlainTextFormatter(BaseFormatter):'
678 def _type_printers_default(self):
677 def _type_printers_default(self):
679 d = pretty._type_pprinters.copy()
678 d = pretty._type_pprinters.copy()
680 d[float] = lambda obj,p,cycle: p.text(self.float_format%obj)
679 d[float] = lambda obj,p,cycle: p.text(self.float_format%obj)
680 # if NumPy is used, set precision for its float64 type
681 if 'numpy' in sys.modules:
681 if 'numpy' in sys.modules:
682 import numpy
682 d[numpy.float64] = lambda obj,p,cycle: p.text(self.float_format%obj)
683 d[numpy.float64] = lambda obj,p,cycle: p.text(self.float_format%obj)
683 return d
684 return d
684
685
General Comments 0
You need to be logged in to leave comments. Login now