Skip to content

Add an alias ImportFrom.module and fix other inconsistencies with the ast module #1338

Open
@tristanlatr

Description

@tristanlatr

I was expecting my current visitors simply based on the ast module to be working seemlessly with astroid trees, but it turns out some attributes names are not matching the ones in the standrd library.

Current behavior

When trying to get node.module on a fresh astroid.ImportFrom:

AttributeError: 'ImportFrom' object has no attribute 'module'

Expected behavior

ImportFrom.module would be an alias to ImportFrom.modname to match standard library names such that less effort is needed to adopt astroid.

Astroid version: 2.9.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions