convertstats

This commit is contained in:
Laura Klünder 2018-12-28 19:53:04 +01:00
parent e6afd91805
commit 0d59b6e7f4
2 changed files with 194 additions and 0 deletions

View file

@ -0,0 +1,19 @@
import argparse
import json
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
from c3nav.mapdata.utils.cache.stats import convert_stats
class Command(BaseCommand):
help = 'convert stats file'
def add_arguments(self, parser):
parser.add_argument('statsfile', type=argparse.FileType('r'), help=_('stats file to convert'))
def handle(self, *args, **options):
data = json.load(options['statsfile'])
result = convert_stats(data)
print(json.dumps(result, indent=4))