jedi icon indicating copy to clipboard operation
jedi copied to clipboard

get_signatures() returns itself ?

Open QuentinFuxa opened this issue 3 months ago • 0 comments

Hello, thank you for this amazing project.

Maybe I am not using it correctly, but doing:

script = Script("""import numpy as np
from sklearn.linear_model import LinearRegression


X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3


reg = LinearRegression().fit(X, y)
""")

signature = script.get_signatures(
    line = 9,
    column= 23
)[0] #it is LinearRegression

signature.get_signatures()
"""Returns [<BaseSignature full_name='sklearn.linear_model._base.LinearRegression', description='class LinearRegression'>]"""

signature.get_signatures()[0].get_signatures()[0].get_signatures()[0] #...
"""Returns <BaseSignature full_name='sklearn.linear_model._base.LinearRegression', description='class LinearRegression'>"""

Looking at what is really in signature.module_path, we actually have lot of methods and calls in the class: https://github.com/scikit-learn/scikit-learn/blob/c60dae20604f8b9e585fc18a8fa0e0fb50712179/sklearn/linear_model/_base.py#L458 And the class inherits from MultiOutputMixin, RegressorMixin, LinearModel, tho it seems i cannot get this information.

If this kind of analysis is out of the scope of this lib, do you recommand me to use python ast to get this information ? Thank you

QuentinFuxa avatar Oct 08 '25 17:10 QuentinFuxa