convertstats
This commit is contained in:
parent
e6afd91805
commit
0d59b6e7f4
2 changed files with 194 additions and 0 deletions
19
src/c3nav/mapdata/management/commands/convertstats.py
Normal file
19
src/c3nav/mapdata/management/commands/convertstats.py
Normal 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))
|
Loading…
Add table
Add a link
Reference in a new issue