diff options
Diffstat (limited to '4.py')
-rw-r--r-- | 4.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,6 +1,8 @@ +# pyright: strict from dataclasses import dataclass from functools import cache from sys import stdin +from typing import Type @dataclass(frozen=True) @@ -14,7 +16,7 @@ class Card: return len(self.winning & self.have) @classmethod - def from_str(cls, s: str): + def from_str[T](cls: Type[T], s: str) -> T: card, rest = s.split(": ") _, card_id = card.split() winning, have = rest.split(" | ") |