__init__ is wrapped so the function signature is overriden and apps like idlefork can't show the user how to initialize the class
Issue #1285
resolved
I know that it's probably unsolvable, but it would be nice to see if there is an easy way to fix the problem. It's especially problematic for those that provide an pythonic API to their customers.
Example - class A is mapped
class A(object):
def __init__(self, a):
self.a = a
A.__init__( (and then idlefork shows "(*args, **kwargs)" instead of "(a)")
or
A.__init__.im_func.func_code.co_varnames
['args', 'kwargs']('instance',)
I'm using 4.7.1 version.
Comments (3)
-
Account Deleted -
repo owner We reconstruct the
__init__
method with the identical argument signature in 0.5.from sqlalchemy import * from sqlalchemy.orm import * m = MetaData() t = Table('table', m, Column('id', Integer, primary_key=True)) class A(object): def __init__(self, a): self.a = a mapper(A, t) compile_mappers()
Running inspect:
import inspect print inspect.getargspec(A.__init__)
returns:
(['a']('self',), None, None, None)
running
help(A)
returns:Help on class A in module __main__: class A(__builtin__.object) | Methods defined here: | | __init__(self, a) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | id | Public-facing descriptor, placed in the mapped class dictionary.
-
repo owner - removed milestone
Removing milestone: 0.5.0 (automated comment)
- Log in to comment
It also isn't possible to give {{{instance}}} keyword argument for it. Such {{{init}}} wrapper should not use such generic argument name.