File: buildplots.py

package info (click to toggle)
mpmath 1.4.0~a6-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,556 kB
  • sloc: python: 47,434; makefile: 22
file content (22 lines) | stat: -rw-r--r-- 701 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os.path
import glob

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)