summaryrefslogtreecommitdiffstats
path: root/lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib.py')
-rw-r--r--lib.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib.py b/lib.py
index 4cd9ac7..ff40240 100644
--- a/lib.py
+++ b/lib.py
@@ -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
#