core/general: move cached_property into compat, use standard implementation from python3.8
This commit is contained in:
parent
711157e0f5
commit
4e59a65f9a
6 changed files with 38 additions and 27 deletions
|
@ -6,8 +6,8 @@ from typing import NamedTuple
|
|||
import json
|
||||
from typing import Dict, Iterator
|
||||
|
||||
from ..common import cproperty, get_files
|
||||
from ..error import Res, unwrap
|
||||
from ..core import get_files, Res, unwrap
|
||||
from ..core.compat import cached_property
|
||||
from ..core.konsume import ignore, wrap
|
||||
|
||||
from kython import fget
|
||||
|
@ -46,18 +46,18 @@ class Competition(NamedTuple):
|
|||
contest: str
|
||||
cmap: Cmap
|
||||
|
||||
@cproperty
|
||||
@cached_property
|
||||
def uid(self) -> Cid:
|
||||
return self.contest_id
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.contest_id)
|
||||
|
||||
@cproperty
|
||||
@cached_property
|
||||
def when(self) -> datetime:
|
||||
return self.cmap[self.uid].when
|
||||
|
||||
@cproperty
|
||||
@cached_property
|
||||
def summary(self) -> str:
|
||||
return f'participated in {self.contest}' # TODO
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue