(qualified_name, named_tuple_def)
| 13884 | this._cu.register_type(enum_type); |
| 13885 | } |
| 13886 | importNamedTuple(qualified_name, named_tuple_def) { |
| 13887 | const type_parser = new torch._C.ScriptTypeParser(this); |
| 13888 | const field_names = []; |
| 13889 | const field_types = []; |
| 13890 | const field_defaults = []; |
| 13891 | for (const stmt of named_tuple_def.body) { |
| 13892 | if (stmt instanceof ast.AnnAssign === false) { |
| 13893 | throw new python.Error('Unexpected statement in NamedTuple body.'); |
| 13894 | } |
| 13895 | const assign = stmt; |
| 13896 | const target = this._cu.execution.identifier(stmt.target); |
| 13897 | // const annotation = this._cu.execution.type(stmt.annotation); |
| 13898 | const type = type_parser.parseTypeFromExpr(assign.annotation); |
| 13899 | field_names.push(target); |
| 13900 | // field_types.push(annotation); |
| 13901 | field_types.push(type); |
| 13902 | } |
| 13903 | const tt = torch.TupleType.createNamed(qualified_name.qualifiedName(), field_names, field_types, field_defaults); |
| 13904 | this._cu.register_type(tt); |
| 13905 | } |
| 13906 | importFunction(qualifier, def) { |
| 13907 | const definitions = [def]; |
| 13908 | const resolvers = [this]; |
no test coverage detected