diff options
Diffstat (limited to 'lib.py')
-rw-r--r-- | lib.py | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -64,7 +64,10 @@ class LibMeta(type): map(lambda x: nnames.update(getattr(x, 'nnames')), tuple(subgraphs) + tuple(nodes) + tuple(edges)) + for akey, avalue in getattr(cls, 'defaults', {}).iteritems(): + kwargs.setdefault(akey, avalue) old_init(self, *args, **kwargs) + super(cls, self).__init__(*args, **kwargs) bl_map_nodes_edges(filter(lambda x: not bl_test(x), nodes), edges, nnames) @@ -122,6 +125,20 @@ class EdgeInvisible(LibEdge): super(EdgeInvisible, self).__init__(*args, **kwargs) +# Attributes + +class LibAttributeMeta(type): + def __getattr__(cls, what): + return (cls.__name__.lower(), what) + + +class LibAttribute(object): + __metaclass__ = LibAttributeMeta + def __new__(self, what): + return (self.__name__.lower(), what) + #return getattr(self, what) + + # # main-helpers # |