<commit_before>from __future__ import print_function

import argparse
import sys
import traceback

from . import *


def mvt_preview(args):
    mvt = VectorTileMerc(0, 0, 0)
    with open(getattr(args, "in"), "rb") as f:
        merge_compressed_buffer(mvt, f.read())
    image = Image(args.size, args.size)
    if args.style:
        mapnikMap = Map(args.size, args.size)
        load_map(mapnikMap, args.style)
        preview_mvt_merc(mvt, mapnikMap, image)
    else:
        preview_mvt_merc(mvt, image)
    image.save(args.out, "png32")


def unknown_command(args):
    print("Unknown command:", args.command)
    sys.exit(1)


def main(args):
    try:
        {
            "mvt_preview": mvt_preview,
        }.get(args.command, unknown_command)(args)
    except Exception as e:
        print(traceback.format_exc())
        sys.exit(1)<commit_msg>Use less costly png8<commit_after>from __future__ import print_function

import argparse
import sys
import traceback

from . import *


def mvt_preview(args):
    mvt = VectorTileMerc(0, 0, 0)
    with open(getattr(args, "in"), "rb") as f:
        merge_compressed_buffer(mvt, f.read())
    image = Image(args.size, args.size)
    if args.style:
        mapnikMap = Map(args.size, args.size)
        load_map(mapnikMap, args.style)
        preview_mvt_merc(mvt, mapnikMap, image)
    else:
        preview_mvt_merc(mvt, image)
    image.save(args.out, "png8")


def unknown_command(args):
    print("Unknown command:", args.command)
    sys.exit(1)


def main(args):
    try:
        {
            "mvt_preview": mvt_preview,
        }.get(args.command, unknown_command)(args)
    except Exception as e:
        print(traceback.format_exc())
        sys.exit(1)
{'fraction_non_alphanumeric': 0.11888111888111888, 'fraction_numerical': 0.008158508158508158, 'mean_word_length': 2.938073394495413, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1024502', 'n_tokens_mistral': 608, 'n_tokens_neox': 591, 'n_words': 128}