!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/pyshared/OpenGL/   drwxr-xr-x
Free 130.05 GB of 142.11 GB (91.51%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     constant.py (2.57 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
"""Implementation of OpenGL constant objects"""
import sys

class Constant( object ):
    """OpenGL constant that displays itself as a name rather than a value
    
    The purpose of this class is to make debugging OpenGL code easier,
    as you recieve messages that say what value you passed in in a 
    human-readable form, rather than as a bald number that requires
    lookup and disambiguation in the header file.
    """
    def __new__( cls, name, value ):
        """Initialise the constant with the given name and value"""
        if isinstance( value, float ) and cls is not FloatConstant:
            return FloatConstant( name, value )
        elif isinstance( value, (int,long) ) and cls is not IntConstant:
            return IntConstant( name, value )
        elif isinstance( value, (str,unicode) ) and cls is not StringConstant:
            return StringConstant( name, str(value) )
        if isinstance( value, long ):
            if value > sys.maxint:
                value = - (value & sys.maxint)
        base = super(Constant,cls).__new__( cls, value )
        base.name = name 
        return base
    def __repr__( self ):
        """Return the name, rather than the bald value"""
        return self.name 

class NumericConstant( Constant ):
    """Base class for numeric-value constants"""
    def __str__( self ):
        """Return the value as a human-friendly string"""
        return '%s (%s)'%(self.name,super(Constant,self).__str__())
    def __getstate__(self):
        """Retrieve state for pickle and the like"""
        return self.name
    def __setstate__( self, state ):
        self.name = state
        
class IntConstant( NumericConstant, int ):
    """Integer constant"""
    __slots__ = ('name',)
class FloatConstant( NumericConstant, float ):
    """Float constant"""
    __slots__ = ('name',)

class StringConstant( Constant, str ):
    """String constants"""
    def __repr__( self ):
        """Return the value as a human-friendly string"""
        return '%s (%s)'%(self.name,super(Constant,self).__str__())
    def __getnewargs__( self ):
        """Produce the new arguments for recreating the instance"""
        return (self.name,) + super( Constant, self ).__getnewargs__()

if __name__ == "__main__":
    x = IntConstant( 'testint', 3 )
    y = FloatConstant( 'testfloat', 3.0 )
    z = StringConstant( 'teststr', 'some testing string' )
    
    import pickle
    for val in x,y,z:
        restored = pickle.loads( pickle.dumps( val ))
        assert restored == val, (str(restored),str(val))
        assert restored.name == val.name, (restored.name,val.name)
        

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0141 ]--