]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
removed old function
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 27 Nov 2006 01:27:10 +0000 (01:27 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 27 Nov 2006 01:27:10 +0000 (01:27 +0000)
lib/sqlalchemy/util.py

index bd40039d4e88b79772d7f1733f05d478d9441ef7..a4370edaf3001bdbfeffe29b418cac1c2daba073 100644 (file)
@@ -259,43 +259,3 @@ class ScopedRegistry(object):
         return self.scopefunc()
 
 
-def constructor_args(instance, **kwargs):
-    """given an object instance and keyword arguments, inspects the 
-    argument signature of the instance's __init__ method and returns 
-    a tuple of list and keyword arguments, suitable for creating a new
-    instance of the class.  The returned arguments are drawn from the
-    given keyword dictionary, or if not found are drawn from the 
-    corresponding attributes of the original instance."""
-    classobj = instance.__class__
-        
-    argspec = inspect.getargspec(classobj.__init__.im_func)
-
-    argnames = argspec[0] or []
-    defaultvalues = argspec[3] or []
-
-    (requiredargs, namedargs) = (
-            argnames[0:len(argnames) - len(defaultvalues)], 
-            argnames[len(argnames) - len(defaultvalues):]
-            )
-
-    newparams = {}
-
-    for arg in requiredargs:
-        if arg == 'self': 
-            continue
-        elif kwargs.has_key(arg):
-            newparams[arg] = kwargs[arg]
-        else:
-            newparams[arg] = getattr(instance, arg)
-
-    for arg in namedargs:
-        if kwargs.has_key(arg):
-            newparams[arg] = kwargs[arg]
-        else:
-            if hasattr(instance, arg):
-                newparams[arg] = getattr(instance, arg)
-            else:
-                raise AssertionError("instance has no attribute '%s'" % arg)
-
-    return newparams
-