Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb529da commit ebff832Copy full SHA for ebff832
1 file changed
lib/matplotlib/testing/determinism.py
@@ -2,6 +2,8 @@
2
Provides utilities to test output reproducibility.
3
"""
4
5
+import six
6
+
7
import io
8
import os
9
import re
@@ -53,7 +55,13 @@ def _determinism_save(objects='mhi', format="pdf"):
53
55
x = range(5)
54
56
fig.add_subplot(1, 6, 6).plot(x, x)
57
- fig.savefig(sys.stdout.buffer, format=format)
58
+ if six.PY2 and format == 'ps':
59
+ stdout = io.StringIO()
60
+ else:
61
+ stdout = getattr(sys.stdout, 'buffer', sys.stdout)
62
+ fig.savefig(stdout, format=format)
63
64
+ sys.stdout.write(stdout.getvalue())
65
66
# Restores SOURCE_DATE_EPOCH
67
if sde is None:
0 commit comments