Skip to content

Instantly share code, notes, and snippets.

View KrzysztofCiba's full-sized avatar

Krzysztof Daniel Ciba KrzysztofCiba

View GitHub Profile
@KrzysztofCiba
KrzysztofCiba / DynamicProps
Created October 1, 2012 19:12
metaclass with dynamic properties
class DynamicProps( type ):
"""
.. class:: DynamicProps
dynamic creation of properties
"""
def __new__( mcs, name, bases, classdict ):
""" new operator """
def makeProperty( self, name, value, readOnly=False ):
@KrzysztofCiba
KrzysztofCiba / DynamicProps.py
Created October 1, 2012 19:14
python metaclass with dynamic properties
class DynamicProps( type ):
"""
.. class:: DynamicProps
dynamic creation of properties
"""
def __new__( mcs, name, bases, classdict ):
""" new operator """
def makeProperty( self, name, value, readOnly=False ):
@KrzysztofCiba
KrzysztofCiba / TypedList.py
Created October 1, 2012 19:23
one type list
########################################################################
# $HeadURL $
# File: TypedList.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2012/07/19 08:21:16
########################################################################
""" :mod: TypedList
=======================
.. module: TypedList
########################################################################
# $HeadURL $
# File: Traced.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2012/08/08 13:29:18
########################################################################
""" :mod: Traced
============
.. module: Traced
:synopsis: watched mutable metaclass
#!/usr/bin/env python
##
# @file svn-policy.py
# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com)
# @date 06/05/2009
# @brief pre-commit hook
#
import os
import sys
import getopt
@KrzysztofCiba
KrzysztofCiba / ProcessPool.py
Created October 1, 2012 19:27
multiprocessing example
#################################################################
# $HeadURL$
#################################################################
""" :mod: ProcessPool
=================
.. module: ProcessPool
:synopsis: ProcessPool and related classes
ProcessPool
-----------
@KrzysztofCiba
KrzysztofCiba / Render.php
Created October 1, 2012 19:30
rendering graphs
require_once("System.php");
/**
* @class graphviz
* @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com)
* @brief class for making Graphviz plots online
*/
class graphviz {
var $directed = True;
class baseClass( object ):
def __init__( self ):
from testGlobal import gX, foo
try:
__builtins__["gX"] = gX
__builtins__["foo"] = foo
except:
setattr( __builtins__, "gX", gX )
setattr( __builtins__, "foo", foo )
from testBase import baseClass
class testChild( baseClass ):
def __init__( self ):
baseClass.__init__( self )
print "in child, gX is there? ", "gX" in globals()
print "in child, foo is there? ", "foo" in globals()
def myRun( self ):
@KrzysztofCiba
KrzysztofCiba / a.py
Created October 1, 2012 20:19
trash3
class A:
def __init__( self ):
print type(__builtins__)
if __name__ == "__main__":
a = A()