Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Maybe rework the logic for objects lines or source #272

Closed
pawamoy opened this issue May 22, 2024 · 1 comment
Closed

refactor: Maybe rework the logic for objects lines or source #272

pawamoy opened this issue May 22, 2024 · 1 comment
Assignees

Comments

@pawamoy
Copy link
Member

pawamoy commented May 22, 2024

Following #271, and now that Griffe can inspect everything even when sources are found, maybe we should rework how lines and therefore source are computed. If possible, when inspecting and sources are available (and added to the lines collection), we should try to obtain the lineno and endlineno values from inspect (stdlib). If the sources are not available (no filepath, and/or no entry in the lines collection), we should still try to obtain the source with inspect (stdlib) to set the source attribute of the object. To allow setting source, we should keep the actual source in a _source attribute, and the property would first check that.

@pawamoy pawamoy added the feature New feature or request label May 22, 2024
@pawamoy pawamoy self-assigned this May 22, 2024
@pawamoy pawamoy removed the feature New feature or request label May 22, 2024
@pawamoy
Copy link
Member Author

pawamoy commented Jun 8, 2024

inspect has getsourcelines. If it fails, it fails. What I mean is, if we're not able to get line numbers, we won't be able to get source lines. So no need to change the source property, we just have to do our best to get line numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant