<commit_before>#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys

from functools import partial

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.patches import Rectangle, Polygon, CirclePolygon
from matplotlib import cm

from jcvi.utils.cbook import human_size
from jcvi.apps.console import ColoredText

# i always like the latex font
_ = lambda x: r"$\mathsf{%s}$" % str(x).replace("_", " ").replace(" ", r"\ ")

# human readable size (Kb, Mb, Gb)
human_size_formatter = ticker.FuncFormatter(lambda x, pos: \
        _(human_size(x, precision=0)))
tex_formatter = ticker.FuncFormatter(lambda x, pos: _(str(int(x))))


def set_tex_axis(ax, formatter=tex_formatter):
    ax.xaxis.set_major_formatter(formatter)
    ax.yaxis.set_major_formatter(formatter)

set_human_axis = partial(set_tex_axis, formatter=human_size_formatter)


def set_format(instance, default="pdf"):
    """
    Add image format options for given command line programs.
    """
    from optparse import OptionParser
    assert isinstance(instance, OptionParser)

    allowed_format = ("emf", "eps", "pdf", "png", "ps", \
                      "raw", "rgba", "svg", "svgz")

    instance.add_option("--format", default=default,<commit_msg>missing choices option in graphics.base.set_format()<commit_after>#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys

from functools import partial

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.patches import Rectangle, Polygon, CirclePolygon
from matplotlib import cm

from jcvi.utils.cbook import human_size
from jcvi.apps.console import ColoredText

# i always like the latex font
_ = lambda x: r"$\mathsf{%s}$" % str(x).replace("_", " ").replace(" ", r"\ ")

# human readable size (Kb, Mb, Gb)
human_size_formatter = ticker.FuncFormatter(lambda x, pos: \
        _(human_size(x, precision=0)))
tex_formatter = ticker.FuncFormatter(lambda x, pos: _(str(int(x))))


def set_tex_axis(ax, formatter=tex_formatter):
    ax.xaxis.set_major_formatter(formatter)
    ax.yaxis.set_major_formatter(formatter)

set_human_axis = partial(set_tex_axis, formatter=human_size_formatter)


def set_format(instance, default="pdf"):
    """
    Add image format options for given command line programs.
    """
    from optparse import OptionParser
    assert isinstance(instance, OptionParser)

    allowed_format = ("emf", "eps", "pdf", "png", "ps", \
                      "raw", "rgba", "svg", "svgz")

    instance.add_option("--format", default=default, choices=allowed_format,
{'fraction_non_alphanumeric': 0.1261053440984237, 'fraction_numerical': 0.0015378700499807767, 'mean_word_length': 4.420833333333333, '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': '1497633', 'n_tokens_mistral': 864, 'n_tokens_neox': 829, 'n_words': 220}