Skip to content

Create astroid module from a string using AstroidManager #725

@twmr

Description

@twmr

For the read-from-stdin feature in pylint an AST is constructed using

AstroidBuilder(MANAGER).string_build(data, modname, filepath)

whereas for regular modules it is constructed using

MANAGER.ast_from_file(filepath, modname, source=True)

See the get_ast method in https://github.com/PyCQA/pylint/pull/3257/files/5b24700e7bf84d1f2ae6fcd468acf5a9f6f1c458

The module docstring of astroid.manager suggests that the Manager should be used for both cases in pylint.

Therefore, AstroidManager should provide a way to create an AST from a string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentGood first issueFriendly and approachable by new contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions