<commit_before>from __future__ import print_function
import sys
import json
from tqdm import tqdm
from .cli_command_wrapper import CLICommandWrapper, CLIUserError
from .command import POW, GenericUserError
from .git_repo import GitRepoProvider


def main():
    p = POW()
    p.message = print
    p.progress_reporter = tqdm
    p.repository_provider = GitRepoProvider()
    try:
        out = CLICommandWrapper(p).main()
    except (CLIUserError, GenericUserError) as e:
        print(e, file=sys.stderr)
    import yarom
    def default(o):
        if isinstance(o, set):
            return list(o)
        else:
            try:
                return dict(o)
            except (ValueError, TypeError):
                try:
                    return list(o)
                except TypeError:
                    raise

            raise TypeError()

    if out is not None:
        json.dump(out, sys.stdout, default=default, indent=2)<commit_msg>Replacing incorrect "default" logic for JSON output in cli.py<commit_after>from __future__ import print_function
import sys
import json
from tqdm import tqdm
from .cli_command_wrapper import CLICommandWrapper, CLIUserError
from .command import POW, GenericUserError
from .git_repo import GitRepoProvider


def main():
    p = POW()
    p.message = print
    p.progress_reporter = tqdm
    p.repository_provider = GitRepoProvider()
    try:
        out = CLICommandWrapper(p).main()
    except (CLIUserError, GenericUserError) as e:
        print(e, file=sys.stderr)
    if out is not None:
        json.dump(out, sys.stdout, default=list, indent=2)
{'fraction_non_alphanumeric': 0.07625, 'fraction_numerical': 0.00125, 'mean_word_length': 2.6221719457013575, 'pattern_counts': {'":': 0, '<': 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': '302000', 'n_tokens_mistral': 477, 'n_tokens_neox': 471, 'n_words': 141}