79301145

Date: 2024-12-22 14:21:12
Score: 0.5
Natty:
Report link

Counter.total was added to mypy in version 0.940. Your code, part f1 and f2 works fine

from collections import Counter


def f1(c: Counter[str]) -> None:
    print(c.total())


def f2(c: Counter) -> None:
    print(c.total())


c: Counter = Counter()
c.update(["a", "b", "c", "a", "b", "c"])

f1(c)
f2(c)

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: SukiCZ