def make(cls, cmap, json) -> Iterator[Res['Competition']]: # TODO try here?? contest_id = json['contestId'].zoom().value contest = json['contestName'].zoom().value yield cls( contest_id=contest_id, contest=contest, cmap=cmap, ) # TODO ytry??? ignore(json, 'rank', 'oldRating', 'newRating')
def make(cls, json) -> Iterator[Res['Competition']]: ignore(json, 'rating', 'placement') cid = json['challengeId'].zoom().value cname = json['challengeName'].zoom().value percentile = json['percentile'].zoom().value dates = json['date'].zoom().value yield cls( contest_id=cid, contest=cname, percentile=percentile, dates=dates, )
def iter_data() -> Iterator[Res[Competition]]: cmap = get_contests() last = max(get_files(config.export_path, 'codeforces*.json')) with wrap(json.loads(last.read_text())) as j: j['status'].ignore() res = j['result'].zoom() for c in list(res): # TODO maybe we want 'iter' method?? ignore(c, 'handle', 'ratingUpdateTimeSeconds') yield from Competition.make(cmap=cmap, json=c) c.consume()
def iter_data() -> Iterator[Res[Competition]]: with wrap(_get_latest()) as j: ignore(j, 'id', 'version') res = j['result'].zoom() ignore(res, 'success', 'status', 'metadata') cont = res['content'].zoom() ignore(cont, 'handle', 'handleLower', 'userId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy') cont['DEVELOP'].ignore() # TODO handle it?? ds = cont['DATA_SCIENCE'].zoom() mar, srm = zoom(ds, 'MARATHON_MATCH', 'SRM') mar = mar['history'].zoom() srm = srm['history'].zoom() # TODO right, I guess I could rely on pylint for unused variables?? for c in mar + srm: yield from Competition.make(json=c) c.consume()