File: buildplots.py

package info (click to toggle)
mpmath 0.19-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,324 kB
  • ctags: 2,850
  • sloc: python: 44,052; makefile: 44; sh: 4
file content (28 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os.path
import glob

try:
    import psyco
    psyco.full()
except ImportError:
    pass

for f in glob.glob("*.py"):
    if "buildplots" in f or os.path.exists(f[:-3]+".png"):
        continue
    print "Processing", f
    code = open(f).readlines()
    code = ["from mpmath import *; mp.dps=5"] + code
    for i in range(len(code)):
        l = code[i].rstrip()
        if "cplot(" in l:
            l = l[:-1] + (", dpi=45, file='%s.png', verbose=True)" % f[:-3])
            code[i] = l
        elif "splot(" in l:
            l = l[:-1] + (", dpi=45, file='%s.png')" % f[:-3])
            code[i] = l
        elif "plot(" in l:
            l = l[:-1] + (", dpi=45, file='%s.png')" % f[:-3])
            code[i] = l
    code = "\n".join(code)
    exec code