我正尝试在我的python项目中使用mypy进行静态类型检查。但是,在运行mypy时,我看到以下错误,
utils.py:15: error: Name 'google' is not defined注释如下所示
# type: () -> google.protobuf.timestamp_pb2.Timestamp发布于 2018-04-24 06:12:28
似乎google没有导入到文件中,所以mypy找不到它。
此外,如果您正在使用protobufs和mypy,您可能会对https://github.com/dropbox/mypy-protobuf感兴趣,它将从protobufs自动生成存根。
https://stackoverflow.com/questions/49869848
复制相似问题