from wrpylib.wrorm import Page, WrIntermapsSledrun, WrIntermapsReport, WrIntermapsReportHistory
-def investigate(filename: str, write_back_formatted: bool):
- """Displays statistics about a Intermaps json file."""
- with open(filename) as fp:
- content = json.load(fp)
- regions = content['items']
- sledruns = list(itertools.chain.from_iterable(region['sledruns']['items'] for region in regions))
- sledrun_ids_list = [sledrun['id'] for sledrun in sledruns]
- sledrun_ids_set = set(sledrun_ids_list)
- duplicates = {sledrun_id for sledrun_id in sledrun_ids_set if sum(sr_id == sledrun_id for sr_id in sledrun_ids_list) >= 2}
- print(duplicates)
- print(max(map(len, sledrun_ids_set))) # 36
- if write_back_formatted:
- with open(filename, 'w') as fp:
- json.dump(content, fp, indent='\t')
-
-
class UpdateError(RuntimeError):
pass