Server IP : 127.0.0.2 / Your IP : 3.15.2.88 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/pychart/ |
Upload File : |
# # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import sys import re import os.path from pychart import * from types import * from pychart.pychart_types import * oldstdout = sys.stdout if os.path.exists("/dev/null"): sys.stdout = open("/dev/null", "w") modules = {} values = [] sys.stdout = oldstdout g = globals() for mod in g.keys(): val = g[mod] if type(val) == ModuleType: dic = {} for name in val.__dict__.keys(): v = val.__dict__[name] if name[0] != '_': values.append((v, mod + "." + name)) if type(v) == type and issubclass(v, chart_object.T): dic[name] = v modules[mod] = dic def stringify_type(t): s = str(t) if t == AnyType: return "any" if t == ShadowType: return "(xoff,yoff,fill)" elif re.search("NumberType", s): return "number" elif re.search("UnitType", s): return 'length in points (\\xref{unit})' elif re.search("CoordType", s): return "(x,y) or None" elif re.search("CoordSystemType", s): return "['linear'|'log'|'category']" elif re.search("TextAlignType", s): return "['R'|'L'|'C'|None]" elif re.search("FormatType", s): return "printf format string" elif re.search("IntervalType", s): return "number or function" mo = re.match("<type '([^']+)'>", s) if mo: return mo.group(1) mo = re.match("<class 'pychart\.([^']+)'>", s) if mo: return mo.group(1) mo = re.match("<class '([^']+)'>", s) if mo: return mo.group(1) mo = re.match("pychart\\.(.*)", s) if mo: return mo.group(1) return s def stringify_value(val): t = type(val) if t == StringType: return '"' + val + '"' if t == bool: if val: return "True" else: return "False" if t in (IntType, LongType, FloatType): return str(val) if val == None: return "None" if type(val) == ListType: return map(stringify_value, val) for pair in values: if pair[0] == val: return pair[1] return str(val) def break_string(name): max_len = 10 if len(name) < max_len: return name name = re.sub("(\\d\\d)([^\\d])", "\\1-\n\\2", name) name = re.sub("black(.)", "black-\n\\1", name) elems = name.split("\n") while 1: broken = 0 for i in range(len(elems)): elem = elems[i] if len(elem) < max_len: continue broken = 1 elem1 = elem[0:len(elem)/2] elem2 = elem[len(elem)/2:] elems[i:i+1] = [elem1, elem2] break if not broken: break name = "\n".join(elems) return name