From 6a5644ee11020ec09406b8ad917f397f7a4fe237 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Wed, 6 Aug 2003 12:08:27 +0000 Subject: [PATCH] formatting git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@1015 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/helper.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyx/helper.py b/pyx/helper.py index 8ac876ff..6f815a8b 100644 --- a/pyx/helper.py +++ b/pyx/helper.py @@ -67,6 +67,7 @@ def ensuresequence(arg): if issequence(arg): return arg return (arg,) + def ensurelist(arg): """return list(arg) or [arg] depending on the result of isequence, None is converted to []""" @@ -102,7 +103,6 @@ def getsequenceno(arg, n): return arg - class AttrError(base.PyXExcept): pass @@ -126,6 +126,7 @@ def checkattr(attrs, allowonce=(), allowmulti=()): else: raise AttrError("%r not allowed" % attr) + def getattrs(attrs, get, default=nodefault): """creates a list of instances of class get out of the sequence attrs when no instances are found it returns default when set (whatever it is) @@ -145,10 +146,12 @@ def getattrs(attrs, get, default=nodefault): return default return result + def countattrs(attrs, check): "count the occurancies of instances of class get out of the sequence attrs" return len(getattrs(attrs, check, ())) + def getattr(attrs, get, default=nodefault): """get the instance of class get out of the sequence attrs when no instance is found it returns default when set (whatever it is) @@ -165,6 +168,7 @@ def getattr(attrs, get, default=nodefault): raise AttrError return result[0] + def getfirstattr(attrs, get, default=nodefault): """get the first instance of class get out of the sequence attrs when no instances are found it returns default when set (whatever it is) @@ -178,6 +182,7 @@ def getfirstattr(attrs, get, default=nodefault): return default return result[0] + def getlastattr(attrs, get, default=nodefault): """get the last instance of class get out of the sequence attrs when no instances are found it returns default when set (whatever it is) @@ -191,6 +196,7 @@ def getlastattr(attrs, get, default=nodefault): return default return result[-1] + def delattr(attrs, remove): """create a new list of instances out of the sequence attrs where all instances of class remove are removed""" -- 2.11.4.GIT