<commit_before>from .chart_component import ChartComponentDict


class Ticks(ChartComponentDict):

    def __init__(self, axis):

        super(Ticks, self).__init__()

        self.axis = axis

    def set_format(self, tick_format):

        if self.axis.axis_dimension == 'x':
            if self.axis.config['type'] == self.__string_wrap__('timeseries'):
                format_str = "d3.time.format({tick_format})"
            else:
                format_str = "d3.format({tick_format})"

        else:
            format_str = "d3.format({tick_format})"

        self.config['format'] = format_str.format(
            tick_format=self.__string_wrap__(tick_format),
        )

    def set_count(self, tick_count):

        self.config['count'] = tick_count

    def set_values(self, tick_values):

        tick_values_str = [str(i) for i in tick_values]

        self.config['values'] = tick_values_str


class XTicks(Ticks):

    def __init__(self, axis):

        super(XTicks, self).__init__(axis)

    def cull(self, max_ticks):

        self.config['culling'] = {
            'max': max_ticks,
        }

    def rotate(self, degrees):

        self.config['rotate'] = degrees

    def set_multiline(self, multiline):

        self.config['multiline'] = str(multiline).lower()

    def set_fit(self, fit):<commit_msg>Fix tick value setting for non-indexed x axes<commit_after>from .chart_component import ChartComponentDict


class Ticks(ChartComponentDict):

    def __init__(self, axis):

        super(Ticks, self).__init__()

        self.axis = axis

    def set_format(self, tick_format):

        if self.axis.axis_dimension == 'x':
            if self.axis.config['type'] == self.__string_wrap__('timeseries'):
                format_str = "d3.time.format({tick_format})"
            else:
                format_str = "d3.format({tick_format})"

        else:
            format_str = "d3.format({tick_format})"

        self.config['format'] = format_str.format(
            tick_format=self.__string_wrap__(tick_format),
        )

    def set_count(self, tick_count):

        self.config['count'] = tick_count

    def set_values(self, tick_values):

        if self.axis.axis_dimension == 'x' and self.axis.config['type'] != self.__string_wrap__('indexed'):
            tick_values = [self.__string_wrap__(i) for i in tick_values]

        self.config['values'] = tick_values


class XTicks(Ticks):

    def __init__(self, axis):

        super(XTicks, self).__init__(axis)

    def cull(self, max_ticks):

        self.config['culling'] = {
            'max': max_ticks,
        }

    def rotate(self, degrees):

        self.config['rotate'] = degrees

    def set_multiline(self, multiline):

        self.config['multiline'] = str(multiline).lower()

    def set_fit(self, fit):
{'fraction_non_alphanumeric': 0.12753829711435696, 'fraction_numerical': 0.0021375133594584966, 'mean_word_length': 2.55893536121673, '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': '2915690', 'n_tokens_mistral': 919, 'n_tokens_neox': 854, 'n_words': 162}