Skip to content

Remove type hints with impossible to import modules #192

@RecurvedBow

Description

@RecurvedBow

In typegen, modules of type annotations are imported. However, some type hints can not be imported. An example is the return value of hashlib.sha256(). It is a hash instance defined in CPython and thus can not be imported. To generalize this which type hints should be removed, any module name which contains "-" is not a valid module name. To figure out whether a type hint should be removed, check the module name in imports.py. Parsing using cst.parse_expression(module) will generate a node of type cst.BinaryOperation. Remove such type hints if the name of the module is invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions