Mypy抱怨DateTime差异

发布于 2025-02-01 05:03:05 字数 221 浏览 2 评论 0原文

Mypy抱怨分配了两个数据的差异的代码行。

foo的类型是dateTime.timedelta。

来自Mypy的错误消息是“ int不可召唤”。

我想念什么?

import arrow

t1 = arrow.now()
t2 = arrow.now()
foo = t1 - t2
bar = foo.total_seconds()

MyPy complains about the line of code where bar is assigned the difference of two datetimes.

The type of foo is datetime.timedelta.

The error message from MyPy is "int not callable".

What am I missing?

import arrow

t1 = arrow.now()
t2 = arrow.now()
foo = t1 - t2
bar = foo.total_seconds()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疯狂的代价 2025-02-08 05:03:05

事实证明这是一个已知的问题。有关详细信息,请参见以下内容:

https://github.com/python/mypy/mypy/11613131613

This turned out to be a known issue. For details, see the following:

https://github.com/python/mypy/issues/11613

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文