Skip to content

ScopeInfo context to resolve imports #89

@matejsp

Description

@matejsp

Would it be possible for scope info to resolve imports or perhaps have some example in docs how to handle imports.

For example I would like to have a rule that matches:
ast.Name or ast.Attribute and map it to ful name.

from marshamallow import Schema
from marshamallow import schema
import marshmallow
import marshmallow as mmm
from marshamallow import schema as xxxx

Schema -> marshmallow.Schema
schema.Schema -> marshmallow.schema.Schema
marshmallow.Schema -> marshmallow.Schema
mmm.Schema -> marshmallow.Schema
xxxxx.Schema -> marshmallow.Schema

I thought ScopeInfo would get me this information, but it only links to Import or ImportFrom AST.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions