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.
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.