{
    "file_diffs": [
        {
            "old_file_content": "import calendar\nimport re\nimport time\nfrom numbers import Number\nfrom typing import NamedTuple, List, Union, Callable, Optional\nimport datetime\nfrom itertools import count, chain\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange.data import DiscreteVariable, Domain, TimeVariable, Table\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics import distribution, contingency, util as ut\nfrom Orange.statistics.basic_stats import BasicStats\nfrom Orange.util import Reprable, utc_from_timestamp\nfrom .transformation import Transformation\nfrom . import _discretize\n\n__all__ = [\"EqualFreq\", \"EqualWidth\", \"EntropyMDL\", \"DomainDiscretizer\",\n           \"decimal_binnings\", \"time_binnings\", \"short_time_units\",\n           \"BinDefinition\"]\n\n\nclass Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))\n\n\nclass BinSql:\n    def __init__(self, var, points):\n        self.var = var\n        self.points = points\n\n    def __call__(self):\n        return f'width_bucket({self.var.to_sql()}, ' \\\n               f'ARRAY{str(self.points)}::double precision[])'\n\n\nclass SingleValueSql:\n    def __init__(self, value):\n        self.value = value\n\n    def __call__(self):\n        return \"'%s'\" % self.value\n\n\nclass Discretization(Reprable):\n    \"\"\"Abstract base class for discretization classes.\"\"\"\n    def __call__(self, data, variable):\n        \"\"\"\n        Compute discretization of the given variable on the given data.\n        Return a new variable with the appropriate domain\n        (:obj:`Orange.data.DiscreteVariable.values`) and transformer\n        (:obj:`Orange.data.Variable.compute_value`).\n        \"\"\"\n        raise NotImplementedError(\n            \"Subclasses of 'Discretization' need to implement \"\n            \"the call operator\")\n\n\nclass EqualFreq(Discretization):\n    \"\"\"Discretization into bins with approximately equal number of data\n    instances.\n\n    .. attribute:: n\n\n        Number of bins (default: 4). The actual number may be lower if the\n        variable has less than n distinct values.\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    # noinspection PyProtectedMember\n    def __call__(self, data, attribute):\n        if type(data) == SqlTable:\n            att = attribute.to_sql()\n            quantiles = [(i + 1) / self.n for i in range(self.n - 1)]\n            query = data._sql_query(\n                ['quantile(%s, ARRAY%s)' % (att, str(quantiles))],\n                use_time_sample=1000)\n            with data._execute_sql_query(query) as cur:\n                points = sorted(set(cur.fetchone()[0]))\n        else:\n            d = distribution.get_distribution(data, attribute)\n            points = _discretize.split_eq_freq(d, self.n)\n            # np.unique handles cases in which differences are below precision\n            points = list(np.unique(points))\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\nclass EqualWidth(Discretization):\n    \"\"\"Discretization into a fixed number of bins with equal widths.\n\n    .. attribute:: n\n\n        Number of bins (default: 4).\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    # noinspection PyProtectedMember\n    def __call__(self, data: Table, attribute, fixed=None):\n        if fixed:\n            mn, mx = fixed[attribute.name]\n            points = self._split_eq_width(mn, mx)\n        else:\n            if type(data) == SqlTable:\n                stats = BasicStats(data, attribute)\n                points = self._split_eq_width(stats.min, stats.max)\n            else:\n                values = data.get_column(attribute)\n                if values.size:\n                    mn, mx = ut.nanmin(values), ut.nanmax(values)\n                    points = self._split_eq_width(mn, mx)\n                else:\n                    points = []\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\n    def _split_eq_width(self, mn, mx):\n        if np.isnan(mn) or np.isnan(mx) or mn == mx:\n            return []\n        dif = (mx - mn) / self.n\n        return [mn + i * dif for i in range(1, self.n)]\n\n\nclass TooManyIntervals(ValueError):\n    pass\n\n\nclass FixedWidth(Discretization):\n    def __init__(self, width, digits=None):\n        super().__init__()\n        self.width = width\n        self.digits = digits\n\n    def __call__(self, data: Table, attribute):\n        values = data.get_column(attribute)\n        points = []\n        if values.size:\n            mn, mx = ut.nanmin(values), ut.nanmax(values)\n            if not np.isnan(mn):\n                minf = int(1 + np.floor(mn / self.width))\n                maxf = int(1 + np.floor(mx / self.width))\n                if maxf - minf - 1 >= 100:\n                    raise TooManyIntervals\n                points = [i * self.width for i in range(minf, maxf)]\n        return Discretizer.create_discretized_var(\n                    data.domain[attribute], points, ndigits=self.digits)\n\n\nclass FixedTimeWidth(Discretization):\n    def __init__(self, width, unit):\n        # unit: 0=year, 1=month, 2=day, 3=hour, 4=minute, 5=second\n        # for week, use day with a width of 7\n        super().__init__()\n        self.width = width\n        self.unit = unit\n\n    def __call__(self, data: Table, attribute):\n        fmt = [\"%Y\", \"%y %b\", \"%y %b %d\", \"%y %b %d %H:%M\", \"%y %b %d %H:%M\",\n                \"%H:%M:%S\"][self.unit]\n        values = data.get_column(attribute)\n        times = []\n        if values.size:\n            mn, mx = ut.nanmin(values), ut.nanmax(values)\n            if not np.isnan(mn):\n                mn = utc_from_timestamp(mn).timetuple()\n                mx = utc_from_timestamp(mx).timetuple()\n                times = _time_range(mn, mx, self.unit, self.width, 0, 100)\n                if times is None:\n                    raise TooManyIntervals\n        times = [time.struct_time(t + (0, 0, 0)) for t in times][1:-1]\n        points = np.array([calendar.timegm(t) for t in times])\n        values = [time.strftime(fmt, t) for t in times]\n        values = _simplified_time_intervals(values)\n        var = data.domain[attribute]\n        return DiscreteVariable(name=var.name, values=values,\n                                compute_value=Discretizer(var, points),\n                                sparse=var.sparse)\n\n\ndef _simplified_time_intervals(labels):\n    def no_common(a, b):\n        for i, pa, pb in zip(count(), a, b):\n            if pa != pb:\n                if common + i == 2:\n                    i -= 1\n                return b[i:]\n        # can't come here (unless a == b?!)\n        return b  # pragma: no cover\n\n\n    if not labels:\n        return []\n    common = 100\n    labels = [label.split() for label in labels]\n    for common, parts in enumerate(map(set, zip(*labels))):\n        if len(parts) > 1:\n            break\n    if common == 2:  # If we keep days, we must also keep months\n        common = 1\n    labels = [label[common:] for label in labels]\n    join = \" \".join\n    return [f\"< {join(labels[0])}\"] + [\n        f\"{join(low)} - {join(no_common(low, high))}\"\n        for low, high in zip(labels, labels[1:])\n        ] + [f\"≥ {join(labels[-1])}\"]\n\n\n\nclass Binning(Discretization):\n    \"\"\"Discretization with nice thresholds\n\n    This class creates different decimal or time binnings and picks the one\n    in which the number of interval is closest to the desired number.\n    The difference is measured as proportion; e.g. having 30 % less intervals\n    is the same difference as having 30 % too many.\n\n    .. attribute:: n\n\n        Desired number of bins (default: 4).\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    def __call__(self, data: Table, attribute):\n        attribute = data.domain[attribute]\n        values = data.get_column(attribute)\n        values = values.astype(float)\n        if not values.size:\n            return self._create_binned_var(None, attribute)\n\n        var = data.domain[attribute]\n        if isinstance(var, TimeVariable):\n            binnings = time_binnings(values)\n        else:\n            binnings = decimal_binnings(values)\n        return self._create_binned_var(binnings, attribute)\n\n    def _create_binned_var(self, binnings, variable):\n        if not binnings:\n            return Discretizer.create_discretized_var(variable, [])\n\n        # If self.n is 2, require two intervals (one threshold, excluding top\n        # and bottom), else require at least three intervals\n        # ... unless this is the only option, in which case we use it\n        # Break ties in favour of more bins\n        binning = min(\n            (binning for binning in binnings\n             if len(binning.thresholds) - 2 >= 1 + (self.n != 2)),\n            key=lambda binning: (abs(self.n - (len(binning.short_labels) - 1)),\n                                 -len(binning.short_labels)),\n            default=binnings[-1])\n\n        if len(binning.thresholds) == 2:\n            return Discretizer.create_discretized_var(variable, [])\n\n        blabels = binning.labels[1:-1]\n        labels = [f\"< {blabels[0]}\"] + [\n            f\"{lab1} - {lab2}\" for lab1, lab2 in zip(blabels, blabels[1:])\n        ] + [f\"≥ {blabels[-1]}\"]\n\n        discretizer = Discretizer(variable, list(binning.thresholds[1:-1]))\n        dvar = DiscreteVariable(name=variable.name, values=labels,\n                                compute_value=discretizer,\n                                sparse=variable.sparse)\n        dvar.source_variable = variable\n        return dvar\n\n\nclass BinDefinition(NamedTuple):\n    thresholds: np.ndarray  # thresholds, including the top\n    labels: List[str]  # friendly-formatted thresholds\n    short_labels: List[str]  # shorter labels (e.g. simplified dates)\n    width: Union[float, None]  # widths, if uniform; otherwise None\n    width_label: str  # friendly-formatted width (e.g. '50' or '2 weeks')\n\n\n# NamedTupleMeta doesn't allow to define __new__ so we need a subclass\n# Name of the class has to be the same to match the namedtuple name\n# pylint: disable=function-redefined\nclass BinDefinition(BinDefinition):\n    def __new__(cls, thresholds, labels=\"%g\",\n                short_labels=None, width=None, width_label=\"\"):\n\n        def get_labels(fmt, default=None):\n            if fmt is None:\n                return default\n            if isinstance(fmt, str):\n                return [fmt % x for x in thresholds]\n            elif isinstance(fmt, Callable):\n                return [fmt(x) for x in thresholds]\n            else:\n                return fmt\n\n        labels = get_labels(labels)\n        short_labels = get_labels(short_labels, labels)\n        if not width_label and width is not None:\n            width_label = f\"{width:g}\"\n        return super().__new__(\n            cls, thresholds, labels, short_labels, width, width_label)\n\n    @property\n    def start(self) -> float:\n        return self.thresholds[0]\n\n    @property\n    def nbins(self) -> int:\n        return len(self.thresholds) - 1\n\n\ndef decimal_binnings(\n        data, *, min_width=0, min_bins=2, max_bins=50,\n        min_unique=5, add_unique=0,\n        factors=(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20),\n        label_fmt=\"%g\") -> List[BinDefinition]:\n    \"\"\"\n    Find a set of nice splits of data into bins\n\n    The function first computes the scaling factor that is, the power of 10\n    that brings the interval of values within [0, 1]. For instances, if the\n    numbers come from interaval 10004001 and 10007005, the width of the\n    interval is 3004, so the scaling factor is 1000.\n\n    The function next considers bin widths that are products of scaling and\n    different factors from 20 to 0.01 that make sense in decimal scale\n    (see default value for argument `factors`). For each width, it rounds the\n    minimal value down to this width and the maximal value up, and it computes\n    the number of bins of that width that fit between these two values.\n    If the number of bins is between `min_bins` and `max_bins`, and the width\n    is at least `min_width`, this is a valid interval.\n\n    If the data has no more than `min_unique` unique values, the function will\n    add a set of bins that put each value into its own bin.\n\n    If the data has no more than `add_unique` values, that last bins will put\n    each value into its own bin.\n\n    Args:\n        data (np.ndarray):\n            vector of data points; values may repeat, and nans and infs are\n            filtered out.\n        min_width (float): minimal bin width\n        min_bins (int): minimal number of bins\n        max_bins (int):\n            maximal number of bins; the number of bins will never exceed the\n            number of unique values\n        min_unique (int):\n            if the number of unique values are less or equal to `min_unique`,\n            the function returns a single binning that matches that values in\n            the data\n        add_unique (int):\n            similar to `min_unique` except that such bins are added to the list;\n            set to 0 to disable\n        factors (list of float):\n            The factors with which the scaling is multiplied. Default is\n            `(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20)`,\n            so if scaling is 1000, considered bin widths are 20000, 10000,\n            5000, 2000, 1000, 500, 250, 200, 100, 50, 25, 20 and 10.\n        label_fmt (str or Callable):\n            A format string (default: \"%g\") used for threshold labels,\n            or a function for formatting thresholds (e.g. var.str_val)\n\n    Returns:\n        bin_definition (list of BinDefinition):\n            `BinDefinition` is a named tuple containing the beginning of the\n            first bin (`start`), number of bins (`nbins`) and their widths\n            (`width`). The last value can also be a `nd.array` with `nbins + 1`\n            elements, which describes bins of unequal width and is used for\n            binnings that match the unique values in the data (see `min_unique`\n            and `add_unique`).\n    \"\"\"\n    bins = []\n\n    mn, mx, unique = _min_max_unique(data)\n    if len(unique) <= max(min_unique, add_unique):\n        bins.append(BinDefinition(_unique_thresholds(unique), label_fmt))\n        if len(unique) <= min_unique:\n            return bins\n\n    diff = mx - mn\n    f10 = 10 ** -np.floor(np.log10(diff))\n    max_bins = min(max_bins, len(unique))\n    for f in factors:\n        width = f / f10\n        if width < min_width:\n            continue\n        mn_ = np.floor(mn / width) * width\n        mx_ = np.ceil(mx / width) * width\n        nbins = np.round((mx_ - mn_) / width)\n        if min_bins <= nbins <= max_bins \\\n                and (not bins or bins[-1].nbins != nbins):\n            bins_ = mn_ + width * np.arange(nbins + 1)\n            # to prevent values on the edge of the bin fall in the wrong bin\n            # due to precision error on decimals that are not precise\n            bins_ = np.around(bins_, decimals=np.finfo(bins_.dtype).precision)\n            bin_def = BinDefinition(bins_, label_fmt, None, width)\n            bins.append(bin_def)\n    return bins\n\n\ndef time_binnings(data, *, min_bins=2, max_bins=50, min_unique=5, add_unique=0\n                  ) -> List[BinDefinition]:\n    \"\"\"\n    Find a set of nice splits of time variable data into bins\n\n    The function considers bin widths of\n\n    - 1, 5, 10, 15, 30 seconds.\n    - 1, 5, 10, 15, 30 minutes,\n    - 1, 2, 3, 6, 12 hours,\n    - 1 day,\n    - 1, 2 weeks,\n    - 1, 2, 3, 6 months,\n    - 1, 2, 5, 10, 25, 50, 100 years,\n\n    and returns those that yield between `min_bins` and `max_bins` intervals.\n\n    Args:\n        data (np.ndarray):\n            vector of data points; values may repeat, and nans and infs are\n            filtered out.\n        min_bins (int): minimal number of bins\n        max_bins (int):\n            maximal number of bins; the number of bins will never exceed the\n            number of unique values\n\n    Returns:\n        bin_boundaries (list of BinDefinition): a list of possible binning.\n            Each element of `bin_boundaries` is a tuple consisting of a label\n            describing the bin size (e.g. `2 weeks`) and a list of thresholds.\n            Thresholds are given as pairs\n            (number_of_seconds_since_epoch, label).\n    \"\"\"\n    mn, mx, unique = _min_max_unique(data)\n    mn = utc_from_timestamp(mn).timetuple()\n    mx = utc_from_timestamp(mx).timetuple()\n    bins = []\n    if len(unique) <= max(min_unique, add_unique):\n        bins.append(_unique_time_bins(unique))\n    if len(unique) > min_unique:\n        bins += _time_binnings(mn, mx, min_bins + 1, max_bins + 1)\n    return bins\n\n\ndef _time_binnings(mn, mx, min_pts, max_pts):\n    bins = []\n    for place, step, fmt, unit in (\n            [(5, x, \"%H:%M:%S\", \"second\") for x in (1, 5, 10, 15, 30)] +\n            [(4, x, \"%b %d %H:%M\", \"minute\") for x in (1, 5, 10, 15, 30)] +\n            [(3, x, \"%y %b %d %H:%M\", \"hour\") for x in (1, 2, 3, 6, 12)] +\n            [(2, 1, \"%y %b %d\", \"day\")] +\n            [(2, x, \"%y %b %d\", \"week\") for x in (7, 14)] +\n            [(1, x, \"%y %b\", \"month\") for x in (1, 2, 3, 6)] +\n            [(0, x, \"%Y\", \"year\") for x in (1, 2, 5, 10, 25, 50, 100)]):\n        times = _time_range(mn, mx, place, step, min_pts, max_pts)\n        if not times:\n            continue\n        times = [time.struct_time(t + (0, 0, 0)) for t in times]\n        thresholds = np.array([calendar.timegm(t) for t in times])\n        labels = [time.strftime(fmt, t) for t in times]\n        short_labels = _simplified_labels(labels)\n        if place == 2 and step >= 7:\n            unit_label = f\"{step // 7} week{'s' * (step > 7)}\"\n        else:\n            unit_label = f\"{step} {unit}{'s' * (step > 1)}\"\n        new_bins = BinDefinition(\n            thresholds, labels, short_labels, None, unit_label)\n        if not bins or new_bins.nbins != bins[-1].nbins:\n            bins.append(new_bins)\n    return bins\n\n\n# datetime + deltatime is not very useful here because deltatime is\n# given a number of days, not years or months, so it doesn't allow\n# for specifying a step of 1 month\ndef _time_range(start, end, place, step, min_pts, max_pts,\n                _zeros=(0, 1, 1, 0, 0, 0)):\n    if place == 2 and step % 7 == 0:\n        startd = datetime.date(*start[:3])\n        startd -= datetime.timedelta(days=-startd.weekday())\n        start = [startd.year, startd.month, startd.day, 0, 0, 0]\n    else:\n        start = list(\n            start[:place]\n            + ((start[place] - _zeros[place]) // step * step + _zeros[place], )\n            + _zeros[place + 1:])\n    end = list(end[:place + 1] + _zeros[place + 1:])\n    s = [tuple(start)]\n    for _ in range(max_pts - 1):\n        start[place] += step\n        if place >= 3:  # hours, minutes, seconds\n            for pos, maxval in enumerate((60, 60, 24), start=1):\n                if start[-pos] >= maxval:\n                    start[-pos - 1] += 1\n                    start[-pos] %= maxval\n        if place >= 2:\n            md = _month_days(*start[:2])\n            if start[2] > md:\n                start[1] += 1\n                start[2] %= md\n        if start[1] > 12:\n            start[0] += 1\n            start[1] %= 12\n        s.append(tuple(start))\n        if start > end:\n            return s if len(s) >= min_pts else None\n    return None\n\n\ndef _month_days(year, month,\n                _md=(None, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)):\n    return _md[month] + (\n        month == 2 and (year % 400 == 0 or year % 4 == 0 and year % 100 != 0))\n\n\ndef _simplified_labels(labels):\n    labels = labels[:]\n    to_remove = \"42\"\n    while True:\n        firsts = {f for f, *_ in (lab.split() for lab in labels)}\n        if len(firsts) != 1:  # can be 0 if there are no labels\n            break\n        to_remove = firsts.pop()\n        flen = len(to_remove)\n        if any(len(lab) == flen for lab in labels):\n            break\n        labels = [lab[flen+1:] for lab in labels]\n    for i in range(len(labels) - 1, 0, -1):\n        for k, c, d in zip(count(), labels[i].split(), labels[i - 1].split()):\n            if c != d:\n                labels[i] = \" \".join(labels[i].split()[k:])\n                break\n    # If the last thing removed were month names and the labels continues with\n    # hours, keep month name in the first label; \"08 12:29\" looks awkward.\n    if not to_remove[0].isdigit() and \":\" in labels[0]:\n        labels[0] = f\"{to_remove} {labels[0]}\"\n    return labels\n\n\ndef _unique_time_bins(unique):\n    times = [utc_from_timestamp(x).timetuple() for x in unique]\n    fmt = f'%y %b %d'\n    fmt += \" %H:%M\" * (len({t[2:] for t in times}) > 1)\n    fmt += \":%S\" * bool(np.all(unique % 60 == 0))\n    labels = [time.strftime(fmt, x) for x in times]\n    short_labels = _simplified_labels(labels)\n    return BinDefinition(_unique_thresholds(unique), labels, short_labels)\n\n\ndef _unique_thresholds(unique):\n    if len(unique) >= 2:\n        # make the last bin the same width as the one before\n        last_boundary = 2 * unique[-1] - unique[-2]\n    else:\n        last_boundary = unique[0] + 1\n    return np.hstack((unique, [last_boundary]))\n\n\ndef _min_max_unique(data):\n    unique = np.unique(data)\n    unique = unique[np.isfinite(unique)]\n    if not unique.size:\n        raise ValueError(\"no valid (non-nan) data\")\n    return unique[0], unique[-1], unique\n\n\nshort_time_units = dict(seconds=\"sec\", minutes=\"min\", hours=\"hrs\",\n                        weeks=\"wks\", months=\"mon\", years=\"yrs\",\n                        second=\"sec\", minute=\"min\", month=\"mon\")\n\n\n# noinspection PyPep8Naming\nclass EntropyMDL(Discretization):\n    \"\"\"\n    Discretization into bins inferred by recursively splitting the values to\n    minimize the class-entropy. The procedure stops when further splits would\n    decrease the entropy for less than the corresponding increase of minimal\n    description length (MDL). [FayyadIrani93].\n\n    If there are no suitable cut-off points, the procedure returns a single bin,\n    which means that the new feature is constant and can be removed.\n\n    .. attribute:: force\n\n        Induce at least one cut-off point, even when its information\n        gain is lower than MDL (default: False).\n\n    \"\"\"\n    def __init__(self, force=False):\n        self.force = force\n\n    def __call__(self, data, attribute):\n        cont = contingency.get_contingency(data, attribute)\n        values, I = cont.values, cont.counts.T\n        cut_ind = np.array(self._entropy_discretize_sorted(I, self.force))\n        if len(cut_ind) > 0:\n            # \"the midpoint between each successive pair of examples\" (FI p.1)\n            points = (values[cut_ind] + values[cut_ind - 1]) / 2.\n        else:\n            points = []\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\n    @classmethod\n    def _normalize(cls,\n                   X: Union[List[List[Number]], np.ndarray],\n                   axis: Optional[int] = None,\n                   out: Optional[np.ndarray] = None) -> np.ndarray:\n        \"\"\"\n        Normalize `X` array so it sums to 1.0 over the `axis`.\n\n        Parameters\n        ----------\n        X : array\n            Array to normalize.\n        axis : optional int\n            Axis over which the resulting array sums to 1.\n        out : optional array\n            Output array of the same shape as X.\n        \"\"\"\n        X = np.asarray(X, dtype=float)\n        scale = np.sum(X, axis=axis, keepdims=True)\n        scale[scale == 0] = 1\n        if out is None:\n            return X / scale\n        else:\n            if out is not X:\n                assert out.shape == X.shape\n                out[:] = X\n            out /= scale\n            return out\n\n    @classmethod\n    def _entropy_normalized(cls, D, axis=None):\n        \"\"\"\n        Compute the entropy of distribution array `D`.\n\n        `D` must be a distribution (i.e. sum to 1.0 over `axis`)\n\n        Parameters\n        ----------\n        D : array\n            Distribution.\n        axis : optional int\n            Axis of `D` along which to compute the entropy.\n\n        \"\"\"\n        # req: (np.sum(D, axis=axis) >= 0).all()\n        # req: (np.sum(D, axis=axis) <= 1).all()\n        # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9)\n\n        D = np.asarray(D)\n        if np.sum(D) == 0:\n            return 0\n        Dc = np.clip(D, np.finfo(D.dtype).eps, 1.0)\n        return - np.sum(D * np.log2(Dc), axis=axis)\n\n    @classmethod\n    def _entropy(cls, D, axis=None):\n        \"\"\"\n        Compute the entropy of distribution `D`.\n\n        Parameters\n        ----------\n        D : array\n            Distribution.\n        axis : optional int\n            Axis of `D` along which to compute the entropy.\n\n        \"\"\"\n        D = cls._normalize(D, axis=axis)\n        return cls._entropy_normalized(D, axis=axis)\n\n    @classmethod\n    def _entropy1(cls, D):\n        \"\"\"\n        Compute the entropy of distributions in `D`\n        (one per each row).\n        \"\"\"\n        D = cls._normalize(D)\n        return _discretize.entropy_normalized1(D)\n\n    @classmethod\n    def _entropy2(cls, D):\n        \"\"\"\n        Compute the entropy of distributions in `D`\n        (one per each row).\n        \"\"\"\n        D = cls._normalize(D, axis=1)\n        return _discretize.entropy_normalized2(D)\n\n    @classmethod\n    def _entropy_cuts_sorted(cls, CS):\n        \"\"\"\n        Return the class information entropy induced by partitioning\n        the `CS` distribution at all N-1 candidate cut points.\n\n        Parameters\n        ----------\n        CS : (N, K) array of class distributions.\n        \"\"\"\n        CS = np.asarray(CS)\n        # |--|-------|--------|\n        #  S1    ^       S2\n        # S1 contains all points which are <= to cut point\n        # Cumulative distributions for S1 and S2 (left right set)\n        # i.e. a cut at index i separates the CS into S1Dist[i] and S2Dist[i]\n        S1Dist = np.cumsum(CS, axis=0)[:-1]\n        S2Dist = np.cumsum(CS[::-1], axis=0)[-2::-1]\n\n        # Entropy of S1[i] and S2[i] sets\n        ES1 = cls._entropy2(S1Dist)\n        ES2 = cls._entropy2(S2Dist)\n\n        # Number of cases in S1[i] and S2[i] sets\n        S1_count = np.sum(S1Dist, axis=1)\n        S2_count = np.sum(S2Dist, axis=1)\n\n        # Number of all cases\n        S_count = np.sum(CS)\n\n        ES1w = ES1 * S1_count / S_count\n        ES2w = ES2 * S2_count / S_count\n\n        # E(A, T; S) Class information entropy of the partition S\n        E = ES1w + ES2w\n\n        return E, ES1, ES2\n\n    @classmethod\n    def _entropy_discretize_sorted(cls, C, force=False):\n        \"\"\"\n        Entropy discretization on a sorted C.\n\n        :param C: (N, K) array of class distributions.\n\n        \"\"\"\n        E, ES1, ES2 = cls._entropy_cuts_sorted(C)\n        # TODO: Also get the left right distribution counts from\n        # entropy_cuts_sorted,\n\n        # Note the + 1\n        if len(E) == 0:\n            return []\n        cut_index = np.argmin(E) + 1\n\n        # Distribution of classed in S1, S2 and S\n        S1_c = np.sum(C[:cut_index], axis=0)\n        S2_c = np.sum(C[cut_index:], axis=0)\n        S_c = S1_c + S2_c\n\n        ES = cls._entropy1(np.sum(C, axis=0))\n        ES1, ES2 = ES1[cut_index - 1], ES2[cut_index - 1]\n\n        # Information gain of the best split\n        Gain = ES - E[cut_index - 1]\n        # Number of different classes in S, S1 and S2\n        k = float(np.sum(S_c > 0))\n        k1 = float(np.sum(S1_c > 0))\n        k2 = float(np.sum(S2_c > 0))\n\n        assert k > 0\n        delta = np.log2(3 ** k - 2) - (k * ES - k1 * ES1 - k2 * ES2)\n        N = float(np.sum(S_c))\n\n        if N > 1 and Gain > np.log2(N - 1) / N + delta / N:\n            # Accept the cut point and recursively split the subsets.\n            left, right = [], []\n            if k1 > 1 and cut_index > 1:\n                left = cls._entropy_discretize_sorted(C[:cut_index, :])\n            if k2 > 1 and cut_index < len(C) - 1:\n                right = cls._entropy_discretize_sorted(C[cut_index:, :])\n            return left + [cut_index] + [i + cut_index for i in right]\n        elif force:\n            return [cut_index]\n        else:\n            return []\n\n\nclass DomainDiscretizer(Reprable):\n    \"\"\"Discretizes all continuous features in the data.\n\n    .. attribute:: method\n\n        Feature discretization method (instance of\n        :obj:`Orange.preprocess.Discretization`). If `None` (default),\n        :class:`Orange.preprocess.EqualFreq` with 4 intervals is\n        used.\n\n    .. attribute:: clean\n\n        If `True`, features discretized into a single interval constant are\n        removed. This is useful for discretization methods that infer the\n        number of intervals from the data, such as\n        :class:`Orange.preprocess.EntropyMDL` (default: `True`).\n\n    .. attribute:: discretize_class\n\n        Determines whether a target is also discretized if it is continuous.\n        (default: `False`)\n    \"\"\"\n    def __init__(self, discretize_class=False, method=None, clean=True,\n                 fixed=None):\n        self.discretize_class = discretize_class\n        self.method = method\n        self.clean = clean\n        self.fixed = fixed\n\n    def __call__(self, data, fixed=None):\n        \"\"\"\n        Compute and return discretized domain.\n\n        :param data: Data to discretize.\n        \"\"\"\n\n        def transform_list(s, fixed=None):\n            new_vars = []\n            for var in s:\n                if var.is_continuous:\n                    if fixed and var.name in fixed.keys():\n                        nv = method(data, var, fixed)\n                    else:\n                        nv = method(data, var)\n                    if not self.clean or len(nv.values) > 1:\n                        new_vars.append(nv)\n                else:\n                    new_vars.append(var)\n            return new_vars\n        if self.method is None:\n            method = EqualFreq(n=4)\n        else:\n            method = self.method\n        domain = data.domain\n        new_attrs = transform_list(domain.attributes, fixed or self.fixed)\n        if self.discretize_class:\n            new_classes = transform_list(domain.class_vars)\n        else:\n            new_classes = domain.class_vars\n        return Domain(new_attrs, new_classes)\n",
            "new_file_content": "import calendar\nimport re\nimport time\nfrom numbers import Number\nfrom typing import NamedTuple, List, Union, Callable, Optional\nimport datetime\nfrom itertools import count, chain\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange.data import DiscreteVariable, Domain, TimeVariable, Table\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics import distribution, contingency, util as ut\nfrom Orange.statistics.basic_stats import BasicStats\nfrom Orange.util import Reprable, utc_from_timestamp\nfrom .transformation import Transformation\nfrom . import _discretize\n\n__all__ = [\"EqualFreq\", \"EqualWidth\", \"EntropyMDL\", \"DomainDiscretizer\",\n           \"decimal_binnings\", \"time_binnings\", \"short_time_units\",\n           \"BinDefinition\"]\n\n\nclass Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:  # points would create identical formatted thresholds\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            # ensure that builtin round is used for compatibility with float formatting\n            # de-numpyize points p (otherwise np.floats use numpy's round)\n            npoints = [round(float(p), digits) for p in points]\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))\n\n\nclass BinSql:\n    def __init__(self, var, points):\n        self.var = var\n        self.points = points\n\n    def __call__(self):\n        return f'width_bucket({self.var.to_sql()}, ' \\\n               f'ARRAY{str(self.points)}::double precision[])'\n\n\nclass SingleValueSql:\n    def __init__(self, value):\n        self.value = value\n\n    def __call__(self):\n        return \"'%s'\" % self.value\n\n\nclass Discretization(Reprable):\n    \"\"\"Abstract base class for discretization classes.\"\"\"\n    def __call__(self, data, variable):\n        \"\"\"\n        Compute discretization of the given variable on the given data.\n        Return a new variable with the appropriate domain\n        (:obj:`Orange.data.DiscreteVariable.values`) and transformer\n        (:obj:`Orange.data.Variable.compute_value`).\n        \"\"\"\n        raise NotImplementedError(\n            \"Subclasses of 'Discretization' need to implement \"\n            \"the call operator\")\n\n\nclass EqualFreq(Discretization):\n    \"\"\"Discretization into bins with approximately equal number of data\n    instances.\n\n    .. attribute:: n\n\n        Number of bins (default: 4). The actual number may be lower if the\n        variable has less than n distinct values.\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    # noinspection PyProtectedMember\n    def __call__(self, data, attribute):\n        if type(data) == SqlTable:\n            att = attribute.to_sql()\n            quantiles = [(i + 1) / self.n for i in range(self.n - 1)]\n            query = data._sql_query(\n                ['quantile(%s, ARRAY%s)' % (att, str(quantiles))],\n                use_time_sample=1000)\n            with data._execute_sql_query(query) as cur:\n                points = sorted(set(cur.fetchone()[0]))\n        else:\n            d = distribution.get_distribution(data, attribute)\n            points = _discretize.split_eq_freq(d, self.n)\n            # np.unique handles cases in which differences are below precision\n            points = list(np.unique(points))\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\nclass EqualWidth(Discretization):\n    \"\"\"Discretization into a fixed number of bins with equal widths.\n\n    .. attribute:: n\n\n        Number of bins (default: 4).\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    # noinspection PyProtectedMember\n    def __call__(self, data: Table, attribute, fixed=None):\n        if fixed:\n            mn, mx = fixed[attribute.name]\n            points = self._split_eq_width(mn, mx)\n        else:\n            if type(data) == SqlTable:\n                stats = BasicStats(data, attribute)\n                points = self._split_eq_width(stats.min, stats.max)\n            else:\n                values = data.get_column(attribute)\n                if values.size:\n                    mn, mx = ut.nanmin(values), ut.nanmax(values)\n                    points = self._split_eq_width(mn, mx)\n                else:\n                    points = []\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\n    def _split_eq_width(self, mn, mx):\n        if np.isnan(mn) or np.isnan(mx) or mn == mx:\n            return []\n        dif = (mx - mn) / self.n\n        return [mn + i * dif for i in range(1, self.n)]\n\n\nclass TooManyIntervals(ValueError):\n    pass\n\n\nclass FixedWidth(Discretization):\n    def __init__(self, width, digits=None):\n        super().__init__()\n        self.width = width\n        self.digits = digits\n\n    def __call__(self, data: Table, attribute):\n        values = data.get_column(attribute)\n        points = []\n        if values.size:\n            mn, mx = ut.nanmin(values), ut.nanmax(values)\n            if not np.isnan(mn):\n                minf = int(1 + np.floor(mn / self.width))\n                maxf = int(1 + np.floor(mx / self.width))\n                if maxf - minf - 1 >= 100:\n                    raise TooManyIntervals\n                points = [i * self.width for i in range(minf, maxf)]\n        return Discretizer.create_discretized_var(\n                    data.domain[attribute], points, ndigits=self.digits)\n\n\nclass FixedTimeWidth(Discretization):\n    def __init__(self, width, unit):\n        # unit: 0=year, 1=month, 2=day, 3=hour, 4=minute, 5=second\n        # for week, use day with a width of 7\n        super().__init__()\n        self.width = width\n        self.unit = unit\n\n    def __call__(self, data: Table, attribute):\n        fmt = [\"%Y\", \"%y %b\", \"%y %b %d\", \"%y %b %d %H:%M\", \"%y %b %d %H:%M\",\n                \"%H:%M:%S\"][self.unit]\n        values = data.get_column(attribute)\n        times = []\n        if values.size:\n            mn, mx = ut.nanmin(values), ut.nanmax(values)\n            if not np.isnan(mn):\n                mn = utc_from_timestamp(mn).timetuple()\n                mx = utc_from_timestamp(mx).timetuple()\n                times = _time_range(mn, mx, self.unit, self.width, 0, 100)\n                if times is None:\n                    raise TooManyIntervals\n        times = [time.struct_time(t + (0, 0, 0)) for t in times][1:-1]\n        points = np.array([calendar.timegm(t) for t in times])\n        values = [time.strftime(fmt, t) for t in times]\n        values = _simplified_time_intervals(values)\n        var = data.domain[attribute]\n        return DiscreteVariable(name=var.name, values=values,\n                                compute_value=Discretizer(var, points),\n                                sparse=var.sparse)\n\n\ndef _simplified_time_intervals(labels):\n    def no_common(a, b):\n        for i, pa, pb in zip(count(), a, b):\n            if pa != pb:\n                if common + i == 2:\n                    i -= 1\n                return b[i:]\n        # can't come here (unless a == b?!)\n        return b  # pragma: no cover\n\n\n    if not labels:\n        return []\n    common = 100\n    labels = [label.split() for label in labels]\n    for common, parts in enumerate(map(set, zip(*labels))):\n        if len(parts) > 1:\n            break\n    if common == 2:  # If we keep days, we must also keep months\n        common = 1\n    labels = [label[common:] for label in labels]\n    join = \" \".join\n    return [f\"< {join(labels[0])}\"] + [\n        f\"{join(low)} - {join(no_common(low, high))}\"\n        for low, high in zip(labels, labels[1:])\n        ] + [f\"≥ {join(labels[-1])}\"]\n\n\n\nclass Binning(Discretization):\n    \"\"\"Discretization with nice thresholds\n\n    This class creates different decimal or time binnings and picks the one\n    in which the number of interval is closest to the desired number.\n    The difference is measured as proportion; e.g. having 30 % less intervals\n    is the same difference as having 30 % too many.\n\n    .. attribute:: n\n\n        Desired number of bins (default: 4).\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    def __call__(self, data: Table, attribute):\n        attribute = data.domain[attribute]\n        values = data.get_column(attribute)\n        values = values.astype(float)\n        if not values.size:\n            return self._create_binned_var(None, attribute)\n\n        var = data.domain[attribute]\n        if isinstance(var, TimeVariable):\n            binnings = time_binnings(values)\n        else:\n            binnings = decimal_binnings(values)\n        return self._create_binned_var(binnings, attribute)\n\n    def _create_binned_var(self, binnings, variable):\n        if not binnings:\n            return Discretizer.create_discretized_var(variable, [])\n\n        # If self.n is 2, require two intervals (one threshold, excluding top\n        # and bottom), else require at least three intervals\n        # ... unless this is the only option, in which case we use it\n        # Break ties in favour of more bins\n        binning = min(\n            (binning for binning in binnings\n             if len(binning.thresholds) - 2 >= 1 + (self.n != 2)),\n            key=lambda binning: (abs(self.n - (len(binning.short_labels) - 1)),\n                                 -len(binning.short_labels)),\n            default=binnings[-1])\n\n        if len(binning.thresholds) == 2:\n            return Discretizer.create_discretized_var(variable, [])\n\n        blabels = binning.labels[1:-1]\n        labels = [f\"< {blabels[0]}\"] + [\n            f\"{lab1} - {lab2}\" for lab1, lab2 in zip(blabels, blabels[1:])\n        ] + [f\"≥ {blabels[-1]}\"]\n\n        discretizer = Discretizer(variable, list(binning.thresholds[1:-1]))\n        dvar = DiscreteVariable(name=variable.name, values=labels,\n                                compute_value=discretizer,\n                                sparse=variable.sparse)\n        dvar.source_variable = variable\n        return dvar\n\n\nclass BinDefinition(NamedTuple):\n    thresholds: np.ndarray  # thresholds, including the top\n    labels: List[str]  # friendly-formatted thresholds\n    short_labels: List[str]  # shorter labels (e.g. simplified dates)\n    width: Union[float, None]  # widths, if uniform; otherwise None\n    width_label: str  # friendly-formatted width (e.g. '50' or '2 weeks')\n\n\n# NamedTupleMeta doesn't allow to define __new__ so we need a subclass\n# Name of the class has to be the same to match the namedtuple name\n# pylint: disable=function-redefined\nclass BinDefinition(BinDefinition):\n    def __new__(cls, thresholds, labels=\"%g\",\n                short_labels=None, width=None, width_label=\"\"):\n\n        def get_labels(fmt, default=None):\n            if fmt is None:\n                return default\n            if isinstance(fmt, str):\n                return [fmt % x for x in thresholds]\n            elif isinstance(fmt, Callable):\n                return [fmt(x) for x in thresholds]\n            else:\n                return fmt\n\n        labels = get_labels(labels)\n        short_labels = get_labels(short_labels, labels)\n        if not width_label and width is not None:\n            width_label = f\"{width:g}\"\n        return super().__new__(\n            cls, thresholds, labels, short_labels, width, width_label)\n\n    @property\n    def start(self) -> float:\n        return self.thresholds[0]\n\n    @property\n    def nbins(self) -> int:\n        return len(self.thresholds) - 1\n\n\ndef decimal_binnings(\n        data, *, min_width=0, min_bins=2, max_bins=50,\n        min_unique=5, add_unique=0,\n        factors=(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20),\n        label_fmt=\"%g\") -> List[BinDefinition]:\n    \"\"\"\n    Find a set of nice splits of data into bins\n\n    The function first computes the scaling factor that is, the power of 10\n    that brings the interval of values within [0, 1]. For instances, if the\n    numbers come from interaval 10004001 and 10007005, the width of the\n    interval is 3004, so the scaling factor is 1000.\n\n    The function next considers bin widths that are products of scaling and\n    different factors from 20 to 0.01 that make sense in decimal scale\n    (see default value for argument `factors`). For each width, it rounds the\n    minimal value down to this width and the maximal value up, and it computes\n    the number of bins of that width that fit between these two values.\n    If the number of bins is between `min_bins` and `max_bins`, and the width\n    is at least `min_width`, this is a valid interval.\n\n    If the data has no more than `min_unique` unique values, the function will\n    add a set of bins that put each value into its own bin.\n\n    If the data has no more than `add_unique` values, that last bins will put\n    each value into its own bin.\n\n    Args:\n        data (np.ndarray):\n            vector of data points; values may repeat, and nans and infs are\n            filtered out.\n        min_width (float): minimal bin width\n        min_bins (int): minimal number of bins\n        max_bins (int):\n            maximal number of bins; the number of bins will never exceed the\n            number of unique values\n        min_unique (int):\n            if the number of unique values are less or equal to `min_unique`,\n            the function returns a single binning that matches that values in\n            the data\n        add_unique (int):\n            similar to `min_unique` except that such bins are added to the list;\n            set to 0 to disable\n        factors (list of float):\n            The factors with which the scaling is multiplied. Default is\n            `(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20)`,\n            so if scaling is 1000, considered bin widths are 20000, 10000,\n            5000, 2000, 1000, 500, 250, 200, 100, 50, 25, 20 and 10.\n        label_fmt (str or Callable):\n            A format string (default: \"%g\") used for threshold labels,\n            or a function for formatting thresholds (e.g. var.str_val)\n\n    Returns:\n        bin_definition (list of BinDefinition):\n            `BinDefinition` is a named tuple containing the beginning of the\n            first bin (`start`), number of bins (`nbins`) and their widths\n            (`width`). The last value can also be a `nd.array` with `nbins + 1`\n            elements, which describes bins of unequal width and is used for\n            binnings that match the unique values in the data (see `min_unique`\n            and `add_unique`).\n    \"\"\"\n    bins = []\n\n    mn, mx, unique = _min_max_unique(data)\n    if len(unique) <= max(min_unique, add_unique):\n        bins.append(BinDefinition(_unique_thresholds(unique), label_fmt))\n        if len(unique) <= min_unique:\n            return bins\n\n    diff = mx - mn\n    f10 = 10 ** -np.floor(np.log10(diff))\n    max_bins = min(max_bins, len(unique))\n    for f in factors:\n        width = f / f10\n        if width < min_width:\n            continue\n        mn_ = np.floor(mn / width) * width\n        mx_ = np.ceil(mx / width) * width\n        nbins = np.round((mx_ - mn_) / width)\n        if min_bins <= nbins <= max_bins \\\n                and (not bins or bins[-1].nbins != nbins):\n            bins_ = mn_ + width * np.arange(nbins + 1)\n            # to prevent values on the edge of the bin fall in the wrong bin\n            # due to precision error on decimals that are not precise\n            bins_ = np.around(bins_, decimals=np.finfo(bins_.dtype).precision)\n            bin_def = BinDefinition(bins_, label_fmt, None, width)\n            bins.append(bin_def)\n    return bins\n\n\ndef time_binnings(data, *, min_bins=2, max_bins=50, min_unique=5, add_unique=0\n                  ) -> List[BinDefinition]:\n    \"\"\"\n    Find a set of nice splits of time variable data into bins\n\n    The function considers bin widths of\n\n    - 1, 5, 10, 15, 30 seconds.\n    - 1, 5, 10, 15, 30 minutes,\n    - 1, 2, 3, 6, 12 hours,\n    - 1 day,\n    - 1, 2 weeks,\n    - 1, 2, 3, 6 months,\n    - 1, 2, 5, 10, 25, 50, 100 years,\n\n    and returns those that yield between `min_bins` and `max_bins` intervals.\n\n    Args:\n        data (np.ndarray):\n            vector of data points; values may repeat, and nans and infs are\n            filtered out.\n        min_bins (int): minimal number of bins\n        max_bins (int):\n            maximal number of bins; the number of bins will never exceed the\n            number of unique values\n\n    Returns:\n        bin_boundaries (list of BinDefinition): a list of possible binning.\n            Each element of `bin_boundaries` is a tuple consisting of a label\n            describing the bin size (e.g. `2 weeks`) and a list of thresholds.\n            Thresholds are given as pairs\n            (number_of_seconds_since_epoch, label).\n    \"\"\"\n    mn, mx, unique = _min_max_unique(data)\n    mn = utc_from_timestamp(mn).timetuple()\n    mx = utc_from_timestamp(mx).timetuple()\n    bins = []\n    if len(unique) <= max(min_unique, add_unique):\n        bins.append(_unique_time_bins(unique))\n    if len(unique) > min_unique:\n        bins += _time_binnings(mn, mx, min_bins + 1, max_bins + 1)\n    return bins\n\n\ndef _time_binnings(mn, mx, min_pts, max_pts):\n    bins = []\n    for place, step, fmt, unit in (\n            [(5, x, \"%H:%M:%S\", \"second\") for x in (1, 5, 10, 15, 30)] +\n            [(4, x, \"%b %d %H:%M\", \"minute\") for x in (1, 5, 10, 15, 30)] +\n            [(3, x, \"%y %b %d %H:%M\", \"hour\") for x in (1, 2, 3, 6, 12)] +\n            [(2, 1, \"%y %b %d\", \"day\")] +\n            [(2, x, \"%y %b %d\", \"week\") for x in (7, 14)] +\n            [(1, x, \"%y %b\", \"month\") for x in (1, 2, 3, 6)] +\n            [(0, x, \"%Y\", \"year\") for x in (1, 2, 5, 10, 25, 50, 100)]):\n        times = _time_range(mn, mx, place, step, min_pts, max_pts)\n        if not times:\n            continue\n        times = [time.struct_time(t + (0, 0, 0)) for t in times]\n        thresholds = np.array([calendar.timegm(t) for t in times])\n        labels = [time.strftime(fmt, t) for t in times]\n        short_labels = _simplified_labels(labels)\n        if place == 2 and step >= 7:\n            unit_label = f\"{step // 7} week{'s' * (step > 7)}\"\n        else:\n            unit_label = f\"{step} {unit}{'s' * (step > 1)}\"\n        new_bins = BinDefinition(\n            thresholds, labels, short_labels, None, unit_label)\n        if not bins or new_bins.nbins != bins[-1].nbins:\n            bins.append(new_bins)\n    return bins\n\n\n# datetime + deltatime is not very useful here because deltatime is\n# given a number of days, not years or months, so it doesn't allow\n# for specifying a step of 1 month\ndef _time_range(start, end, place, step, min_pts, max_pts,\n                _zeros=(0, 1, 1, 0, 0, 0)):\n    if place == 2 and step % 7 == 0:\n        startd = datetime.date(*start[:3])\n        startd -= datetime.timedelta(days=-startd.weekday())\n        start = [startd.year, startd.month, startd.day, 0, 0, 0]\n    else:\n        start = list(\n            start[:place]\n            + ((start[place] - _zeros[place]) // step * step + _zeros[place], )\n            + _zeros[place + 1:])\n    end = list(end[:place + 1] + _zeros[place + 1:])\n    s = [tuple(start)]\n    for _ in range(max_pts - 1):\n        start[place] += step\n        if place >= 3:  # hours, minutes, seconds\n            for pos, maxval in enumerate((60, 60, 24), start=1):\n                if start[-pos] >= maxval:\n                    start[-pos - 1] += 1\n                    start[-pos] %= maxval\n        if place >= 2:\n            md = _month_days(*start[:2])\n            if start[2] > md:\n                start[1] += 1\n                start[2] %= md\n        if start[1] > 12:\n            start[0] += 1\n            start[1] %= 12\n        s.append(tuple(start))\n        if start > end:\n            return s if len(s) >= min_pts else None\n    return None\n\n\ndef _month_days(year, month,\n                _md=(None, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)):\n    return _md[month] + (\n        month == 2 and (year % 400 == 0 or year % 4 == 0 and year % 100 != 0))\n\n\ndef _simplified_labels(labels):\n    labels = labels[:]\n    to_remove = \"42\"\n    while True:\n        firsts = {f for f, *_ in (lab.split() for lab in labels)}\n        if len(firsts) != 1:  # can be 0 if there are no labels\n            break\n        to_remove = firsts.pop()\n        flen = len(to_remove)\n        if any(len(lab) == flen for lab in labels):\n            break\n        labels = [lab[flen+1:] for lab in labels]\n    for i in range(len(labels) - 1, 0, -1):\n        for k, c, d in zip(count(), labels[i].split(), labels[i - 1].split()):\n            if c != d:\n                labels[i] = \" \".join(labels[i].split()[k:])\n                break\n    # If the last thing removed were month names and the labels continues with\n    # hours, keep month name in the first label; \"08 12:29\" looks awkward.\n    if not to_remove[0].isdigit() and \":\" in labels[0]:\n        labels[0] = f\"{to_remove} {labels[0]}\"\n    return labels\n\n\ndef _unique_time_bins(unique):\n    times = [utc_from_timestamp(x).timetuple() for x in unique]\n    fmt = f'%y %b %d'\n    fmt += \" %H:%M\" * (len({t[2:] for t in times}) > 1)\n    fmt += \":%S\" * bool(np.all(unique % 60 == 0))\n    labels = [time.strftime(fmt, x) for x in times]\n    short_labels = _simplified_labels(labels)\n    return BinDefinition(_unique_thresholds(unique), labels, short_labels)\n\n\ndef _unique_thresholds(unique):\n    if len(unique) >= 2:\n        # make the last bin the same width as the one before\n        last_boundary = 2 * unique[-1] - unique[-2]\n    else:\n        last_boundary = unique[0] + 1\n    return np.hstack((unique, [last_boundary]))\n\n\ndef _min_max_unique(data):\n    unique = np.unique(data)\n    unique = unique[np.isfinite(unique)]\n    if not unique.size:\n        raise ValueError(\"no valid (non-nan) data\")\n    return unique[0], unique[-1], unique\n\n\nshort_time_units = dict(seconds=\"sec\", minutes=\"min\", hours=\"hrs\",\n                        weeks=\"wks\", months=\"mon\", years=\"yrs\",\n                        second=\"sec\", minute=\"min\", month=\"mon\")\n\n\n# noinspection PyPep8Naming\nclass EntropyMDL(Discretization):\n    \"\"\"\n    Discretization into bins inferred by recursively splitting the values to\n    minimize the class-entropy. The procedure stops when further splits would\n    decrease the entropy for less than the corresponding increase of minimal\n    description length (MDL). [FayyadIrani93].\n\n    If there are no suitable cut-off points, the procedure returns a single bin,\n    which means that the new feature is constant and can be removed.\n\n    .. attribute:: force\n\n        Induce at least one cut-off point, even when its information\n        gain is lower than MDL (default: False).\n\n    \"\"\"\n    def __init__(self, force=False):\n        self.force = force\n\n    def __call__(self, data, attribute):\n        cont = contingency.get_contingency(data, attribute)\n        values, I = cont.values, cont.counts.T\n        cut_ind = np.array(self._entropy_discretize_sorted(I, self.force))\n        if len(cut_ind) > 0:\n            # \"the midpoint between each successive pair of examples\" (FI p.1)\n            points = (values[cut_ind] + values[cut_ind - 1]) / 2.\n        else:\n            points = []\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\n    @classmethod\n    def _normalize(cls,\n                   X: Union[List[List[Number]], np.ndarray],\n                   axis: Optional[int] = None,\n                   out: Optional[np.ndarray] = None) -> np.ndarray:\n        \"\"\"\n        Normalize `X` array so it sums to 1.0 over the `axis`.\n\n        Parameters\n        ----------\n        X : array\n            Array to normalize.\n        axis : optional int\n            Axis over which the resulting array sums to 1.\n        out : optional array\n            Output array of the same shape as X.\n        \"\"\"\n        X = np.asarray(X, dtype=float)\n        scale = np.sum(X, axis=axis, keepdims=True)\n        scale[scale == 0] = 1\n        if out is None:\n            return X / scale\n        else:\n            if out is not X:\n                assert out.shape == X.shape\n                out[:] = X\n            out /= scale\n            return out\n\n    @classmethod\n    def _entropy_normalized(cls, D, axis=None):\n        \"\"\"\n        Compute the entropy of distribution array `D`.\n\n        `D` must be a distribution (i.e. sum to 1.0 over `axis`)\n\n        Parameters\n        ----------\n        D : array\n            Distribution.\n        axis : optional int\n            Axis of `D` along which to compute the entropy.\n\n        \"\"\"\n        # req: (np.sum(D, axis=axis) >= 0).all()\n        # req: (np.sum(D, axis=axis) <= 1).all()\n        # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9)\n\n        D = np.asarray(D)\n        if np.sum(D) == 0:\n            return 0\n        Dc = np.clip(D, np.finfo(D.dtype).eps, 1.0)\n        return - np.sum(D * np.log2(Dc), axis=axis)\n\n    @classmethod\n    def _entropy(cls, D, axis=None):\n        \"\"\"\n        Compute the entropy of distribution `D`.\n\n        Parameters\n        ----------\n        D : array\n            Distribution.\n        axis : optional int\n            Axis of `D` along which to compute the entropy.\n\n        \"\"\"\n        D = cls._normalize(D, axis=axis)\n        return cls._entropy_normalized(D, axis=axis)\n\n    @classmethod\n    def _entropy1(cls, D):\n        \"\"\"\n        Compute the entropy of distributions in `D`\n        (one per each row).\n        \"\"\"\n        D = cls._normalize(D)\n        return _discretize.entropy_normalized1(D)\n\n    @classmethod\n    def _entropy2(cls, D):\n        \"\"\"\n        Compute the entropy of distributions in `D`\n        (one per each row).\n        \"\"\"\n        D = cls._normalize(D, axis=1)\n        return _discretize.entropy_normalized2(D)\n\n    @classmethod\n    def _entropy_cuts_sorted(cls, CS):\n        \"\"\"\n        Return the class information entropy induced by partitioning\n        the `CS` distribution at all N-1 candidate cut points.\n\n        Parameters\n        ----------\n        CS : (N, K) array of class distributions.\n        \"\"\"\n        CS = np.asarray(CS)\n        # |--|-------|--------|\n        #  S1    ^       S2\n        # S1 contains all points which are <= to cut point\n        # Cumulative distributions for S1 and S2 (left right set)\n        # i.e. a cut at index i separates the CS into S1Dist[i] and S2Dist[i]\n        S1Dist = np.cumsum(CS, axis=0)[:-1]\n        S2Dist = np.cumsum(CS[::-1], axis=0)[-2::-1]\n\n        # Entropy of S1[i] and S2[i] sets\n        ES1 = cls._entropy2(S1Dist)\n        ES2 = cls._entropy2(S2Dist)\n\n        # Number of cases in S1[i] and S2[i] sets\n        S1_count = np.sum(S1Dist, axis=1)\n        S2_count = np.sum(S2Dist, axis=1)\n\n        # Number of all cases\n        S_count = np.sum(CS)\n\n        ES1w = ES1 * S1_count / S_count\n        ES2w = ES2 * S2_count / S_count\n\n        # E(A, T; S) Class information entropy of the partition S\n        E = ES1w + ES2w\n\n        return E, ES1, ES2\n\n    @classmethod\n    def _entropy_discretize_sorted(cls, C, force=False):\n        \"\"\"\n        Entropy discretization on a sorted C.\n\n        :param C: (N, K) array of class distributions.\n\n        \"\"\"\n        E, ES1, ES2 = cls._entropy_cuts_sorted(C)\n        # TODO: Also get the left right distribution counts from\n        # entropy_cuts_sorted,\n\n        # Note the + 1\n        if len(E) == 0:\n            return []\n        cut_index = np.argmin(E) + 1\n\n        # Distribution of classed in S1, S2 and S\n        S1_c = np.sum(C[:cut_index], axis=0)\n        S2_c = np.sum(C[cut_index:], axis=0)\n        S_c = S1_c + S2_c\n\n        ES = cls._entropy1(np.sum(C, axis=0))\n        ES1, ES2 = ES1[cut_index - 1], ES2[cut_index - 1]\n\n        # Information gain of the best split\n        Gain = ES - E[cut_index - 1]\n        # Number of different classes in S, S1 and S2\n        k = float(np.sum(S_c > 0))\n        k1 = float(np.sum(S1_c > 0))\n        k2 = float(np.sum(S2_c > 0))\n\n        assert k > 0\n        delta = np.log2(3 ** k - 2) - (k * ES - k1 * ES1 - k2 * ES2)\n        N = float(np.sum(S_c))\n\n        if N > 1 and Gain > np.log2(N - 1) / N + delta / N:\n            # Accept the cut point and recursively split the subsets.\n            left, right = [], []\n            if k1 > 1 and cut_index > 1:\n                left = cls._entropy_discretize_sorted(C[:cut_index, :])\n            if k2 > 1 and cut_index < len(C) - 1:\n                right = cls._entropy_discretize_sorted(C[cut_index:, :])\n            return left + [cut_index] + [i + cut_index for i in right]\n        elif force:\n            return [cut_index]\n        else:\n            return []\n\n\nclass DomainDiscretizer(Reprable):\n    \"\"\"Discretizes all continuous features in the data.\n\n    .. attribute:: method\n\n        Feature discretization method (instance of\n        :obj:`Orange.preprocess.Discretization`). If `None` (default),\n        :class:`Orange.preprocess.EqualFreq` with 4 intervals is\n        used.\n\n    .. attribute:: clean\n\n        If `True`, features discretized into a single interval constant are\n        removed. This is useful for discretization methods that infer the\n        number of intervals from the data, such as\n        :class:`Orange.preprocess.EntropyMDL` (default: `True`).\n\n    .. attribute:: discretize_class\n\n        Determines whether a target is also discretized if it is continuous.\n        (default: `False`)\n    \"\"\"\n    def __init__(self, discretize_class=False, method=None, clean=True,\n                 fixed=None):\n        self.discretize_class = discretize_class\n        self.method = method\n        self.clean = clean\n        self.fixed = fixed\n\n    def __call__(self, data, fixed=None):\n        \"\"\"\n        Compute and return discretized domain.\n\n        :param data: Data to discretize.\n        \"\"\"\n\n        def transform_list(s, fixed=None):\n            new_vars = []\n            for var in s:\n                if var.is_continuous:\n                    if fixed and var.name in fixed.keys():\n                        nv = method(data, var, fixed)\n                    else:\n                        nv = method(data, var)\n                    if not self.clean or len(nv.values) > 1:\n                        new_vars.append(nv)\n                else:\n                    new_vars.append(var)\n            return new_vars\n        if self.method is None:\n            method = EqualFreq(n=4)\n        else:\n            method = self.method\n        domain = data.domain\n        new_attrs = transform_list(domain.attributes, fixed or self.fixed)\n        if self.discretize_class:\n            new_classes = transform_list(domain.class_vars)\n        else:\n            new_classes = domain.class_vars\n        return Domain(new_attrs, new_classes)\n",
            "header": {
                "file": {
                    "path": "Orange/preprocess/discretize.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "d9642efa5",
                "new_commit_hash": "ab5062c53",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/preprocess/discretize.py"
            },
            "plus_file": {
                "path": "b/Orange/preprocess/discretize.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 97,
                            "length": 7
                        },
                        "new_range": {
                            "start": 97,
                            "length": 7
                        },
                        "section": "class Discretizer(Transformation):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        if ndigits is None or len(points) == 1:",
                                "type": "context"
                            },
                            {
                                "content": "            try:",
                                "type": "context"
                            },
                            {
                                "content": "                values = cls._get_labels(var.str_val, points)",
                                "type": "context"
                            },
                            {
                                "content": "            except ValueError:",
                                "type": "deleted"
                            },
                            {
                                "content": "            except ValueError:  # points would create identical formatted thresholds",
                                "type": "added"
                            },
                            {
                                "content": "                pass",
                                "type": "context"
                            },
                            {
                                "content": "            else:",
                                "type": "context"
                            },
                            {
                                "content": "                if len(values) == len(set(values)):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/preprocess/discretize.py",
                            "type": "class",
                            "name": "Discretizer",
                            "content": "class Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 25,
                            "end_lineno": 144,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/preprocess/discretize.py",
                            "type": "method",
                            "name": "Discretizer._get_discretized_values",
                            "content": "class Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 83,
                            "end_lineno": 128,
                            "parent": {
                                "file_name": "Orange/preprocess/discretize.py",
                                "type": "class",
                                "name": "Discretizer",
                                "content": "class Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 25,
                                "end_lineno": 144,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 108,
                            "length": 7
                        },
                        "new_range": {
                            "start": 108,
                            "length": 9
                        },
                        "section": "class Discretizer(Transformation):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                        int(-np.log10(mindiff)))",
                                "type": "context"
                            },
                            {
                                "content": "        maxdigits = np.finfo(npoints.dtype).precision + 2",
                                "type": "context"
                            },
                            {
                                "content": "        for digits in range(mindigits, maxdigits + 1):",
                                "type": "context"
                            },
                            {
                                "content": "            npoints = np.round(points, digits)",
                                "type": "deleted"
                            },
                            {
                                "content": "            # ensure that builtin round is used for compatibility with float formatting",
                                "type": "added"
                            },
                            {
                                "content": "            # de-numpyize points p (otherwise np.floats use numpy's round)",
                                "type": "added"
                            },
                            {
                                "content": "            npoints = [round(float(p), digits) for p in points]",
                                "type": "added"
                            },
                            {
                                "content": "            if len(npoints) == len(set(npoints)):",
                                "type": "context"
                            },
                            {
                                "content": "                def fmt_fixed(val):",
                                "type": "context"
                            },
                            {
                                "content": "                    # We break the loop, pylint: disable=cell-var-from-loop",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/preprocess/discretize.py",
                            "type": "class",
                            "name": "Discretizer",
                            "content": "class Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 25,
                            "end_lineno": 144,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/preprocess/discretize.py",
                            "type": "method",
                            "name": "Discretizer._get_discretized_values",
                            "content": "class Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 83,
                            "end_lineno": 128,
                            "parent": {
                                "file_name": "Orange/preprocess/discretize.py",
                                "type": "class",
                                "name": "Discretizer",
                                "content": "class Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"≥ {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 25,
                                "end_lineno": 144,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# File contains some long lines; breaking them would decrease readability\n# pylint: disable=line-too-long,too-many-lines,protected-access\nimport calendar\nimport unittest\nfrom unittest.mock import patch\nfrom time import struct_time, mktime\n\nimport numpy as np\n\nfrom Orange.data import ContinuousVariable, TimeVariable, Table, Domain\nfrom Orange.preprocess.discretize import \\\n    _time_binnings, time_binnings, BinDefinition, Discretizer, FixedWidth, \\\n    FixedTimeWidth, Binning, \\\n    TooManyIntervals, SingleValueSql, BinSql\n\n\nclass TestFixedWidth(unittest.TestCase):\n    def test_discretization(self):\n        x = np.array([[0.21, 0.335, 0, 0.26, np.nan],\n                      [0] * 5,\n                      [np.nan] * 5]).T\n        domain = Domain([ContinuousVariable(f\"c{i}\") for i in range(x.shape[1])])\n        data = Table.from_numpy(domain, x, None)\n\n        dvar = FixedWidth(0.1, 2)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points,\n                                       (0.1, 0.2, 0.3))\n        self.assertEqual(dvar.values,\n                         ('< 0.10', '0.10 - 0.20', '0.20 - 0.30', '≥ 0.30'))\n\n        dvar = FixedWidth(0.2, 1)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, (0.2, ))\n        self.assertEqual(dvar.values, ('< 0.2', '≥ 0.2'))\n\n        dvar = FixedWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedWidth(0.11, 2)(data, 1)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedWidth(0.11, 2)(data, 2)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        self.assertRaises(TooManyIntervals, FixedWidth(0.0001, 1), data, 0)\n\n\nclass TestFixedTimeWidth(unittest.TestCase):\n    def test_discretization(self):\n        t = TimeVariable(\"t\")\n        x = np.array([[t.to_val(\"1914\"), t.to_val(\"1945\"), np.nan],\n                      [t.to_val(\"1914\"), t.to_val(\"1914\"), np.nan],\n                      [np.nan, np.nan, np.nan],\n                      ]).T\n        domain = Domain([t, TimeVariable(\"t2\"), TimeVariable(\"t3\")])\n        data = Table.from_numpy(domain, x, None)\n\n        dvar = FixedTimeWidth(10, 1)(data, 1)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedTimeWidth(10, 2)(data, 2)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        self.assertRaises(TooManyIntervals, FixedWidth(0.0001, 1), data, 0)\n\n        dvar = FixedTimeWidth(10, 0)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(str(y))) for y in (1920, 1930, 1940)])\n        self.assertEqual(dvar.values,\n                         ('< 1920', '1920 - 1930', '1930 - 1940', '≥ 1940'))\n\n        dvar = FixedTimeWidth(5, 0)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(str(y))) for y in (1915, 1920, 1925, 1930, 1935,\n                                             1940, 1945)])\n        self.assertEqual(dvar.values,\n                         ('< 1915', '1915 - 1920', '1920 - 1925', '1925 - 1930',\n                          '1930 - 1935', '1935 - 1940', '1940 - 1945', '≥ 1945')\n                         )\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-07-28\"), t.to_val(\"1918-11-11\")]]).T)\n        dvar = FixedTimeWidth(6, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1915-01-01\", \"1915-07-01\",\n                                        \"1916-01-01\", \"1916-07-01\",\n                                        \"1917-01-01\", \"1917-07-01\",\n                                        \"1918-01-01\", \"1918-07-01\")])\n        self.assertEqual(dvar.values,\n                         ('< 15 Jan', '15 Jan - Jul', '15 Jul - 16 Jan',\n                          '16 Jan - Jul', '16 Jul - 17 Jan', '17 Jan - Jul',\n                          '17 Jul - 18 Jan', '18 Jan - Jul', '≥ 18 Jul'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-07-28\"), t.to_val(\"1914-11-11\")]]).T)\n        dvar = FixedTimeWidth(6, 1)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedTimeWidth(2, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-09-01\", \"1914-11-01\")])\n        self.assertEqual(dvar.values, ('< Sep', 'Sep - Nov', '≥ Nov'))\n\n        dvar = FixedTimeWidth(1, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-08-01\", \"1914-09-01\",\n                                        \"1914-10-01\", \"1914-11-01\")])\n        self.assertEqual(dvar.values, ('< Aug', 'Aug - Sep', 'Sep - Oct',\n                                       'Oct - Nov', '≥ Nov'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-07-04 15:25\")]]).T)\n        dvar = FixedTimeWidth(2, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29\", \"1914-07-01\",\n                                        \"1914-07-03\")])\n        self.assertEqual(dvar.values, ('< Jun 29', 'Jun 29 - Jul 01',\n                                       'Jul 01 - Jul 03', '≥ Jul 03'))\n\n        dvar = FixedTimeWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29\", \"1914-06-30\",\n                                        \"1914-07-01\", \"1914-07-02\",\n                                        \"1914-07-03\", \"1914-07-04\")])\n        self.assertEqual(dvar.values, ('< Jun 29', 'Jun 29 - Jun 30',\n                                       'Jun 30 - Jul 01', 'Jul 01 - Jul 02',\n                                        'Jul 02 - Jul 03', 'Jul 03 - Jul 04',\n                                        '≥ Jul 04'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-12-30 22:45\"),\n                       t.to_val(\"1915-01-02 15:25\")]]).T)\n        dvar = FixedTimeWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-12-31\", \"1915-01-01\",\n                                        \"1915-01-02\")])\n        self.assertEqual(dvar.values, ('< 14 Dec 31',\n                                       '14 Dec 31 - 15 Jan 01',\n                                       '15 Jan 01 - Jan 02', '≥ 15 Jan 02'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-06-28 15:25\")]]).T)\n        dvar = FixedTimeWidth(2, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 12:00\", \"1914-06-28 14:00\")])\n        self.assertEqual(dvar.values, ('< 12:00', '12:00 - 14:00', '≥ 14:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-06-28 15:25\")]]).T)\n        dvar = FixedTimeWidth(1, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 11:00\", \"1914-06-28 12:00\",\n                                        \"1914-06-28 13:00\", \"1914-06-28 14:00\",\n                                        \"1914-06-28 15:00\")])\n        self.assertEqual(dvar.values, ('< 11:00', '11:00 - 12:00',\n                                       '12:00 - 13:00', '13:00 - 14:00',\n                                       '14:00 - 15:00', '≥ 15:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 22:45\"),\n                       t.to_val(\"1914-06-29 03:25\")]]).T)\n        dvar = FixedTimeWidth(1, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 23:00\", \"1914-06-29 00:00\",\n                                        \"1914-06-29 01:00\", \"1914-06-29 02:00\",\n                                        \"1914-06-29 03:00\")])\n        self.assertEqual(dvar.values, ('< Jun 28 23:00',\n                                       'Jun 28 23:00 - Jun 29 00:00',\n                                       'Jun 29 00:00 - 01:00',\n                                       'Jun 29 01:00 - 02:00',\n                                       'Jun 29 02:00 - 03:00',\n                                       '≥ Jun 29 03:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 22:43\"),\n                       t.to_val(\"1914-06-28 23:01\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 22:45\", \"1914-06-28 22:50\",\n                                        \"1914-06-28 22:55\", \"1914-06-28 23:00\")])\n        self.assertEqual(dvar.values, ('< 22:45', \"22:45 - 22:50\",\n                                       \"22:50 - 22:55\", \"22:55 - 23:00\",\n                                       '≥ 23:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-30 23:48\"),\n                       t.to_val(\"1914-07-01 00:06\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-30 23:50\", \"1914-06-30 23:55\",\n                                        \"1914-07-01 00:00\", \"1914-07-01 00:05\")])\n        self.assertEqual(dvar.values, ('< Jun 30 23:50', \"Jun 30 23:50 - 23:55\",\n                                       \"Jun 30 23:55 - Jul 01 00:00\",\n                                       \"Jul 01 00:00 - 00:05\", '≥ Jul 01 00:05'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48\"),\n                       t.to_val(\"1914-06-30 00:06\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:50\", \"1914-06-29 23:55\",\n                                        \"1914-06-30 00:00\", \"1914-06-30 00:05\")])\n        self.assertEqual(dvar.values, ('< Jun 29 23:50', \"Jun 29 23:50 - 23:55\",\n                                       \"Jun 29 23:55 - Jun 30 00:00\",\n                                       \"Jun 30 00:00 - 00:05\", '≥ Jun 30 00:05'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48:05\"),\n                       t.to_val(\"1914-06-29 23:51:59\")]]).T)\n        dvar = FixedTimeWidth(1, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:49\", \"1914-06-29 23:50\",\n                                        \"1914-06-29 23:51\")])\n        self.assertEqual(dvar.values, ('< 23:49', \"23:49 - 23:50\",\n                                       \"23:50 - 23:51\", '≥ 23:51'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48:05.123\"),\n                       t.to_val(\"1914-06-29 23:48:33.684\")]]).T)\n        dvar = FixedTimeWidth(10, 5)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:48:10\",\n                                        \"1914-06-29 23:48:20\",\n                                        \"1914-06-29 23:48:30\")])\n        self.assertEqual(dvar.values, ('< 23:48:10', \"23:48:10 - 23:48:20\",\n                                       \"23:48:20 - 23:48:30\", '≥ 23:48:30'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-12-31 23:59:58.1\"),\n                       t.to_val(\"1915-01-01 00:00:01.8\")]]).T)\n        dvar = FixedTimeWidth(1, 5)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-12-31 23:59:59\",\n                                        \"1915-01-01 00:00:00\",\n                                        \"1915-01-01 00:00:01\")])\n        self.assertEqual(dvar.values, ('< 23:59:59', \"23:59:59 - 00:00:00\",\n                                       \"00:00:00 - 00:00:01\", '≥ 00:00:01'))\n\n        self.assertRaises(TooManyIntervals, FixedTimeWidth(0.0001, 5), data, 0)\n\n\nclass TestBinningDiscretizer(unittest.TestCase):\n    def test_no_data(self):\n        no_data = Table(Domain([ContinuousVariable(\"y\")]), np.zeros((0, 1)))\n        dvar = Binning()(no_data, 0)\n        self.assertEqual(dvar.compute_value.points, [])\n\n    @patch(\"Orange.preprocess.discretize.time_binnings\")\n    @patch(\"Orange.preprocess.discretize.decimal_binnings\")\n    @patch(\"Orange.preprocess.discretize.Binning._create_binned_var\")\n    def test_call(self, _, decbin, timebin):\n        data = Table(Domain([ContinuousVariable(\"y\"), TimeVariable(\"t\")]),\n                     np.array([[1, 2], [3, 4]]))\n\n        Binning(5)(data, 0)\n        timebin.assert_not_called()\n        self.assertEqual(list(decbin.call_args[0][0]), [1, 3])\n        decbin.reset_mock()\n\n        Binning(5)(data, 1)\n        decbin.assert_not_called()\n        self.assertEqual(list(timebin.call_args[0][0]), [2, 4])\n\n    def test_binning_selection(self):\n        var = ContinuousVariable(\"y\")\n        discretize = Binning(2)\n        # pylint: disable=redefined-outer-name\n        create = discretize._create_binned_var\n\n        binnings = []\n        self.assertEqual(create(binnings, var).compute_value.points, [])\n\n        binnings = None\n        self.assertEqual(create(binnings, var).compute_value.points, [])\n\n        binnings = [\n            BinDefinition(np.arange(i + 1),\n                          [f\"t{x}\" for x in range(i + 1)],\n                          [f\"t{x}\" for x in range(i + 1)],\n                          1 / i, str(i)\n                          )\n            for i in (3, 5, 10, 20)\n        ]\n\n        for discretize.n in (2, 3):\n            self.assertEqual(create(binnings, var).values,\n                             ('< t1', \"t1 - t2\", \"≥ t2\"))\n\n        for discretize.n in (4, 5, 6, 7):\n            self.assertEqual(create(binnings, var).values,\n                             ('< t1', \"t1 - t2\", \"t2 - t3\", \"t3 - t4\", \"≥ t4\"))\n\n        for discretize.n in range(8, 15):\n            self.assertEqual(len(create(binnings, var).values), 10)\n\n        for discretize.n in range(16, 25):\n            self.assertEqual(len(create(binnings, var).values), 20)\n\n\n# pylint: disable=redefined-builtin\ndef create(year=1970, month=1, day=1, hour=0, min=0, sec=0):\n    return struct_time((year, month, day, hour, min, sec, 0, 0, 0))\n\n\nclass TestTimeBinning(unittest.TestCase):\n    def setUp(self):\n        self.dates = [mktime(x) for x in\n                      [(1975, 6, 9, 10, 0, 0, 0, 161, 0),\n                       (1975, 6, 9, 10, 50, 0, 0, 161, 0),\n                       (1975, 6, 9, 11, 40, 0, 0, 161, 0),\n                       (1975, 6, 9, 12, 30, 0, 0, 161, 0),\n                       (1975, 6, 9, 13, 20, 0, 0, 161, 0),\n                       (1975, 6, 9, 14, 10, 0, 0, 161, 0)]]\n\n    def test_binning(self):\n        def tr1(s):\n            for localname, engname in zip(\n                    calendar.month_abbr[1:],\n                    \"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec\".split()):\n                s = s.replace(localname, engname)\n            return s\n\n        def tr2(ss):\n            return list(map(tr1, ss))\n\n        def testbin(start, end):\n            bins = _time_binnings(create(*start), create(*end), 3, 51)\n            return [(bin.width_label, tr2(bin.short_labels),\n                     list(bin.thresholds))\n                    for bin in reversed(bins)]\n\n        self.assertEqual(\n            testbin((1975, 4, 2), (1989, 3, 1)),\n            [('10 years',\n              ['1970', '1980', '1990'],\n              [0, 315532800, 631152000]),\n             ('5 years',\n              ['1975', '1980', '1985', '1990'],\n              [157766400, 315532800, 473385600, 631152000]),\n             ('2 years',\n              ['1974', '1976', '1978', '1980', '1982', '1984', '1986', '1988',\n               '1990'],\n              [126230400, 189302400, 252460800, 315532800, 378691200, 441763200,\n               504921600, 567993600, 631152000]),\n             ('1 year',\n              ['1975', '1976', '1977', '1978', '1979', '1980', '1981', '1982',\n               '1983', '1984', '1985', '1986', '1987', '1988', '1989', '1990'],\n              [157766400, 189302400, 220924800, 252460800, 283996800, 315532800,\n               347155200, 378691200, 410227200, 441763200, 473385600, 504921600,\n               536457600, 567993600, 599616000, 631152000]),\n             ('6 months',\n              ['75 Jan', 'Jul', '76 Jan', 'Jul', '77 Jan', 'Jul', '78 Jan',\n               'Jul', '79 Jan', 'Jul', '80 Jan', 'Jul', '81 Jan', 'Jul',\n               '82 Jan', 'Jul', '83 Jan', 'Jul', '84 Jan', 'Jul', '85 Jan',\n               'Jul', '86 Jan', 'Jul', '87 Jan', 'Jul', '88 Jan', 'Jul',\n               '89 Jan', 'Jul'],\n              [157766400, 173404800, 189302400, 205027200, 220924800, 236563200,\n               252460800, 268099200, 283996800, 299635200, 315532800, 331257600,\n               347155200, 362793600, 378691200, 394329600, 410227200, 425865600,\n               441763200, 457488000, 473385600, 489024000, 504921600, 520560000,\n               536457600, 552096000, 567993600, 583718400, 599616000,\n               615254400])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 4, 2), (1978, 3, 1)),\n            [('2 years',\n              ['1974', '1976', '1978', '1980'],\n              [126230400, 189302400, 252460800, 315532800]),\n             ('1 year',\n              ['1975', '1976', '1977', '1978', '1979'],\n              [157766400, 189302400, 220924800, 252460800, 283996800]),\n             ('6 months',\n              ['75 Jan', 'Jul',\n               '76 Jan', 'Jul',\n               '77 Jan', 'Jul',\n               '78 Jan', 'Jul'],\n              [157766400, 173404800, 189302400, 205027200, 220924800, 236563200,\n               252460800, 268099200]),\n             ('3 months',\n              ['75 Apr', 'Jul', 'Oct',\n               '76 Jan', 'Apr', 'Jul', 'Oct',\n               '77 Jan', 'Apr', 'Jul', 'Oct',\n               '78 Jan', 'Apr'],\n              [165542400, 173404800, 181353600, 189302400, 197164800, 205027200,\n               212976000, 220924800, 228700800, 236563200, 244512000, 252460800,\n               260236800]),\n             ('2 months',\n              ['75 Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '76 Jan', 'Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '77 Jan', 'Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '78 Jan', 'Mar', 'May'],\n              [162864000, 168134400, 173404800, 178761600, 184032000, 189302400,\n               194486400, 199756800, 205027200, 210384000, 215654400, 220924800,\n               226022400, 231292800, 236563200, 241920000, 247190400, 252460800,\n               257558400, 262828800]),\n             ('1 month',\n              ['75 Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '76 Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '77 Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '78 Jan', 'Feb', 'Mar', 'Apr'],\n              [165542400, 168134400, 170812800, 173404800, 176083200, 178761600,\n               181353600, 184032000, 186624000, 189302400, 191980800, 194486400,\n               197164800, 199756800, 202435200, 205027200, 207705600, 210384000,\n               212976000, 215654400, 218246400, 220924800, 223603200, 226022400,\n               228700800, 231292800, 233971200, 236563200, 239241600, 241920000,\n               244512000, 247190400, 249782400, 252460800, 255139200, 257558400,\n               260236800])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 2), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('2 weeks',\n              ['75 Dec 03', '17', '31', '76 Jan 14'],\n              [186796800, 188006400, 189216000, 190425600]),\n             ('1 week',\n              ['75 Dec 03', '10', '17', '24', '31',\n               '76 Jan 07'],\n              [186796800, 187401600, 188006400, 188611200, 189216000,\n               189820800]),\n             ('1 day',\n              ['75 Dec 02', '03', '04', '05', '06', '07', '08', '09', '10',\n               '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21',\n               '22', '23', '24', '25', '26', '27', '28', '29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [186710400, 186796800, 186883200, 186969600, 187056000, 187142400,\n               187228800, 187315200, 187401600, 187488000, 187574400, 187660800,\n               187747200, 187833600, 187920000, 188006400, 188092800, 188179200,\n               188265600, 188352000, 188438400, 188524800, 188611200, 188697600,\n               188784000, 188870400, 188956800, 189043200, 189129600, 189216000,\n               189302400, 189388800, 189475200, 189561600])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 25), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('1 day',\n              ['75 Dec 25', '26', '27', '28', '29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [188697600, 188784000, 188870400, 188956800, 189043200, 189129600,\n               189216000, 189302400, 189388800, 189475200, 189561600]),\n             ('12 hours',\n              ['75 Dec 25 00:00', '12:00',\n               '26 00:00', '12:00',\n               '27 00:00', '12:00',\n               '28 00:00', '12:00',\n               '29 00:00', '12:00',\n               '30 00:00', '12:00',\n               '31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00', '12:00',\n               '03 00:00', '12:00'],\n              [188697600, 188740800, 188784000, 188827200, 188870400, 188913600,\n               188956800, 189000000, 189043200, 189086400, 189129600, 189172800,\n               189216000, 189259200, 189302400, 189345600, 189388800, 189432000,\n               189475200, 189518400]),\n             ('6 hours',\n              ['75 Dec 25 00:00', '06:00', '12:00', '18:00',\n               '26 00:00', '06:00', '12:00', '18:00',\n               '27 00:00', '06:00', '12:00', '18:00',\n               '28 00:00', '06:00', '12:00', '18:00',\n               '29 00:00', '06:00', '12:00', '18:00',\n               '30 00:00', '06:00', '12:00', '18:00',\n               '31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00',\n               '02 00:00', '06:00', '12:00', '18:00',\n               '03 00:00', '06:00'],\n              [188697600, 188719200, 188740800, 188762400, 188784000, 188805600,\n               188827200, 188848800, 188870400, 188892000, 188913600, 188935200,\n               188956800, 188978400, 189000000, 189021600, 189043200, 189064800,\n               189086400, 189108000, 189129600, 189151200, 189172800, 189194400,\n               189216000, 189237600, 189259200, 189280800, 189302400, 189324000,\n               189345600, 189367200, 189388800, 189410400, 189432000, 189453600,\n               189475200, 189496800])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 29), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('1 day',\n              ['75 Dec 29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [189043200, 189129600, 189216000, 189302400, 189388800, 189475200,\n               189561600]),\n             ('12 hours',\n              ['75 Dec 29 00:00', '12:00',\n               '30 00:00', '12:00',\n               '31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00', '12:00',\n               '03 00:00', '12:00'],\n              [189043200, 189086400, 189129600, 189172800, 189216000, 189259200,\n               189302400, 189345600, 189388800, 189432000, 189475200,\n               189518400]),\n             ('6 hours',\n              ['75 Dec 29 00:00', '06:00', '12:00', '18:00',\n               '30 00:00', '06:00', '12:00', '18:00',\n               '31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00',\n               '02 00:00', '06:00', '12:00', '18:00',\n               '03 00:00', '06:00'],\n              [189043200, 189064800, 189086400, 189108000, 189129600, 189151200,\n               189172800, 189194400, 189216000, 189237600, 189259200, 189280800,\n               189302400, 189324000, 189345600, 189367200, 189388800, 189410400,\n               189432000, 189453600, 189475200, 189496800]),\n             ('3 hours',\n              ['75 Dec 29 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '30 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '31 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '02 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '03 00:00', '03:00'],\n              [189043200, 189054000, 189064800, 189075600, 189086400, 189097200,\n               189108000, 189118800, 189129600, 189140400, 189151200, 189162000,\n               189172800, 189183600, 189194400, 189205200, 189216000, 189226800,\n               189237600, 189248400, 189259200, 189270000, 189280800, 189291600,\n               189302400, 189313200, 189324000, 189334800, 189345600, 189356400,\n               189367200, 189378000, 189388800, 189399600, 189410400, 189421200,\n               189432000, 189442800, 189453600, 189464400, 189475200,\n               189486000])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 0, 0, 0), (1976, 1, 1, 14, 30)),\n            [('1 day',\n              ['75 Dec 31', '76 Jan 01', '02'],\n              [189216000, 189302400, 189388800]),\n             ('12 hours',\n              ['75 Dec 31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00'],\n              [189216000, 189259200, 189302400, 189345600, 189388800]),\n             ('6 hours',\n              ['75 Dec 31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00'],\n              [189216000, 189237600, 189259200, 189280800, 189302400, 189324000,\n               189345600, 189367200]),\n             ('3 hours',\n              ['75 Dec 31 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00', '06:00', '09:00', '12:00', '15:00'],\n              [189216000, 189226800, 189237600, 189248400, 189259200, 189270000,\n               189280800, 189291600, 189302400, 189313200, 189324000, 189334800,\n               189345600, 189356400]),\n             ('2 hours',\n              ['75 Dec 31 00:00', '02:00', '04:00', '06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00',\n               '76 Jan 01 00:00', '02:00', '04:00', '06:00', '08:00', '10:00', '12:00', '14:00', '16:00'],\n              [189216000, 189223200, 189230400, 189237600, 189244800, 189252000,\n               189259200, 189266400, 189273600, 189280800, 189288000, 189295200,\n               189302400, 189309600, 189316800, 189324000, 189331200, 189338400,\n               189345600, 189352800, 189360000]),\n             ('1 hour',\n              ['75 Dec 31 00:00', '01:00', '02:00', '03:00', '04:00', '05:00',\n               '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00',\n               '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00',\n               '20:00', '21:00', '22:00', '23:00',\n               '76 Jan 01 00:00', '01:00', '02:00', '03:00', '04:00', '05:00',\n               '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00',\n               '13:00', '14:00', '15:00'],\n              [189216000, 189219600, 189223200, 189226800, 189230400, 189234000,\n               189237600, 189241200, 189244800, 189248400, 189252000, 189255600,\n               189259200, 189262800, 189266400, 189270000, 189273600, 189277200,\n               189280800, 189284400, 189288000, 189291600, 189295200, 189298800,\n               189302400, 189306000, 189309600, 189313200, 189316800, 189320400,\n               189324000, 189327600, 189331200, 189334800, 189338400, 189342000,\n               189345600, 189349200, 189352800, 189356400])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 6), (1976, 1, 1)),\n            [('1 day',\n              ['75 Dec 31', '76 Jan 01', '02'],\n              [189216000, 189302400, 189388800]),\n             ('12 hours',\n              ['75 Dec 31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00'],\n              [189216000, 189259200, 189302400, 189345600]),\n             ('6 hours',\n              ['75 Dec 31 06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00'],\n              [189237600, 189259200, 189280800, 189302400, 189324000]),\n             ('3 hours',\n              ['75 Dec 31 06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00'],\n              [189237600, 189248400, 189259200, 189270000, 189280800, 189291600,\n               189302400, 189313200]),\n             ('2 hours',\n              ['75 Dec 31 06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00',\n               '76 Jan 01 00:00', '02:00'],\n              [189237600, 189244800, 189252000, 189259200, 189266400, 189273600,\n               189280800, 189288000, 189295200, 189302400, 189309600]),\n             ('1 hour',\n              ['75 Dec 31 06:00', '07:00', '08:00', '09:00', '10:00', '11:00',\n               '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00',\n               '19:00', '20:00', '21:00', '22:00', '23:00',\n               '76 Jan 01 00:00', '01:00'],\n              [189237600, 189241200, 189244800, 189248400, 189252000, 189255600,\n               189259200, 189262800, 189266400, 189270000, 189273600, 189277200,\n               189280800, 189284400, 189288000, 189291600, 189295200, 189298800,\n               189302400, 189306000]),\n             ('30 minutes',\n              ['Dec 31 06:00', '06:30', '07:00', '07:30', '08:00', '08:30',\n               '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00',\n               '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30',\n               '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00',\n               '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30',\n               '23:00', '23:30',\n               'Jan 01 00:00', '00:30'],\n              [189237600, 189239400, 189241200, 189243000, 189244800, 189246600,\n               189248400, 189250200, 189252000, 189253800, 189255600, 189257400,\n               189259200, 189261000, 189262800, 189264600, 189266400, 189268200,\n               189270000, 189271800, 189273600, 189275400, 189277200, 189279000,\n               189280800, 189282600, 189284400, 189286200, 189288000, 189289800,\n               189291600, 189293400, 189295200, 189297000, 189298800, 189300600,\n               189302400, 189304200])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 23), (1976, 1, 1, 2)),\n            [('3 hours',\n              ['75 Dec 31 21:00',\n               '76 Jan 01 00:00', '03:00'],\n              [189291600, 189302400, 189313200]),\n             ('2 hours',\n              ['75 Dec 31 22:00',\n               '76 Jan 01 00:00', '02:00', '04:00'],\n              [189295200, 189302400, 189309600, 189316800]),\n             ('1 hour',\n              ['75 Dec 31 23:00',\n               '76 Jan 01 00:00', '01:00', '02:00', '03:00'],\n              [189298800, 189302400, 189306000, 189309600, 189313200]),\n             ('30 minutes',\n              ['Dec 31 23:00', '23:30',\n               'Jan 01 00:00', '00:30', '01:00', '01:30', '02:00', '02:30'],\n              [189298800, 189300600, 189302400, 189304200, 189306000, 189307800,\n               189309600, 189311400]),\n             ('15 minutes',\n              ['Dec 31 23:00', '23:15', '23:30', '23:45',\n               'Jan 01 00:00', '00:15', '00:30', '00:45', '01:00', '01:15',\n               '01:30', '01:45', '02:00', '02:15'],\n              [189298800, 189299700, 189300600, 189301500, 189302400, 189303300,\n               189304200, 189305100, 189306000, 189306900, 189307800, 189308700,\n               189309600, 189310500]),\n             ('10 minutes',\n              ['Dec 31 23:00', '23:10', '23:20', '23:30', '23:40', '23:50',\n               'Jan 01 00:00', '00:10', '00:20', '00:30', '00:40', '00:50',\n               '01:00', '01:10', '01:20', '01:30', '01:40', '01:50', '02:00',\n               '02:10'],\n              [189298800, 189299400, 189300000, 189300600, 189301200, 189301800,\n               189302400, 189303000, 189303600, 189304200, 189304800, 189305400,\n               189306000, 189306600, 189307200, 189307800, 189308400, 189309000,\n               189309600, 189310200]),\n             ('5 minutes',\n              ['Dec 31 23:00', '23:05', '23:10', '23:15', '23:20', '23:25',\n               '23:30', '23:35', '23:40', '23:45', '23:50', '23:55',\n               'Jan 01 00:00', '00:05', '00:10', '00:15', '00:20', '00:25',\n               '00:30', '00:35', '00:40', '00:45', '00:50', '00:55', '01:00',\n               '01:05', '01:10', '01:15', '01:20', '01:25', '01:30', '01:35',\n               '01:40', '01:45', '01:50', '01:55', '02:00', '02:05'],\n              [189298800, 189299100, 189299400, 189299700, 189300000, 189300300,\n               189300600, 189300900, 189301200, 189301500, 189301800, 189302100,\n               189302400, 189302700, 189303000, 189303300, 189303600, 189303900,\n               189304200, 189304500, 189304800, 189305100, 189305400, 189305700,\n               189306000, 189306300, 189306600, 189306900, 189307200, 189307500,\n               189307800, 189308100, 189308400, 189308700, 189309000, 189309300,\n               189309600, 189309900])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 23, 18)),\n            [('12 hours',\n              ['Jun 09 00:00', '12:00', '10 00:00'],\n              [-1437868800, -1437825600, -1437782400]),\n             ('6 hours',\n              ['Jun 09 06:00', '12:00', '18:00', '10 00:00'],\n              [-1437847200, -1437825600, -1437804000, -1437782400]),\n             ('3 hours',\n              ['Jun 09 09:00', '12:00', '15:00', '18:00', '21:00', '10 00:00'],\n              [-1437836400, -1437825600, -1437814800, -1437804000, -1437793200,\n               -1437782400]),\n             ('2 hours',\n              ['Jun 09 10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '10 00:00'],\n              [-1437832800, -1437825600, -1437818400, -1437811200, -1437804000,\n               -1437796800, -1437789600, -1437782400]),\n             ('1 hour',\n              ['Jun 09 10:00', '11:00', '12:00', '13:00', '14:00', '15:00',\n               '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00',\n               '23:00',\n               '10 00:00'],\n              [-1437832800, -1437829200, -1437825600, -1437822000, -1437818400,\n               -1437814800, -1437811200, -1437807600, -1437804000, -1437800400,\n               -1437796800, -1437793200, -1437789600, -1437786000,\n               -1437782400]),\n             ('30 minutes',\n              ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',\n               '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30',\n               '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',\n               '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30'],\n              [-1437832800, -1437831000, -1437829200, -1437827400, -1437825600,\n               -1437823800, -1437822000, -1437820200, -1437818400, -1437816600,\n               -1437814800, -1437813000, -1437811200, -1437809400, -1437807600,\n               -1437805800, -1437804000, -1437802200, -1437800400, -1437798600,\n               -1437796800, -1437795000, -1437793200, -1437791400, -1437789600,\n               -1437787800, -1437786000, -1437784200])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 13, 18)),\n            [('2 hours',\n              ['10:00', '12:00', '14:00'],\n              [-1437832800, -1437825600, -1437818400]),\n             ('1 hour',\n              ['10:00', '11:00', '12:00', '13:00', '14:00'],\n              [-1437832800, -1437829200, -1437825600, -1437822000,\n               -1437818400]),\n             ('30 minutes',\n              ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',\n               '13:30'],\n              [-1437832800, -1437831000, -1437829200, -1437827400, -1437825600,\n               -1437823800, -1437822000, -1437820200]),\n             ('15 minutes',\n              ['10:00', '10:15', '10:30', '10:45', '11:00', '11:15', '11:30',\n               '11:45', '12:00', '12:15', '12:30', '12:45', '13:00', '13:15',\n               '13:30'],\n              [-1437832800, -1437831900, -1437831000, -1437830100, -1437829200,\n               -1437828300, -1437827400, -1437826500, -1437825600, -1437824700,\n               -1437823800, -1437822900, -1437822000, -1437821100,\n               -1437820200]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30', '10:40', '10:50', '11:00',\n               '11:10', '11:20', '11:30', '11:40', '11:50', '12:00', '12:10',\n               '12:20', '12:30', '12:40', '12:50', '13:00', '13:10', '13:20'],\n              [-1437832800, -1437832200, -1437831600, -1437831000, -1437830400,\n               -1437829800, -1437829200, -1437828600, -1437828000, -1437827400,\n               -1437826800, -1437826200, -1437825600, -1437825000, -1437824400,\n               -1437823800, -1437823200, -1437822600, -1437822000, -1437821400,\n               -1437820800]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30',\n               '10:35', '10:40', '10:45', '10:50', '10:55', '11:00', '11:05',\n               '11:10', '11:15', '11:20', '11:25', '11:30', '11:35', '11:40',\n               '11:45', '11:50', '11:55', '12:00', '12:05', '12:10', '12:15',\n               '12:20', '12:25', '12:30', '12:35', '12:40', '12:45', '12:50',\n               '12:55', '13:00', '13:05', '13:10', '13:15', '13:20'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300, -1437831000, -1437830700, -1437830400, -1437830100,\n               -1437829800, -1437829500, -1437829200, -1437828900, -1437828600,\n               -1437828300, -1437828000, -1437827700, -1437827400, -1437827100,\n               -1437826800, -1437826500, -1437826200, -1437825900, -1437825600,\n               -1437825300, -1437825000, -1437824700, -1437824400, -1437824100,\n               -1437823800, -1437823500, -1437823200, -1437822900, -1437822600,\n               -1437822300, -1437822000, -1437821700, -1437821400, -1437821100,\n               -1437820800])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 10, 48)),\n            [('30 minutes',\n              ['10:00', '10:30', '11:00'],\n              [-1437832800, -1437831000, -1437829200]),\n             ('15 minutes',\n              ['10:00', '10:15', '10:30', '10:45', '11:00'],\n              [-1437832800, -1437831900, -1437831000, -1437830100,\n               -1437829200]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30', '10:40', '10:50'],\n              [-1437832800, -1437832200, -1437831600, -1437831000, -1437830400,\n               -1437829800]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30',\n               '10:35', '10:40', '10:45', '10:50'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300, -1437831000, -1437830700, -1437830400, -1437830100,\n               -1437829800]),\n             ('1 minute',\n              ['10:00', '10:01', '10:02', '10:03', '10:04', '10:05', '10:06',\n               '10:07', '10:08', '10:09', '10:10', '10:11', '10:12', '10:13',\n               '10:14', '10:15', '10:16', '10:17', '10:18', '10:19', '10:20',\n               '10:21', '10:22', '10:23', '10:24', '10:25', '10:26', '10:27',\n               '10:28', '10:29', '10:30', '10:31', '10:32', '10:33', '10:34',\n               '10:35', '10:36', '10:37', '10:38', '10:39', '10:40', '10:41',\n               '10:42', '10:43', '10:44', '10:45', '10:46', '10:47', '10:48',\n               '10:49'],\n              [-1437832800, -1437832740, -1437832680, -1437832620, -1437832560,\n               -1437832500, -1437832440, -1437832380, -1437832320, -1437832260,\n               -1437832200, -1437832140, -1437832080, -1437832020, -1437831960,\n               -1437831900, -1437831840, -1437831780, -1437831720, -1437831660,\n               -1437831600, -1437831540, -1437831480, -1437831420, -1437831360,\n               -1437831300, -1437831240, -1437831180, -1437831120, -1437831060,\n               -1437831000, -1437830940, -1437830880, -1437830820, -1437830760,\n               -1437830700, -1437830640, -1437830580, -1437830520, -1437830460,\n               -1437830400, -1437830340, -1437830280, -1437830220, -1437830160,\n               -1437830100, -1437830040, -1437829980, -1437829920, -1437829860]\n              )]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 10, 20)),\n            [('15 minutes',\n              ['10:00', '10:15', '10:30'],\n              [-1437832800, -1437831900, -1437831000]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30'],\n              [-1437832800, -1437832200, -1437831600, -1437831000]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300]),\n             ('1 minute',\n              ['10:00', '10:01', '10:02', '10:03', '10:04', '10:05', '10:06',\n               '10:07', '10:08', '10:09', '10:10', '10:11', '10:12', '10:13',\n               '10:14', '10:15', '10:16', '10:17', '10:18', '10:19', '10:20',\n               '10:21'],\n              [-1437832800, -1437832740, -1437832680, -1437832620, -1437832560,\n               -1437832500, -1437832440, -1437832380, -1437832320, -1437832260,\n               -1437832200, -1437832140, -1437832080, -1437832020, -1437831960,\n               -1437831900, -1437831840, -1437831780, -1437831720, -1437831660,\n               -1437831600, -1437831540]),\n             ('30 seconds',\n              ['10:00:00', '10:00:30', '10:01:00', '10:01:30', '10:02:00',\n               '10:02:30', '10:03:00', '10:03:30', '10:04:00', '10:04:30',\n               '10:05:00', '10:05:30', '10:06:00', '10:06:30', '10:07:00',\n               '10:07:30', '10:08:00', '10:08:30', '10:09:00', '10:09:30',\n               '10:10:00', '10:10:30', '10:11:00', '10:11:30', '10:12:00',\n               '10:12:30', '10:13:00', '10:13:30', '10:14:00', '10:14:30',\n               '10:15:00', '10:15:30', '10:16:00', '10:16:30', '10:17:00',\n               '10:17:30', '10:18:00', '10:18:30', '10:19:00', '10:19:30',\n               '10:20:00', '10:20:30'],\n              [-1437832800, -1437832770, -1437832740, -1437832710, -1437832680,\n               -1437832650, -1437832620, -1437832590, -1437832560, -1437832530,\n               -1437832500, -1437832470, -1437832440, -1437832410, -1437832380,\n               -1437832350, -1437832320, -1437832290, -1437832260, -1437832230,\n               -1437832200, -1437832170, -1437832140, -1437832110, -1437832080,\n               -1437832050, -1437832020, -1437831990, -1437831960, -1437831930,\n               -1437831900, -1437831870, -1437831840, -1437831810, -1437831780,\n               -1437831750, -1437831720, -1437831690, -1437831660, -1437831630,\n               -1437831600, -1437831570])])\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10, 12, 33), (1924, 6, 9, 10, 18, 12)),\n            [('5 minutes',\n              ['10:10', '10:15', '10:20'],\n              [-1437832200, -1437831900, -1437831600]),\n             ('1 minute',\n              ['10:12', '10:13', '10:14', '10:15', '10:16', '10:17', '10:18',\n               '10:19'],\n              [-1437832080, -1437832020, -1437831960, -1437831900, -1437831840,\n               -1437831780, -1437831720, -1437831660]),\n             ('30 seconds',\n              ['10:12:30', '10:13:00', '10:13:30', '10:14:00', '10:14:30',\n               '10:15:00', '10:15:30', '10:16:00', '10:16:30', '10:17:00',\n               '10:17:30', '10:18:00', '10:18:30'],\n              [-1437832050, -1437832020, -1437831990, -1437831960, -1437831930,\n               -1437831900, -1437831870, -1437831840, -1437831810, -1437831780,\n               -1437831750, -1437831720, -1437831690]),\n             ('15 seconds',\n              ['10:12:30', '10:12:45', '10:13:00', '10:13:15', '10:13:30',\n               '10:13:45', '10:14:00', '10:14:15', '10:14:30', '10:14:45',\n               '10:15:00', '10:15:15', '10:15:30', '10:15:45', '10:16:00',\n               '10:16:15', '10:16:30', '10:16:45', '10:17:00', '10:17:15',\n               '10:17:30', '10:17:45', '10:18:00', '10:18:15'],\n              [-1437832050, -1437832035, -1437832020, -1437832005, -1437831990,\n               -1437831975, -1437831960, -1437831945, -1437831930, -1437831915,\n               -1437831900, -1437831885, -1437831870, -1437831855, -1437831840,\n               -1437831825, -1437831810, -1437831795, -1437831780, -1437831765,\n               -1437831750, -1437831735, -1437831720, -1437831705]),\n             ('10 seconds',\n              ['10:12:30', '10:12:40', '10:12:50', '10:13:00', '10:13:10',\n               '10:13:20', '10:13:30', '10:13:40', '10:13:50', '10:14:00',\n               '10:14:10', '10:14:20', '10:14:30', '10:14:40', '10:14:50',\n               '10:15:00', '10:15:10', '10:15:20', '10:15:30', '10:15:40',\n               '10:15:50', '10:16:00', '10:16:10', '10:16:20', '10:16:30',\n               '10:16:40', '10:16:50', '10:17:00', '10:17:10', '10:17:20',\n               '10:17:30', '10:17:40', '10:17:50', '10:18:00', '10:18:10',\n               '10:18:20'],\n              [-1437832050, -1437832040, -1437832030, -1437832020, -1437832010,\n               -1437832000, -1437831990, -1437831980, -1437831970, -1437831960,\n               -1437831950, -1437831940, -1437831930, -1437831920, -1437831910,\n               -1437831900, -1437831890, -1437831880, -1437831870, -1437831860,\n               -1437831850, -1437831840, -1437831830, -1437831820, -1437831810,\n               -1437831800, -1437831790, -1437831780, -1437831770, -1437831760,\n               -1437831750, -1437831740, -1437831730, -1437831720, -1437831710,\n               -1437831700])])\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10, 12, 33), (1924, 6, 9, 10, 13, 12)),\n            [('30 seconds',\n              ['10:12:30', '10:13:00', '10:13:30'],\n              [-1437832050, -1437832020, -1437831990]),\n             ('15 seconds',\n              ['10:12:30', '10:12:45', '10:13:00', '10:13:15'],\n              [-1437832050, -1437832035, -1437832020, -1437832005]),\n             ('10 seconds',\n              ['10:12:30', '10:12:40', '10:12:50', '10:13:00', '10:13:10',\n               '10:13:20'],\n              [-1437832050, -1437832040, -1437832030, -1437832020, -1437832010,\n               -1437832000]),\n             ('5 seconds',\n              ['10:12:30', '10:12:35', '10:12:40', '10:12:45', '10:12:50',\n               '10:12:55', '10:13:00', '10:13:05', '10:13:10', '10:13:15'],\n              [-1437832050, -1437832045, -1437832040, -1437832035, -1437832030,\n               -1437832025, -1437832020, -1437832015, -1437832010,\n               -1437832005]),\n             ('1 second',\n              ['10:12:33', '10:12:34', '10:12:35', '10:12:36', '10:12:37',\n               '10:12:38', '10:12:39', '10:12:40', '10:12:41', '10:12:42',\n               '10:12:43', '10:12:44', '10:12:45', '10:12:46', '10:12:47',\n               '10:12:48', '10:12:49', '10:12:50', '10:12:51', '10:12:52',\n               '10:12:53', '10:12:54', '10:12:55', '10:12:56', '10:12:57',\n               '10:12:58', '10:12:59', '10:13:00', '10:13:01', '10:13:02',\n               '10:13:03', '10:13:04', '10:13:05', '10:13:06', '10:13:07',\n               '10:13:08', '10:13:09', '10:13:10', '10:13:11', '10:13:12',\n               '10:13:13'],\n              [-1437832047, -1437832046, -1437832045, -1437832044, -1437832043,\n               -1437832042, -1437832041, -1437832040, -1437832039, -1437832038,\n               -1437832037, -1437832036, -1437832035, -1437832034, -1437832033,\n               -1437832032, -1437832031, -1437832030, -1437832029, -1437832028,\n               -1437832027, -1437832026, -1437832025, -1437832024, -1437832023,\n               -1437832022, -1437832021, -1437832020, -1437832019, -1437832018,\n               -1437832017, -1437832016, -1437832015, -1437832014, -1437832013,\n               -1437832012, -1437832011, -1437832010, -1437832009, -1437832008,\n               -1437832007])])\n\n        self.assertEqual(\n            testbin((1973, 9, 14), (2010, 9, 8)),\n            [\n                ('50 years',\n                 ['1950', '2000', '2050'],\n                 [-631152000, 946684800, 2524608000]),\n                ('25 years',\n                 ['1950', '1975', '2000', '2025'],\n                 [-631152000, 157766400, 946684800, 1735689600]),\n                ('10 years',\n                 ['1970', '1980', '1990', '2000', '2010', '2020'],\n                 [0, 315532800, 631152000, 946684800, 1262304000, 1577836800]),\n                ('5 years',\n                 ['1970', '1975', '1980', '1985', '1990', '1995', '2000',\n                  '2005', '2010', '2015'],\n                 [0, 157766400, 315532800, 473385600, 631152000, 788918400,\n                  946684800, 1104537600, 1262304000, 1420070400]),\n                ('2 years',\n                 ['1972', '1974', '1976', '1978', '1980', '1982', '1984',\n                  '1986', '1988', '1990', '1992', '1994', '1996', '1998',\n                  '2000', '2002', '2004', '2006', '2008', '2010', '2012'],\n                 [63072000, 126230400, 189302400, 252460800, 315532800,\n                  378691200, 441763200, 504921600, 567993600, 631152000,\n                  694224000, 757382400, 820454400, 883612800, 946684800,\n                  1009843200, 1072915200, 1136073600, 1199145600, 1262304000,\n                  1325376000]),\n                ('1 year',\n                 ['1973', '1974', '1975', '1976', '1977', '1978', '1979',\n                  '1980', '1981', '1982', '1983', '1984', '1985', '1986',\n                  '1987', '1988', '1989', '1990', '1991', '1992', '1993',\n                  '1994', '1995', '1996', '1997', '1998', '1999', '2000',\n                  '2001', '2002', '2003', '2004', '2005', '2006', '2007',\n                  '2008', '2009', '2010', '2011'],\n                 [94694400, 126230400, 157766400, 189302400, 220924800,\n                  252460800, 283996800, 315532800, 347155200, 378691200,\n                  410227200, 441763200, 473385600, 504921600, 536457600,\n                  567993600, 599616000, 631152000, 662688000, 694224000,\n                  725846400, 757382400, 788918400, 820454400, 852076800,\n                  883612800, 915148800, 946684800, 978307200, 1009843200,\n                  1041379200, 1072915200, 1104537600, 1136073600, 1167609600,\n                  1199145600, 1230768000, 1262304000, 1293840000])\n            ]\n        )\n\n    def test_min_unique(self):\n        bins = time_binnings(self.dates, min_unique=7)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds[:-1], self.dates)\n\n    def test_add_unique(self):\n        bins = time_binnings(self.dates, add_unique=7)\n        self.assertNotEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds[:-1], self.dates)\n\n    def test_limits(self):\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=9, max_bins=17)},\n            {9, 17})\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=9, max_bins=16)},\n            {9})\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=10, max_bins=17)},\n            {17})\n\n    def test_single_value(self):\n        dates = np.array([42])\n        bins = time_binnings(dates)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds, [42, 43])\n\n    def test_multiple_identical(self):\n        dates = np.array([42] * 5)\n        bins = time_binnings(dates)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds, [42, 43])\n\n    def test_no_values(self):\n        dates = np.array([])\n        self.assertRaises(ValueError, time_binnings, dates)\n\n        dates = np.array([np.nan, np.nan])\n        self.assertRaises(ValueError, time_binnings, dates)\n\n    def test_before_epoch(self):\n        hour = 24 * 60 * 60\n        dates = [-hour, 0, hour,]\n        bins = time_binnings(dates)\n        self.assertEqual(list(bins[0].thresholds), [-hour, 0, hour, 2 * hour])\n\n\nclass TestBinDefinition(unittest.TestCase):\n    def test_labels(self):\n        thresholds = np.array([1, 2, 3.14])\n        self.assertEqual(BinDefinition(thresholds).labels,\n                         [\"1\", \"2\", \"3.14\"])\n        self.assertEqual(BinDefinition(thresholds, \"%.3f\").labels,\n                         [\"1.000\", \"2.000\", \"3.140\"])\n        self.assertEqual(BinDefinition(thresholds, lambda x: f\"b{x:g}\").labels,\n                         [\"b1\", \"b2\", \"b3.14\"])\n        self.assertEqual(BinDefinition(thresholds, list(\"abc\")).labels,\n                         list(\"abc\"))\n\n    def test_width_label(self):\n        thresholds = np.array([1, 2, 3.14])\n        self.assertEqual(BinDefinition(thresholds).width_label, \"\")\n        self.assertEqual(BinDefinition(thresholds, width=3).width_label, \"3\")\n        self.assertEqual(BinDefinition(thresholds, width=3.14).width_label, \"3.14\")\n\n    def test_thresholds(self):\n        thresholds = np.array([1, 2, 3.14])\n        bindef = BinDefinition(thresholds)\n        np.testing.assert_equal(bindef.thresholds, thresholds)\n        self.assertEqual(bindef.start, 1)\n        self.assertEqual(bindef.nbins, 2)\n\n\nclass TestDiscretizer(unittest.TestCase):\n    def test_equality(self):\n        v1 = ContinuousVariable(\"x\")\n        v2 = ContinuousVariable(\"x\", number_of_decimals=42)\n        v3 = ContinuousVariable(\"y\")\n        assert v1 == v2\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [0, 2, 1])\n        t2 = Discretizer(v3, [0, 2, 1])\n        self.assertEqual(t1, t1)\n        self.assertEqual(t1, t1a)\n        self.assertNotEqual(t1, t2)\n\n        self.assertEqual(hash(t1), hash(t1a))\n        self.assertNotEqual(hash(t1), hash(t2))\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [1, 2, 0])\n        self.assertNotEqual(t1, t1a)\n        self.assertNotEqual(hash(t1), hash(t1a))\n\n    def test_fmt_interval(self):\n        def fmt(x):\n            return f\"{x:.2f}\"\n\n        f = Discretizer._fmt_interval\n        self.assertEqual(f(1, 2, str), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt, strip_zeros=False), \"1.00 - 2.00\")\n\n        self.assertEqual(f(-np.inf, 2, fmt), \"< 2\")\n        self.assertEqual(f(-np.inf, 2, fmt, strip_zeros=False), \"< 2.00\")\n        self.assertEqual(f(None, 2, fmt), \"< 2\")\n        self.assertEqual(f(None, 2, fmt, strip_zeros=False), \"< 2.00\")\n\n        self.assertEqual(f(2, np.inf, fmt), \"≥ 2\")\n        self.assertEqual(f(2, np.inf, fmt, strip_zeros=False), \"≥ 2.00\")\n        self.assertEqual(f(2, None, fmt), \"≥ 2\")\n        self.assertEqual(f(2, None, fmt, strip_zeros=False), \"≥ 2.00\")\n\n        with self.assertRaises(ValueError):\n            f(1.122, 1.123, fmt)\n\n\n    def test_get_labels(self):\n        points = [2.46, 2.68, 2.794]\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.1f}\", points),\n            ['< 2.5', '2.5 - 2.7', '2.7 - 2.8', '≥ 2.8']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.2f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.79', '≥ 2.79']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.794', '≥ 2.794']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points,\n                                    strip_zeros=False),\n            ['< 2.4600', '2.4600 - 2.6800', '2.6800 - 2.7940', '≥ 2.7940']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [100, 200]),\n            ['< 100', '100 - 200', '≥ 200']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [0]),\n            ['< 0', '≥ 0']\n        )\n\n    def test_get_discretized_values_empty(self):\n        x = ContinuousVariable(\"x\")\n        d = Discretizer(x, [])\n        points, values, to_sql = d._get_discretized_values(None, np.array([]))\n        self.assertEqual(len(points), 0)\n        self.assertEqual(values, [\"single_value\"])\n        self.assertIsInstance(to_sql, SingleValueSql)\n\n    def test_get_discretized_values_identical_points(self):\n        x = ContinuousVariable(\"x\")\n        with self.assertRaises(ValueError):\n            Discretizer._get_discretized_values(x, np.array([0, 1, 1, 2]))\n\n    def test_get_discretized_values_no_ndigits(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=2)\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2, 3, 4]))\n        np.testing.assert_equal(points, [1, 2, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2.1, 3, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1, 2.1, 3.1234, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3.1234, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3.1234', '3.1234 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            4]))\n        np.testing.assert_equal(points, [1, 2.1000000001, 2.1000000002, 4])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 4',\n                                  '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.100000000211,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n    def test_get_discretized_values_with_ndigits(self):\n        x = ContinuousVariable(\"x\")\n        apoints = [1, 2, 3, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=0)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=2)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1.00', '1.00 - 2.00', '2.00 - 3.00',\n                                  '3.00 - 4.00', '≥ 4.00'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        apoints = [1, 2.1234, 2.1345, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=1)\n        np.testing.assert_array_equal(points, np.array([1, 2.12, 2.13, 4]))\n        self.assertEqual(values,\n                         ['< 1', '1 - 2.12', '2.12 - 2.13', '2.13 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n\nif __name__ == '__main__':\n    unittest.main()\n",
            "new_file_content": "# File contains some long lines; breaking them would decrease readability\n# pylint: disable=line-too-long,too-many-lines,protected-access\nimport calendar\nimport unittest\nfrom unittest.mock import patch\nfrom time import struct_time, mktime\n\nimport numpy as np\n\nfrom Orange.data import ContinuousVariable, TimeVariable, Table, Domain\nfrom Orange.preprocess.discretize import \\\n    _time_binnings, time_binnings, BinDefinition, Discretizer, FixedWidth, \\\n    FixedTimeWidth, Binning, \\\n    TooManyIntervals, SingleValueSql, BinSql\n\n\nclass TestFixedWidth(unittest.TestCase):\n    def test_discretization(self):\n        x = np.array([[0.21, 0.335, 0, 0.26, np.nan],\n                      [0] * 5,\n                      [np.nan] * 5]).T\n        domain = Domain([ContinuousVariable(f\"c{i}\") for i in range(x.shape[1])])\n        data = Table.from_numpy(domain, x, None)\n\n        dvar = FixedWidth(0.1, 2)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points,\n                                       (0.1, 0.2, 0.3))\n        self.assertEqual(dvar.values,\n                         ('< 0.10', '0.10 - 0.20', '0.20 - 0.30', '≥ 0.30'))\n\n        dvar = FixedWidth(0.2, 1)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, (0.2, ))\n        self.assertEqual(dvar.values, ('< 0.2', '≥ 0.2'))\n\n        dvar = FixedWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedWidth(0.11, 2)(data, 1)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedWidth(0.11, 2)(data, 2)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        self.assertRaises(TooManyIntervals, FixedWidth(0.0001, 1), data, 0)\n\n\nclass TestFixedTimeWidth(unittest.TestCase):\n    def test_discretization(self):\n        t = TimeVariable(\"t\")\n        x = np.array([[t.to_val(\"1914\"), t.to_val(\"1945\"), np.nan],\n                      [t.to_val(\"1914\"), t.to_val(\"1914\"), np.nan],\n                      [np.nan, np.nan, np.nan],\n                      ]).T\n        domain = Domain([t, TimeVariable(\"t2\"), TimeVariable(\"t3\")])\n        data = Table.from_numpy(domain, x, None)\n\n        dvar = FixedTimeWidth(10, 1)(data, 1)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedTimeWidth(10, 2)(data, 2)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        self.assertRaises(TooManyIntervals, FixedWidth(0.0001, 1), data, 0)\n\n        dvar = FixedTimeWidth(10, 0)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(str(y))) for y in (1920, 1930, 1940)])\n        self.assertEqual(dvar.values,\n                         ('< 1920', '1920 - 1930', '1930 - 1940', '≥ 1940'))\n\n        dvar = FixedTimeWidth(5, 0)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(str(y))) for y in (1915, 1920, 1925, 1930, 1935,\n                                             1940, 1945)])\n        self.assertEqual(dvar.values,\n                         ('< 1915', '1915 - 1920', '1920 - 1925', '1925 - 1930',\n                          '1930 - 1935', '1935 - 1940', '1940 - 1945', '≥ 1945')\n                         )\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-07-28\"), t.to_val(\"1918-11-11\")]]).T)\n        dvar = FixedTimeWidth(6, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1915-01-01\", \"1915-07-01\",\n                                        \"1916-01-01\", \"1916-07-01\",\n                                        \"1917-01-01\", \"1917-07-01\",\n                                        \"1918-01-01\", \"1918-07-01\")])\n        self.assertEqual(dvar.values,\n                         ('< 15 Jan', '15 Jan - Jul', '15 Jul - 16 Jan',\n                          '16 Jan - Jul', '16 Jul - 17 Jan', '17 Jan - Jul',\n                          '17 Jul - 18 Jan', '18 Jan - Jul', '≥ 18 Jul'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-07-28\"), t.to_val(\"1914-11-11\")]]).T)\n        dvar = FixedTimeWidth(6, 1)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedTimeWidth(2, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-09-01\", \"1914-11-01\")])\n        self.assertEqual(dvar.values, ('< Sep', 'Sep - Nov', '≥ Nov'))\n\n        dvar = FixedTimeWidth(1, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-08-01\", \"1914-09-01\",\n                                        \"1914-10-01\", \"1914-11-01\")])\n        self.assertEqual(dvar.values, ('< Aug', 'Aug - Sep', 'Sep - Oct',\n                                       'Oct - Nov', '≥ Nov'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-07-04 15:25\")]]).T)\n        dvar = FixedTimeWidth(2, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29\", \"1914-07-01\",\n                                        \"1914-07-03\")])\n        self.assertEqual(dvar.values, ('< Jun 29', 'Jun 29 - Jul 01',\n                                       'Jul 01 - Jul 03', '≥ Jul 03'))\n\n        dvar = FixedTimeWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29\", \"1914-06-30\",\n                                        \"1914-07-01\", \"1914-07-02\",\n                                        \"1914-07-03\", \"1914-07-04\")])\n        self.assertEqual(dvar.values, ('< Jun 29', 'Jun 29 - Jun 30',\n                                       'Jun 30 - Jul 01', 'Jul 01 - Jul 02',\n                                        'Jul 02 - Jul 03', 'Jul 03 - Jul 04',\n                                        '≥ Jul 04'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-12-30 22:45\"),\n                       t.to_val(\"1915-01-02 15:25\")]]).T)\n        dvar = FixedTimeWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-12-31\", \"1915-01-01\",\n                                        \"1915-01-02\")])\n        self.assertEqual(dvar.values, ('< 14 Dec 31',\n                                       '14 Dec 31 - 15 Jan 01',\n                                       '15 Jan 01 - Jan 02', '≥ 15 Jan 02'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-06-28 15:25\")]]).T)\n        dvar = FixedTimeWidth(2, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 12:00\", \"1914-06-28 14:00\")])\n        self.assertEqual(dvar.values, ('< 12:00', '12:00 - 14:00', '≥ 14:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-06-28 15:25\")]]).T)\n        dvar = FixedTimeWidth(1, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 11:00\", \"1914-06-28 12:00\",\n                                        \"1914-06-28 13:00\", \"1914-06-28 14:00\",\n                                        \"1914-06-28 15:00\")])\n        self.assertEqual(dvar.values, ('< 11:00', '11:00 - 12:00',\n                                       '12:00 - 13:00', '13:00 - 14:00',\n                                       '14:00 - 15:00', '≥ 15:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 22:45\"),\n                       t.to_val(\"1914-06-29 03:25\")]]).T)\n        dvar = FixedTimeWidth(1, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 23:00\", \"1914-06-29 00:00\",\n                                        \"1914-06-29 01:00\", \"1914-06-29 02:00\",\n                                        \"1914-06-29 03:00\")])\n        self.assertEqual(dvar.values, ('< Jun 28 23:00',\n                                       'Jun 28 23:00 - Jun 29 00:00',\n                                       'Jun 29 00:00 - 01:00',\n                                       'Jun 29 01:00 - 02:00',\n                                       'Jun 29 02:00 - 03:00',\n                                       '≥ Jun 29 03:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 22:43\"),\n                       t.to_val(\"1914-06-28 23:01\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 22:45\", \"1914-06-28 22:50\",\n                                        \"1914-06-28 22:55\", \"1914-06-28 23:00\")])\n        self.assertEqual(dvar.values, ('< 22:45', \"22:45 - 22:50\",\n                                       \"22:50 - 22:55\", \"22:55 - 23:00\",\n                                       '≥ 23:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-30 23:48\"),\n                       t.to_val(\"1914-07-01 00:06\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-30 23:50\", \"1914-06-30 23:55\",\n                                        \"1914-07-01 00:00\", \"1914-07-01 00:05\")])\n        self.assertEqual(dvar.values, ('< Jun 30 23:50', \"Jun 30 23:50 - 23:55\",\n                                       \"Jun 30 23:55 - Jul 01 00:00\",\n                                       \"Jul 01 00:00 - 00:05\", '≥ Jul 01 00:05'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48\"),\n                       t.to_val(\"1914-06-30 00:06\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:50\", \"1914-06-29 23:55\",\n                                        \"1914-06-30 00:00\", \"1914-06-30 00:05\")])\n        self.assertEqual(dvar.values, ('< Jun 29 23:50', \"Jun 29 23:50 - 23:55\",\n                                       \"Jun 29 23:55 - Jun 30 00:00\",\n                                       \"Jun 30 00:00 - 00:05\", '≥ Jun 30 00:05'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48:05\"),\n                       t.to_val(\"1914-06-29 23:51:59\")]]).T)\n        dvar = FixedTimeWidth(1, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:49\", \"1914-06-29 23:50\",\n                                        \"1914-06-29 23:51\")])\n        self.assertEqual(dvar.values, ('< 23:49', \"23:49 - 23:50\",\n                                       \"23:50 - 23:51\", '≥ 23:51'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48:05.123\"),\n                       t.to_val(\"1914-06-29 23:48:33.684\")]]).T)\n        dvar = FixedTimeWidth(10, 5)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:48:10\",\n                                        \"1914-06-29 23:48:20\",\n                                        \"1914-06-29 23:48:30\")])\n        self.assertEqual(dvar.values, ('< 23:48:10', \"23:48:10 - 23:48:20\",\n                                       \"23:48:20 - 23:48:30\", '≥ 23:48:30'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-12-31 23:59:58.1\"),\n                       t.to_val(\"1915-01-01 00:00:01.8\")]]).T)\n        dvar = FixedTimeWidth(1, 5)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-12-31 23:59:59\",\n                                        \"1915-01-01 00:00:00\",\n                                        \"1915-01-01 00:00:01\")])\n        self.assertEqual(dvar.values, ('< 23:59:59', \"23:59:59 - 00:00:00\",\n                                       \"00:00:00 - 00:00:01\", '≥ 00:00:01'))\n\n        self.assertRaises(TooManyIntervals, FixedTimeWidth(0.0001, 5), data, 0)\n\n\nclass TestBinningDiscretizer(unittest.TestCase):\n    def test_no_data(self):\n        no_data = Table(Domain([ContinuousVariable(\"y\")]), np.zeros((0, 1)))\n        dvar = Binning()(no_data, 0)\n        self.assertEqual(dvar.compute_value.points, [])\n\n    @patch(\"Orange.preprocess.discretize.time_binnings\")\n    @patch(\"Orange.preprocess.discretize.decimal_binnings\")\n    @patch(\"Orange.preprocess.discretize.Binning._create_binned_var\")\n    def test_call(self, _, decbin, timebin):\n        data = Table(Domain([ContinuousVariable(\"y\"), TimeVariable(\"t\")]),\n                     np.array([[1, 2], [3, 4]]))\n\n        Binning(5)(data, 0)\n        timebin.assert_not_called()\n        self.assertEqual(list(decbin.call_args[0][0]), [1, 3])\n        decbin.reset_mock()\n\n        Binning(5)(data, 1)\n        decbin.assert_not_called()\n        self.assertEqual(list(timebin.call_args[0][0]), [2, 4])\n\n    def test_binning_selection(self):\n        var = ContinuousVariable(\"y\")\n        discretize = Binning(2)\n        # pylint: disable=redefined-outer-name\n        create = discretize._create_binned_var\n\n        binnings = []\n        self.assertEqual(create(binnings, var).compute_value.points, [])\n\n        binnings = None\n        self.assertEqual(create(binnings, var).compute_value.points, [])\n\n        binnings = [\n            BinDefinition(np.arange(i + 1),\n                          [f\"t{x}\" for x in range(i + 1)],\n                          [f\"t{x}\" for x in range(i + 1)],\n                          1 / i, str(i)\n                          )\n            for i in (3, 5, 10, 20)\n        ]\n\n        for discretize.n in (2, 3):\n            self.assertEqual(create(binnings, var).values,\n                             ('< t1', \"t1 - t2\", \"≥ t2\"))\n\n        for discretize.n in (4, 5, 6, 7):\n            self.assertEqual(create(binnings, var).values,\n                             ('< t1', \"t1 - t2\", \"t2 - t3\", \"t3 - t4\", \"≥ t4\"))\n\n        for discretize.n in range(8, 15):\n            self.assertEqual(len(create(binnings, var).values), 10)\n\n        for discretize.n in range(16, 25):\n            self.assertEqual(len(create(binnings, var).values), 20)\n\n\n# pylint: disable=redefined-builtin\ndef create(year=1970, month=1, day=1, hour=0, min=0, sec=0):\n    return struct_time((year, month, day, hour, min, sec, 0, 0, 0))\n\n\nclass TestTimeBinning(unittest.TestCase):\n    def setUp(self):\n        self.dates = [mktime(x) for x in\n                      [(1975, 6, 9, 10, 0, 0, 0, 161, 0),\n                       (1975, 6, 9, 10, 50, 0, 0, 161, 0),\n                       (1975, 6, 9, 11, 40, 0, 0, 161, 0),\n                       (1975, 6, 9, 12, 30, 0, 0, 161, 0),\n                       (1975, 6, 9, 13, 20, 0, 0, 161, 0),\n                       (1975, 6, 9, 14, 10, 0, 0, 161, 0)]]\n\n    def test_binning(self):\n        def tr1(s):\n            for localname, engname in zip(\n                    calendar.month_abbr[1:],\n                    \"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec\".split()):\n                s = s.replace(localname, engname)\n            return s\n\n        def tr2(ss):\n            return list(map(tr1, ss))\n\n        def testbin(start, end):\n            bins = _time_binnings(create(*start), create(*end), 3, 51)\n            return [(bin.width_label, tr2(bin.short_labels),\n                     list(bin.thresholds))\n                    for bin in reversed(bins)]\n\n        self.assertEqual(\n            testbin((1975, 4, 2), (1989, 3, 1)),\n            [('10 years',\n              ['1970', '1980', '1990'],\n              [0, 315532800, 631152000]),\n             ('5 years',\n              ['1975', '1980', '1985', '1990'],\n              [157766400, 315532800, 473385600, 631152000]),\n             ('2 years',\n              ['1974', '1976', '1978', '1980', '1982', '1984', '1986', '1988',\n               '1990'],\n              [126230400, 189302400, 252460800, 315532800, 378691200, 441763200,\n               504921600, 567993600, 631152000]),\n             ('1 year',\n              ['1975', '1976', '1977', '1978', '1979', '1980', '1981', '1982',\n               '1983', '1984', '1985', '1986', '1987', '1988', '1989', '1990'],\n              [157766400, 189302400, 220924800, 252460800, 283996800, 315532800,\n               347155200, 378691200, 410227200, 441763200, 473385600, 504921600,\n               536457600, 567993600, 599616000, 631152000]),\n             ('6 months',\n              ['75 Jan', 'Jul', '76 Jan', 'Jul', '77 Jan', 'Jul', '78 Jan',\n               'Jul', '79 Jan', 'Jul', '80 Jan', 'Jul', '81 Jan', 'Jul',\n               '82 Jan', 'Jul', '83 Jan', 'Jul', '84 Jan', 'Jul', '85 Jan',\n               'Jul', '86 Jan', 'Jul', '87 Jan', 'Jul', '88 Jan', 'Jul',\n               '89 Jan', 'Jul'],\n              [157766400, 173404800, 189302400, 205027200, 220924800, 236563200,\n               252460800, 268099200, 283996800, 299635200, 315532800, 331257600,\n               347155200, 362793600, 378691200, 394329600, 410227200, 425865600,\n               441763200, 457488000, 473385600, 489024000, 504921600, 520560000,\n               536457600, 552096000, 567993600, 583718400, 599616000,\n               615254400])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 4, 2), (1978, 3, 1)),\n            [('2 years',\n              ['1974', '1976', '1978', '1980'],\n              [126230400, 189302400, 252460800, 315532800]),\n             ('1 year',\n              ['1975', '1976', '1977', '1978', '1979'],\n              [157766400, 189302400, 220924800, 252460800, 283996800]),\n             ('6 months',\n              ['75 Jan', 'Jul',\n               '76 Jan', 'Jul',\n               '77 Jan', 'Jul',\n               '78 Jan', 'Jul'],\n              [157766400, 173404800, 189302400, 205027200, 220924800, 236563200,\n               252460800, 268099200]),\n             ('3 months',\n              ['75 Apr', 'Jul', 'Oct',\n               '76 Jan', 'Apr', 'Jul', 'Oct',\n               '77 Jan', 'Apr', 'Jul', 'Oct',\n               '78 Jan', 'Apr'],\n              [165542400, 173404800, 181353600, 189302400, 197164800, 205027200,\n               212976000, 220924800, 228700800, 236563200, 244512000, 252460800,\n               260236800]),\n             ('2 months',\n              ['75 Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '76 Jan', 'Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '77 Jan', 'Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '78 Jan', 'Mar', 'May'],\n              [162864000, 168134400, 173404800, 178761600, 184032000, 189302400,\n               194486400, 199756800, 205027200, 210384000, 215654400, 220924800,\n               226022400, 231292800, 236563200, 241920000, 247190400, 252460800,\n               257558400, 262828800]),\n             ('1 month',\n              ['75 Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '76 Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '77 Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '78 Jan', 'Feb', 'Mar', 'Apr'],\n              [165542400, 168134400, 170812800, 173404800, 176083200, 178761600,\n               181353600, 184032000, 186624000, 189302400, 191980800, 194486400,\n               197164800, 199756800, 202435200, 205027200, 207705600, 210384000,\n               212976000, 215654400, 218246400, 220924800, 223603200, 226022400,\n               228700800, 231292800, 233971200, 236563200, 239241600, 241920000,\n               244512000, 247190400, 249782400, 252460800, 255139200, 257558400,\n               260236800])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 2), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('2 weeks',\n              ['75 Dec 03', '17', '31', '76 Jan 14'],\n              [186796800, 188006400, 189216000, 190425600]),\n             ('1 week',\n              ['75 Dec 03', '10', '17', '24', '31',\n               '76 Jan 07'],\n              [186796800, 187401600, 188006400, 188611200, 189216000,\n               189820800]),\n             ('1 day',\n              ['75 Dec 02', '03', '04', '05', '06', '07', '08', '09', '10',\n               '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21',\n               '22', '23', '24', '25', '26', '27', '28', '29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [186710400, 186796800, 186883200, 186969600, 187056000, 187142400,\n               187228800, 187315200, 187401600, 187488000, 187574400, 187660800,\n               187747200, 187833600, 187920000, 188006400, 188092800, 188179200,\n               188265600, 188352000, 188438400, 188524800, 188611200, 188697600,\n               188784000, 188870400, 188956800, 189043200, 189129600, 189216000,\n               189302400, 189388800, 189475200, 189561600])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 25), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('1 day',\n              ['75 Dec 25', '26', '27', '28', '29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [188697600, 188784000, 188870400, 188956800, 189043200, 189129600,\n               189216000, 189302400, 189388800, 189475200, 189561600]),\n             ('12 hours',\n              ['75 Dec 25 00:00', '12:00',\n               '26 00:00', '12:00',\n               '27 00:00', '12:00',\n               '28 00:00', '12:00',\n               '29 00:00', '12:00',\n               '30 00:00', '12:00',\n               '31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00', '12:00',\n               '03 00:00', '12:00'],\n              [188697600, 188740800, 188784000, 188827200, 188870400, 188913600,\n               188956800, 189000000, 189043200, 189086400, 189129600, 189172800,\n               189216000, 189259200, 189302400, 189345600, 189388800, 189432000,\n               189475200, 189518400]),\n             ('6 hours',\n              ['75 Dec 25 00:00', '06:00', '12:00', '18:00',\n               '26 00:00', '06:00', '12:00', '18:00',\n               '27 00:00', '06:00', '12:00', '18:00',\n               '28 00:00', '06:00', '12:00', '18:00',\n               '29 00:00', '06:00', '12:00', '18:00',\n               '30 00:00', '06:00', '12:00', '18:00',\n               '31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00',\n               '02 00:00', '06:00', '12:00', '18:00',\n               '03 00:00', '06:00'],\n              [188697600, 188719200, 188740800, 188762400, 188784000, 188805600,\n               188827200, 188848800, 188870400, 188892000, 188913600, 188935200,\n               188956800, 188978400, 189000000, 189021600, 189043200, 189064800,\n               189086400, 189108000, 189129600, 189151200, 189172800, 189194400,\n               189216000, 189237600, 189259200, 189280800, 189302400, 189324000,\n               189345600, 189367200, 189388800, 189410400, 189432000, 189453600,\n               189475200, 189496800])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 29), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('1 day',\n              ['75 Dec 29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [189043200, 189129600, 189216000, 189302400, 189388800, 189475200,\n               189561600]),\n             ('12 hours',\n              ['75 Dec 29 00:00', '12:00',\n               '30 00:00', '12:00',\n               '31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00', '12:00',\n               '03 00:00', '12:00'],\n              [189043200, 189086400, 189129600, 189172800, 189216000, 189259200,\n               189302400, 189345600, 189388800, 189432000, 189475200,\n               189518400]),\n             ('6 hours',\n              ['75 Dec 29 00:00', '06:00', '12:00', '18:00',\n               '30 00:00', '06:00', '12:00', '18:00',\n               '31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00',\n               '02 00:00', '06:00', '12:00', '18:00',\n               '03 00:00', '06:00'],\n              [189043200, 189064800, 189086400, 189108000, 189129600, 189151200,\n               189172800, 189194400, 189216000, 189237600, 189259200, 189280800,\n               189302400, 189324000, 189345600, 189367200, 189388800, 189410400,\n               189432000, 189453600, 189475200, 189496800]),\n             ('3 hours',\n              ['75 Dec 29 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '30 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '31 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '02 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '03 00:00', '03:00'],\n              [189043200, 189054000, 189064800, 189075600, 189086400, 189097200,\n               189108000, 189118800, 189129600, 189140400, 189151200, 189162000,\n               189172800, 189183600, 189194400, 189205200, 189216000, 189226800,\n               189237600, 189248400, 189259200, 189270000, 189280800, 189291600,\n               189302400, 189313200, 189324000, 189334800, 189345600, 189356400,\n               189367200, 189378000, 189388800, 189399600, 189410400, 189421200,\n               189432000, 189442800, 189453600, 189464400, 189475200,\n               189486000])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 0, 0, 0), (1976, 1, 1, 14, 30)),\n            [('1 day',\n              ['75 Dec 31', '76 Jan 01', '02'],\n              [189216000, 189302400, 189388800]),\n             ('12 hours',\n              ['75 Dec 31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00'],\n              [189216000, 189259200, 189302400, 189345600, 189388800]),\n             ('6 hours',\n              ['75 Dec 31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00'],\n              [189216000, 189237600, 189259200, 189280800, 189302400, 189324000,\n               189345600, 189367200]),\n             ('3 hours',\n              ['75 Dec 31 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00', '06:00', '09:00', '12:00', '15:00'],\n              [189216000, 189226800, 189237600, 189248400, 189259200, 189270000,\n               189280800, 189291600, 189302400, 189313200, 189324000, 189334800,\n               189345600, 189356400]),\n             ('2 hours',\n              ['75 Dec 31 00:00', '02:00', '04:00', '06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00',\n               '76 Jan 01 00:00', '02:00', '04:00', '06:00', '08:00', '10:00', '12:00', '14:00', '16:00'],\n              [189216000, 189223200, 189230400, 189237600, 189244800, 189252000,\n               189259200, 189266400, 189273600, 189280800, 189288000, 189295200,\n               189302400, 189309600, 189316800, 189324000, 189331200, 189338400,\n               189345600, 189352800, 189360000]),\n             ('1 hour',\n              ['75 Dec 31 00:00', '01:00', '02:00', '03:00', '04:00', '05:00',\n               '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00',\n               '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00',\n               '20:00', '21:00', '22:00', '23:00',\n               '76 Jan 01 00:00', '01:00', '02:00', '03:00', '04:00', '05:00',\n               '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00',\n               '13:00', '14:00', '15:00'],\n              [189216000, 189219600, 189223200, 189226800, 189230400, 189234000,\n               189237600, 189241200, 189244800, 189248400, 189252000, 189255600,\n               189259200, 189262800, 189266400, 189270000, 189273600, 189277200,\n               189280800, 189284400, 189288000, 189291600, 189295200, 189298800,\n               189302400, 189306000, 189309600, 189313200, 189316800, 189320400,\n               189324000, 189327600, 189331200, 189334800, 189338400, 189342000,\n               189345600, 189349200, 189352800, 189356400])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 6), (1976, 1, 1)),\n            [('1 day',\n              ['75 Dec 31', '76 Jan 01', '02'],\n              [189216000, 189302400, 189388800]),\n             ('12 hours',\n              ['75 Dec 31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00'],\n              [189216000, 189259200, 189302400, 189345600]),\n             ('6 hours',\n              ['75 Dec 31 06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00'],\n              [189237600, 189259200, 189280800, 189302400, 189324000]),\n             ('3 hours',\n              ['75 Dec 31 06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00'],\n              [189237600, 189248400, 189259200, 189270000, 189280800, 189291600,\n               189302400, 189313200]),\n             ('2 hours',\n              ['75 Dec 31 06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00',\n               '76 Jan 01 00:00', '02:00'],\n              [189237600, 189244800, 189252000, 189259200, 189266400, 189273600,\n               189280800, 189288000, 189295200, 189302400, 189309600]),\n             ('1 hour',\n              ['75 Dec 31 06:00', '07:00', '08:00', '09:00', '10:00', '11:00',\n               '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00',\n               '19:00', '20:00', '21:00', '22:00', '23:00',\n               '76 Jan 01 00:00', '01:00'],\n              [189237600, 189241200, 189244800, 189248400, 189252000, 189255600,\n               189259200, 189262800, 189266400, 189270000, 189273600, 189277200,\n               189280800, 189284400, 189288000, 189291600, 189295200, 189298800,\n               189302400, 189306000]),\n             ('30 minutes',\n              ['Dec 31 06:00', '06:30', '07:00', '07:30', '08:00', '08:30',\n               '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00',\n               '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30',\n               '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00',\n               '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30',\n               '23:00', '23:30',\n               'Jan 01 00:00', '00:30'],\n              [189237600, 189239400, 189241200, 189243000, 189244800, 189246600,\n               189248400, 189250200, 189252000, 189253800, 189255600, 189257400,\n               189259200, 189261000, 189262800, 189264600, 189266400, 189268200,\n               189270000, 189271800, 189273600, 189275400, 189277200, 189279000,\n               189280800, 189282600, 189284400, 189286200, 189288000, 189289800,\n               189291600, 189293400, 189295200, 189297000, 189298800, 189300600,\n               189302400, 189304200])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 23), (1976, 1, 1, 2)),\n            [('3 hours',\n              ['75 Dec 31 21:00',\n               '76 Jan 01 00:00', '03:00'],\n              [189291600, 189302400, 189313200]),\n             ('2 hours',\n              ['75 Dec 31 22:00',\n               '76 Jan 01 00:00', '02:00', '04:00'],\n              [189295200, 189302400, 189309600, 189316800]),\n             ('1 hour',\n              ['75 Dec 31 23:00',\n               '76 Jan 01 00:00', '01:00', '02:00', '03:00'],\n              [189298800, 189302400, 189306000, 189309600, 189313200]),\n             ('30 minutes',\n              ['Dec 31 23:00', '23:30',\n               'Jan 01 00:00', '00:30', '01:00', '01:30', '02:00', '02:30'],\n              [189298800, 189300600, 189302400, 189304200, 189306000, 189307800,\n               189309600, 189311400]),\n             ('15 minutes',\n              ['Dec 31 23:00', '23:15', '23:30', '23:45',\n               'Jan 01 00:00', '00:15', '00:30', '00:45', '01:00', '01:15',\n               '01:30', '01:45', '02:00', '02:15'],\n              [189298800, 189299700, 189300600, 189301500, 189302400, 189303300,\n               189304200, 189305100, 189306000, 189306900, 189307800, 189308700,\n               189309600, 189310500]),\n             ('10 minutes',\n              ['Dec 31 23:00', '23:10', '23:20', '23:30', '23:40', '23:50',\n               'Jan 01 00:00', '00:10', '00:20', '00:30', '00:40', '00:50',\n               '01:00', '01:10', '01:20', '01:30', '01:40', '01:50', '02:00',\n               '02:10'],\n              [189298800, 189299400, 189300000, 189300600, 189301200, 189301800,\n               189302400, 189303000, 189303600, 189304200, 189304800, 189305400,\n               189306000, 189306600, 189307200, 189307800, 189308400, 189309000,\n               189309600, 189310200]),\n             ('5 minutes',\n              ['Dec 31 23:00', '23:05', '23:10', '23:15', '23:20', '23:25',\n               '23:30', '23:35', '23:40', '23:45', '23:50', '23:55',\n               'Jan 01 00:00', '00:05', '00:10', '00:15', '00:20', '00:25',\n               '00:30', '00:35', '00:40', '00:45', '00:50', '00:55', '01:00',\n               '01:05', '01:10', '01:15', '01:20', '01:25', '01:30', '01:35',\n               '01:40', '01:45', '01:50', '01:55', '02:00', '02:05'],\n              [189298800, 189299100, 189299400, 189299700, 189300000, 189300300,\n               189300600, 189300900, 189301200, 189301500, 189301800, 189302100,\n               189302400, 189302700, 189303000, 189303300, 189303600, 189303900,\n               189304200, 189304500, 189304800, 189305100, 189305400, 189305700,\n               189306000, 189306300, 189306600, 189306900, 189307200, 189307500,\n               189307800, 189308100, 189308400, 189308700, 189309000, 189309300,\n               189309600, 189309900])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 23, 18)),\n            [('12 hours',\n              ['Jun 09 00:00', '12:00', '10 00:00'],\n              [-1437868800, -1437825600, -1437782400]),\n             ('6 hours',\n              ['Jun 09 06:00', '12:00', '18:00', '10 00:00'],\n              [-1437847200, -1437825600, -1437804000, -1437782400]),\n             ('3 hours',\n              ['Jun 09 09:00', '12:00', '15:00', '18:00', '21:00', '10 00:00'],\n              [-1437836400, -1437825600, -1437814800, -1437804000, -1437793200,\n               -1437782400]),\n             ('2 hours',\n              ['Jun 09 10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '10 00:00'],\n              [-1437832800, -1437825600, -1437818400, -1437811200, -1437804000,\n               -1437796800, -1437789600, -1437782400]),\n             ('1 hour',\n              ['Jun 09 10:00', '11:00', '12:00', '13:00', '14:00', '15:00',\n               '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00',\n               '23:00',\n               '10 00:00'],\n              [-1437832800, -1437829200, -1437825600, -1437822000, -1437818400,\n               -1437814800, -1437811200, -1437807600, -1437804000, -1437800400,\n               -1437796800, -1437793200, -1437789600, -1437786000,\n               -1437782400]),\n             ('30 minutes',\n              ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',\n               '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30',\n               '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',\n               '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30'],\n              [-1437832800, -1437831000, -1437829200, -1437827400, -1437825600,\n               -1437823800, -1437822000, -1437820200, -1437818400, -1437816600,\n               -1437814800, -1437813000, -1437811200, -1437809400, -1437807600,\n               -1437805800, -1437804000, -1437802200, -1437800400, -1437798600,\n               -1437796800, -1437795000, -1437793200, -1437791400, -1437789600,\n               -1437787800, -1437786000, -1437784200])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 13, 18)),\n            [('2 hours',\n              ['10:00', '12:00', '14:00'],\n              [-1437832800, -1437825600, -1437818400]),\n             ('1 hour',\n              ['10:00', '11:00', '12:00', '13:00', '14:00'],\n              [-1437832800, -1437829200, -1437825600, -1437822000,\n               -1437818400]),\n             ('30 minutes',\n              ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',\n               '13:30'],\n              [-1437832800, -1437831000, -1437829200, -1437827400, -1437825600,\n               -1437823800, -1437822000, -1437820200]),\n             ('15 minutes',\n              ['10:00', '10:15', '10:30', '10:45', '11:00', '11:15', '11:30',\n               '11:45', '12:00', '12:15', '12:30', '12:45', '13:00', '13:15',\n               '13:30'],\n              [-1437832800, -1437831900, -1437831000, -1437830100, -1437829200,\n               -1437828300, -1437827400, -1437826500, -1437825600, -1437824700,\n               -1437823800, -1437822900, -1437822000, -1437821100,\n               -1437820200]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30', '10:40', '10:50', '11:00',\n               '11:10', '11:20', '11:30', '11:40', '11:50', '12:00', '12:10',\n               '12:20', '12:30', '12:40', '12:50', '13:00', '13:10', '13:20'],\n              [-1437832800, -1437832200, -1437831600, -1437831000, -1437830400,\n               -1437829800, -1437829200, -1437828600, -1437828000, -1437827400,\n               -1437826800, -1437826200, -1437825600, -1437825000, -1437824400,\n               -1437823800, -1437823200, -1437822600, -1437822000, -1437821400,\n               -1437820800]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30',\n               '10:35', '10:40', '10:45', '10:50', '10:55', '11:00', '11:05',\n               '11:10', '11:15', '11:20', '11:25', '11:30', '11:35', '11:40',\n               '11:45', '11:50', '11:55', '12:00', '12:05', '12:10', '12:15',\n               '12:20', '12:25', '12:30', '12:35', '12:40', '12:45', '12:50',\n               '12:55', '13:00', '13:05', '13:10', '13:15', '13:20'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300, -1437831000, -1437830700, -1437830400, -1437830100,\n               -1437829800, -1437829500, -1437829200, -1437828900, -1437828600,\n               -1437828300, -1437828000, -1437827700, -1437827400, -1437827100,\n               -1437826800, -1437826500, -1437826200, -1437825900, -1437825600,\n               -1437825300, -1437825000, -1437824700, -1437824400, -1437824100,\n               -1437823800, -1437823500, -1437823200, -1437822900, -1437822600,\n               -1437822300, -1437822000, -1437821700, -1437821400, -1437821100,\n               -1437820800])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 10, 48)),\n            [('30 minutes',\n              ['10:00', '10:30', '11:00'],\n              [-1437832800, -1437831000, -1437829200]),\n             ('15 minutes',\n              ['10:00', '10:15', '10:30', '10:45', '11:00'],\n              [-1437832800, -1437831900, -1437831000, -1437830100,\n               -1437829200]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30', '10:40', '10:50'],\n              [-1437832800, -1437832200, -1437831600, -1437831000, -1437830400,\n               -1437829800]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30',\n               '10:35', '10:40', '10:45', '10:50'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300, -1437831000, -1437830700, -1437830400, -1437830100,\n               -1437829800]),\n             ('1 minute',\n              ['10:00', '10:01', '10:02', '10:03', '10:04', '10:05', '10:06',\n               '10:07', '10:08', '10:09', '10:10', '10:11', '10:12', '10:13',\n               '10:14', '10:15', '10:16', '10:17', '10:18', '10:19', '10:20',\n               '10:21', '10:22', '10:23', '10:24', '10:25', '10:26', '10:27',\n               '10:28', '10:29', '10:30', '10:31', '10:32', '10:33', '10:34',\n               '10:35', '10:36', '10:37', '10:38', '10:39', '10:40', '10:41',\n               '10:42', '10:43', '10:44', '10:45', '10:46', '10:47', '10:48',\n               '10:49'],\n              [-1437832800, -1437832740, -1437832680, -1437832620, -1437832560,\n               -1437832500, -1437832440, -1437832380, -1437832320, -1437832260,\n               -1437832200, -1437832140, -1437832080, -1437832020, -1437831960,\n               -1437831900, -1437831840, -1437831780, -1437831720, -1437831660,\n               -1437831600, -1437831540, -1437831480, -1437831420, -1437831360,\n               -1437831300, -1437831240, -1437831180, -1437831120, -1437831060,\n               -1437831000, -1437830940, -1437830880, -1437830820, -1437830760,\n               -1437830700, -1437830640, -1437830580, -1437830520, -1437830460,\n               -1437830400, -1437830340, -1437830280, -1437830220, -1437830160,\n               -1437830100, -1437830040, -1437829980, -1437829920, -1437829860]\n              )]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 10, 20)),\n            [('15 minutes',\n              ['10:00', '10:15', '10:30'],\n              [-1437832800, -1437831900, -1437831000]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30'],\n              [-1437832800, -1437832200, -1437831600, -1437831000]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300]),\n             ('1 minute',\n              ['10:00', '10:01', '10:02', '10:03', '10:04', '10:05', '10:06',\n               '10:07', '10:08', '10:09', '10:10', '10:11', '10:12', '10:13',\n               '10:14', '10:15', '10:16', '10:17', '10:18', '10:19', '10:20',\n               '10:21'],\n              [-1437832800, -1437832740, -1437832680, -1437832620, -1437832560,\n               -1437832500, -1437832440, -1437832380, -1437832320, -1437832260,\n               -1437832200, -1437832140, -1437832080, -1437832020, -1437831960,\n               -1437831900, -1437831840, -1437831780, -1437831720, -1437831660,\n               -1437831600, -1437831540]),\n             ('30 seconds',\n              ['10:00:00', '10:00:30', '10:01:00', '10:01:30', '10:02:00',\n               '10:02:30', '10:03:00', '10:03:30', '10:04:00', '10:04:30',\n               '10:05:00', '10:05:30', '10:06:00', '10:06:30', '10:07:00',\n               '10:07:30', '10:08:00', '10:08:30', '10:09:00', '10:09:30',\n               '10:10:00', '10:10:30', '10:11:00', '10:11:30', '10:12:00',\n               '10:12:30', '10:13:00', '10:13:30', '10:14:00', '10:14:30',\n               '10:15:00', '10:15:30', '10:16:00', '10:16:30', '10:17:00',\n               '10:17:30', '10:18:00', '10:18:30', '10:19:00', '10:19:30',\n               '10:20:00', '10:20:30'],\n              [-1437832800, -1437832770, -1437832740, -1437832710, -1437832680,\n               -1437832650, -1437832620, -1437832590, -1437832560, -1437832530,\n               -1437832500, -1437832470, -1437832440, -1437832410, -1437832380,\n               -1437832350, -1437832320, -1437832290, -1437832260, -1437832230,\n               -1437832200, -1437832170, -1437832140, -1437832110, -1437832080,\n               -1437832050, -1437832020, -1437831990, -1437831960, -1437831930,\n               -1437831900, -1437831870, -1437831840, -1437831810, -1437831780,\n               -1437831750, -1437831720, -1437831690, -1437831660, -1437831630,\n               -1437831600, -1437831570])])\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10, 12, 33), (1924, 6, 9, 10, 18, 12)),\n            [('5 minutes',\n              ['10:10', '10:15', '10:20'],\n              [-1437832200, -1437831900, -1437831600]),\n             ('1 minute',\n              ['10:12', '10:13', '10:14', '10:15', '10:16', '10:17', '10:18',\n               '10:19'],\n              [-1437832080, -1437832020, -1437831960, -1437831900, -1437831840,\n               -1437831780, -1437831720, -1437831660]),\n             ('30 seconds',\n              ['10:12:30', '10:13:00', '10:13:30', '10:14:00', '10:14:30',\n               '10:15:00', '10:15:30', '10:16:00', '10:16:30', '10:17:00',\n               '10:17:30', '10:18:00', '10:18:30'],\n              [-1437832050, -1437832020, -1437831990, -1437831960, -1437831930,\n               -1437831900, -1437831870, -1437831840, -1437831810, -1437831780,\n               -1437831750, -1437831720, -1437831690]),\n             ('15 seconds',\n              ['10:12:30', '10:12:45', '10:13:00', '10:13:15', '10:13:30',\n               '10:13:45', '10:14:00', '10:14:15', '10:14:30', '10:14:45',\n               '10:15:00', '10:15:15', '10:15:30', '10:15:45', '10:16:00',\n               '10:16:15', '10:16:30', '10:16:45', '10:17:00', '10:17:15',\n               '10:17:30', '10:17:45', '10:18:00', '10:18:15'],\n              [-1437832050, -1437832035, -1437832020, -1437832005, -1437831990,\n               -1437831975, -1437831960, -1437831945, -1437831930, -1437831915,\n               -1437831900, -1437831885, -1437831870, -1437831855, -1437831840,\n               -1437831825, -1437831810, -1437831795, -1437831780, -1437831765,\n               -1437831750, -1437831735, -1437831720, -1437831705]),\n             ('10 seconds',\n              ['10:12:30', '10:12:40', '10:12:50', '10:13:00', '10:13:10',\n               '10:13:20', '10:13:30', '10:13:40', '10:13:50', '10:14:00',\n               '10:14:10', '10:14:20', '10:14:30', '10:14:40', '10:14:50',\n               '10:15:00', '10:15:10', '10:15:20', '10:15:30', '10:15:40',\n               '10:15:50', '10:16:00', '10:16:10', '10:16:20', '10:16:30',\n               '10:16:40', '10:16:50', '10:17:00', '10:17:10', '10:17:20',\n               '10:17:30', '10:17:40', '10:17:50', '10:18:00', '10:18:10',\n               '10:18:20'],\n              [-1437832050, -1437832040, -1437832030, -1437832020, -1437832010,\n               -1437832000, -1437831990, -1437831980, -1437831970, -1437831960,\n               -1437831950, -1437831940, -1437831930, -1437831920, -1437831910,\n               -1437831900, -1437831890, -1437831880, -1437831870, -1437831860,\n               -1437831850, -1437831840, -1437831830, -1437831820, -1437831810,\n               -1437831800, -1437831790, -1437831780, -1437831770, -1437831760,\n               -1437831750, -1437831740, -1437831730, -1437831720, -1437831710,\n               -1437831700])])\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10, 12, 33), (1924, 6, 9, 10, 13, 12)),\n            [('30 seconds',\n              ['10:12:30', '10:13:00', '10:13:30'],\n              [-1437832050, -1437832020, -1437831990]),\n             ('15 seconds',\n              ['10:12:30', '10:12:45', '10:13:00', '10:13:15'],\n              [-1437832050, -1437832035, -1437832020, -1437832005]),\n             ('10 seconds',\n              ['10:12:30', '10:12:40', '10:12:50', '10:13:00', '10:13:10',\n               '10:13:20'],\n              [-1437832050, -1437832040, -1437832030, -1437832020, -1437832010,\n               -1437832000]),\n             ('5 seconds',\n              ['10:12:30', '10:12:35', '10:12:40', '10:12:45', '10:12:50',\n               '10:12:55', '10:13:00', '10:13:05', '10:13:10', '10:13:15'],\n              [-1437832050, -1437832045, -1437832040, -1437832035, -1437832030,\n               -1437832025, -1437832020, -1437832015, -1437832010,\n               -1437832005]),\n             ('1 second',\n              ['10:12:33', '10:12:34', '10:12:35', '10:12:36', '10:12:37',\n               '10:12:38', '10:12:39', '10:12:40', '10:12:41', '10:12:42',\n               '10:12:43', '10:12:44', '10:12:45', '10:12:46', '10:12:47',\n               '10:12:48', '10:12:49', '10:12:50', '10:12:51', '10:12:52',\n               '10:12:53', '10:12:54', '10:12:55', '10:12:56', '10:12:57',\n               '10:12:58', '10:12:59', '10:13:00', '10:13:01', '10:13:02',\n               '10:13:03', '10:13:04', '10:13:05', '10:13:06', '10:13:07',\n               '10:13:08', '10:13:09', '10:13:10', '10:13:11', '10:13:12',\n               '10:13:13'],\n              [-1437832047, -1437832046, -1437832045, -1437832044, -1437832043,\n               -1437832042, -1437832041, -1437832040, -1437832039, -1437832038,\n               -1437832037, -1437832036, -1437832035, -1437832034, -1437832033,\n               -1437832032, -1437832031, -1437832030, -1437832029, -1437832028,\n               -1437832027, -1437832026, -1437832025, -1437832024, -1437832023,\n               -1437832022, -1437832021, -1437832020, -1437832019, -1437832018,\n               -1437832017, -1437832016, -1437832015, -1437832014, -1437832013,\n               -1437832012, -1437832011, -1437832010, -1437832009, -1437832008,\n               -1437832007])])\n\n        self.assertEqual(\n            testbin((1973, 9, 14), (2010, 9, 8)),\n            [\n                ('50 years',\n                 ['1950', '2000', '2050'],\n                 [-631152000, 946684800, 2524608000]),\n                ('25 years',\n                 ['1950', '1975', '2000', '2025'],\n                 [-631152000, 157766400, 946684800, 1735689600]),\n                ('10 years',\n                 ['1970', '1980', '1990', '2000', '2010', '2020'],\n                 [0, 315532800, 631152000, 946684800, 1262304000, 1577836800]),\n                ('5 years',\n                 ['1970', '1975', '1980', '1985', '1990', '1995', '2000',\n                  '2005', '2010', '2015'],\n                 [0, 157766400, 315532800, 473385600, 631152000, 788918400,\n                  946684800, 1104537600, 1262304000, 1420070400]),\n                ('2 years',\n                 ['1972', '1974', '1976', '1978', '1980', '1982', '1984',\n                  '1986', '1988', '1990', '1992', '1994', '1996', '1998',\n                  '2000', '2002', '2004', '2006', '2008', '2010', '2012'],\n                 [63072000, 126230400, 189302400, 252460800, 315532800,\n                  378691200, 441763200, 504921600, 567993600, 631152000,\n                  694224000, 757382400, 820454400, 883612800, 946684800,\n                  1009843200, 1072915200, 1136073600, 1199145600, 1262304000,\n                  1325376000]),\n                ('1 year',\n                 ['1973', '1974', '1975', '1976', '1977', '1978', '1979',\n                  '1980', '1981', '1982', '1983', '1984', '1985', '1986',\n                  '1987', '1988', '1989', '1990', '1991', '1992', '1993',\n                  '1994', '1995', '1996', '1997', '1998', '1999', '2000',\n                  '2001', '2002', '2003', '2004', '2005', '2006', '2007',\n                  '2008', '2009', '2010', '2011'],\n                 [94694400, 126230400, 157766400, 189302400, 220924800,\n                  252460800, 283996800, 315532800, 347155200, 378691200,\n                  410227200, 441763200, 473385600, 504921600, 536457600,\n                  567993600, 599616000, 631152000, 662688000, 694224000,\n                  725846400, 757382400, 788918400, 820454400, 852076800,\n                  883612800, 915148800, 946684800, 978307200, 1009843200,\n                  1041379200, 1072915200, 1104537600, 1136073600, 1167609600,\n                  1199145600, 1230768000, 1262304000, 1293840000])\n            ]\n        )\n\n    def test_min_unique(self):\n        bins = time_binnings(self.dates, min_unique=7)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds[:-1], self.dates)\n\n    def test_add_unique(self):\n        bins = time_binnings(self.dates, add_unique=7)\n        self.assertNotEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds[:-1], self.dates)\n\n    def test_limits(self):\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=9, max_bins=17)},\n            {9, 17})\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=9, max_bins=16)},\n            {9})\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=10, max_bins=17)},\n            {17})\n\n    def test_single_value(self):\n        dates = np.array([42])\n        bins = time_binnings(dates)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds, [42, 43])\n\n    def test_multiple_identical(self):\n        dates = np.array([42] * 5)\n        bins = time_binnings(dates)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds, [42, 43])\n\n    def test_no_values(self):\n        dates = np.array([])\n        self.assertRaises(ValueError, time_binnings, dates)\n\n        dates = np.array([np.nan, np.nan])\n        self.assertRaises(ValueError, time_binnings, dates)\n\n    def test_before_epoch(self):\n        hour = 24 * 60 * 60\n        dates = [-hour, 0, hour,]\n        bins = time_binnings(dates)\n        self.assertEqual(list(bins[0].thresholds), [-hour, 0, hour, 2 * hour])\n\n\nclass TestBinDefinition(unittest.TestCase):\n    def test_labels(self):\n        thresholds = np.array([1, 2, 3.14])\n        self.assertEqual(BinDefinition(thresholds).labels,\n                         [\"1\", \"2\", \"3.14\"])\n        self.assertEqual(BinDefinition(thresholds, \"%.3f\").labels,\n                         [\"1.000\", \"2.000\", \"3.140\"])\n        self.assertEqual(BinDefinition(thresholds, lambda x: f\"b{x:g}\").labels,\n                         [\"b1\", \"b2\", \"b3.14\"])\n        self.assertEqual(BinDefinition(thresholds, list(\"abc\")).labels,\n                         list(\"abc\"))\n\n    def test_width_label(self):\n        thresholds = np.array([1, 2, 3.14])\n        self.assertEqual(BinDefinition(thresholds).width_label, \"\")\n        self.assertEqual(BinDefinition(thresholds, width=3).width_label, \"3\")\n        self.assertEqual(BinDefinition(thresholds, width=3.14).width_label, \"3.14\")\n\n    def test_thresholds(self):\n        thresholds = np.array([1, 2, 3.14])\n        bindef = BinDefinition(thresholds)\n        np.testing.assert_equal(bindef.thresholds, thresholds)\n        self.assertEqual(bindef.start, 1)\n        self.assertEqual(bindef.nbins, 2)\n\n\nclass TestDiscretizer(unittest.TestCase):\n    def test_equality(self):\n        v1 = ContinuousVariable(\"x\")\n        v2 = ContinuousVariable(\"x\", number_of_decimals=42)\n        v3 = ContinuousVariable(\"y\")\n        assert v1 == v2\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [0, 2, 1])\n        t2 = Discretizer(v3, [0, 2, 1])\n        self.assertEqual(t1, t1)\n        self.assertEqual(t1, t1a)\n        self.assertNotEqual(t1, t2)\n\n        self.assertEqual(hash(t1), hash(t1a))\n        self.assertNotEqual(hash(t1), hash(t2))\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [1, 2, 0])\n        self.assertNotEqual(t1, t1a)\n        self.assertNotEqual(hash(t1), hash(t1a))\n\n    def test_fmt_interval(self):\n        def fmt(x):\n            return f\"{x:.2f}\"\n\n        f = Discretizer._fmt_interval\n        self.assertEqual(f(1, 2, str), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt, strip_zeros=False), \"1.00 - 2.00\")\n\n        self.assertEqual(f(-np.inf, 2, fmt), \"< 2\")\n        self.assertEqual(f(-np.inf, 2, fmt, strip_zeros=False), \"< 2.00\")\n        self.assertEqual(f(None, 2, fmt), \"< 2\")\n        self.assertEqual(f(None, 2, fmt, strip_zeros=False), \"< 2.00\")\n\n        self.assertEqual(f(2, np.inf, fmt), \"≥ 2\")\n        self.assertEqual(f(2, np.inf, fmt, strip_zeros=False), \"≥ 2.00\")\n        self.assertEqual(f(2, None, fmt), \"≥ 2\")\n        self.assertEqual(f(2, None, fmt, strip_zeros=False), \"≥ 2.00\")\n\n        with self.assertRaises(ValueError):\n            f(1.122, 1.123, fmt)\n\n\n    def test_get_labels(self):\n        points = [2.46, 2.68, 2.794]\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.1f}\", points),\n            ['< 2.5', '2.5 - 2.7', '2.7 - 2.8', '≥ 2.8']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.2f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.79', '≥ 2.79']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.794', '≥ 2.794']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points,\n                                    strip_zeros=False),\n            ['< 2.4600', '2.4600 - 2.6800', '2.6800 - 2.7940', '≥ 2.7940']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [100, 200]),\n            ['< 100', '100 - 200', '≥ 200']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [0]),\n            ['< 0', '≥ 0']\n        )\n\n    def test_get_discretized_values_empty(self):\n        x = ContinuousVariable(\"x\")\n        d = Discretizer(x, [])\n        points, values, to_sql = d._get_discretized_values(None, np.array([]))\n        self.assertEqual(len(points), 0)\n        self.assertEqual(values, [\"single_value\"])\n        self.assertIsInstance(to_sql, SingleValueSql)\n\n    def test_get_discretized_values_identical_points(self):\n        x = ContinuousVariable(\"x\")\n        with self.assertRaises(ValueError):\n            Discretizer._get_discretized_values(x, np.array([0, 1, 1, 2]))\n\n    def test_get_discretized_values_no_ndigits(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=2)\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2, 3, 4]))\n        np.testing.assert_equal(points, [1, 2, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2.1, 3, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1, 2.1, 3.1234, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3.1234, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3.1234', '3.1234 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            4]))\n        np.testing.assert_equal(points, [1, 2.1000000001, 2.1000000002, 4])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 4',\n                                  '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.100000000211,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n    def test_get_discretized_values_round_builtin_vs_numpy(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=0)\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.3455,\n                                                            2.346]))\n        np.testing.assert_equal(points,\n                                [2.345, 2.346])\n        self.assertEqual(values, ['< 2.345',\n                                  '2.345 - 2.346',\n                                  '≥ 2.346'])\n\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.1345,\n                                                            2.135]))\n        np.testing.assert_equal(points,\n                                [2.1345, 2.135])\n        self.assertEqual(values, ['< 2.1345',\n                                  '2.1345 - 2.135',\n                                  '≥ 2.135'])\n\n    def test_get_discretized_values_with_ndigits(self):\n        x = ContinuousVariable(\"x\")\n        apoints = [1, 2, 3, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=0)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=2)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1.00', '1.00 - 2.00', '2.00 - 3.00',\n                                  '3.00 - 4.00', '≥ 4.00'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        apoints = [1, 2.1234, 2.1345, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=1)\n        np.testing.assert_array_equal(points, np.array([1, 2.12, 2.13, 4]))\n        self.assertEqual(values,\n                         ['< 1', '1 - 2.12', '2.12 - 2.13', '2.13 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n\nif __name__ == '__main__':\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/preprocess/tests/test_discretize.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "de30dd1ba",
                "new_commit_hash": "9730ff8d9",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/preprocess/tests/test_discretize.py"
            },
            "plus_file": {
                "path": "b/Orange/preprocess/tests/test_discretize.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 1233,
                            "length": 6
                        },
                        "new_range": {
                            "start": 1233,
                            "length": 28
                        },
                        "section": "class TestDiscretizer(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                                  '≥ 2.1000000003'])",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsInstance(to_sql, BinSql)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_get_discretized_values_round_builtin_vs_numpy(self):",
                                "type": "added"
                            },
                            {
                                "content": "        x = ContinuousVariable(\"x\", number_of_decimals=0)",
                                "type": "added"
                            },
                            {
                                "content": "        points, values, _ \\",
                                "type": "added"
                            },
                            {
                                "content": "            = Discretizer._get_discretized_values(x,",
                                "type": "added"
                            },
                            {
                                "content": "                                                  np.array([2.3455,",
                                "type": "added"
                            },
                            {
                                "content": "                                                            2.346]))",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_equal(points,",
                                "type": "added"
                            },
                            {
                                "content": "                                [2.345, 2.346])",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(values, ['< 2.345',",
                                "type": "added"
                            },
                            {
                                "content": "                                  '2.345 - 2.346',",
                                "type": "added"
                            },
                            {
                                "content": "                                  '≥ 2.346'])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        points, values, _ \\",
                                "type": "added"
                            },
                            {
                                "content": "            = Discretizer._get_discretized_values(x,",
                                "type": "added"
                            },
                            {
                                "content": "                                                  np.array([2.1345,",
                                "type": "added"
                            },
                            {
                                "content": "                                                            2.135]))",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_equal(points,",
                                "type": "added"
                            },
                            {
                                "content": "                                [2.1345, 2.135])",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(values, ['< 2.1345',",
                                "type": "added"
                            },
                            {
                                "content": "                                  '2.1345 - 2.135',",
                                "type": "added"
                            },
                            {
                                "content": "                                  '≥ 2.135'])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_get_discretized_values_with_ndigits(self):",
                                "type": "context"
                            },
                            {
                                "content": "        x = ContinuousVariable(\"x\")",
                                "type": "context"
                            },
                            {
                                "content": "        apoints = [1, 2, 3, 4]",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/preprocess/tests/test_discretize.py",
                            "type": "class",
                            "name": "TestDiscretizer",
                            "content": "class TestDiscretizer(unittest.TestCase):\n    def test_equality(self):\n        v1 = ContinuousVariable(\"x\")\n        v2 = ContinuousVariable(\"x\", number_of_decimals=42)\n        v3 = ContinuousVariable(\"y\")\n        assert v1 == v2\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [0, 2, 1])\n        t2 = Discretizer(v3, [0, 2, 1])\n        self.assertEqual(t1, t1)\n        self.assertEqual(t1, t1a)\n        self.assertNotEqual(t1, t2)\n\n        self.assertEqual(hash(t1), hash(t1a))\n        self.assertNotEqual(hash(t1), hash(t2))\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [1, 2, 0])\n        self.assertNotEqual(t1, t1a)\n        self.assertNotEqual(hash(t1), hash(t1a))\n\n    def test_fmt_interval(self):\n        def fmt(x):\n            return f\"{x:.2f}\"\n\n        f = Discretizer._fmt_interval\n        self.assertEqual(f(1, 2, str), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt, strip_zeros=False), \"1.00 - 2.00\")\n\n        self.assertEqual(f(-np.inf, 2, fmt), \"< 2\")\n        self.assertEqual(f(-np.inf, 2, fmt, strip_zeros=False), \"< 2.00\")\n        self.assertEqual(f(None, 2, fmt), \"< 2\")\n        self.assertEqual(f(None, 2, fmt, strip_zeros=False), \"< 2.00\")\n\n        self.assertEqual(f(2, np.inf, fmt), \"≥ 2\")\n        self.assertEqual(f(2, np.inf, fmt, strip_zeros=False), \"≥ 2.00\")\n        self.assertEqual(f(2, None, fmt), \"≥ 2\")\n        self.assertEqual(f(2, None, fmt, strip_zeros=False), \"≥ 2.00\")\n\n        with self.assertRaises(ValueError):\n            f(1.122, 1.123, fmt)\n\n\n    def test_get_labels(self):\n        points = [2.46, 2.68, 2.794]\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.1f}\", points),\n            ['< 2.5', '2.5 - 2.7', '2.7 - 2.8', '≥ 2.8']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.2f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.79', '≥ 2.79']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.794', '≥ 2.794']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points,\n                                    strip_zeros=False),\n            ['< 2.4600', '2.4600 - 2.6800', '2.6800 - 2.7940', '≥ 2.7940']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [100, 200]),\n            ['< 100', '100 - 200', '≥ 200']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [0]),\n            ['< 0', '≥ 0']\n        )\n\n    def test_get_discretized_values_empty(self):\n        x = ContinuousVariable(\"x\")\n        d = Discretizer(x, [])\n        points, values, to_sql = d._get_discretized_values(None, np.array([]))\n        self.assertEqual(len(points), 0)\n        self.assertEqual(values, [\"single_value\"])\n        self.assertIsInstance(to_sql, SingleValueSql)\n\n    def test_get_discretized_values_identical_points(self):\n        x = ContinuousVariable(\"x\")\n        with self.assertRaises(ValueError):\n            Discretizer._get_discretized_values(x, np.array([0, 1, 1, 2]))\n\n    def test_get_discretized_values_no_ndigits(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=2)\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2, 3, 4]))\n        np.testing.assert_equal(points, [1, 2, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2.1, 3, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1, 2.1, 3.1234, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3.1234, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3.1234', '3.1234 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            4]))\n        np.testing.assert_equal(points, [1, 2.1000000001, 2.1000000002, 4])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 4',\n                                  '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.100000000211,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n    def test_get_discretized_values_round_builtin_vs_numpy(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=0)\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.3455,\n                                                            2.346]))\n        np.testing.assert_equal(points,\n                                [2.345, 2.346])\n        self.assertEqual(values, ['< 2.345',\n                                  '2.345 - 2.346',\n                                  '≥ 2.346'])\n\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.1345,\n                                                            2.135]))\n        np.testing.assert_equal(points,\n                                [2.1345, 2.135])\n        self.assertEqual(values, ['< 2.1345',\n                                  '2.1345 - 2.135',\n                                  '≥ 2.135'])\n\n    def test_get_discretized_values_with_ndigits(self):\n        x = ContinuousVariable(\"x\")\n        apoints = [1, 2, 3, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=0)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=2)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1.00', '1.00 - 2.00', '2.00 - 3.00',\n                                  '3.00 - 4.00', '≥ 4.00'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        apoints = [1, 2.1234, 2.1345, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=1)\n        np.testing.assert_array_equal(points, np.array([1, 2.12, 2.13, 4]))\n        self.assertEqual(values,\n                         ['< 1', '1 - 2.12', '2.12 - 2.13', '2.13 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 1082,
                            "end_lineno": 1280,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/preprocess/tests/test_discretize.py",
                            "type": "method",
                            "name": "TestDiscretizer.test_get_discretized_values_round_builtin_vs_numpy",
                            "content": "class TestDiscretizer(unittest.TestCase):\n    def test_equality(self):\n        v1 = ContinuousVariable(\"x\")\n        v2 = ContinuousVariable(\"x\", number_of_decimals=42)\n        v3 = ContinuousVariable(\"y\")\n        assert v1 == v2\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [0, 2, 1])\n        t2 = Discretizer(v3, [0, 2, 1])\n        self.assertEqual(t1, t1)\n        self.assertEqual(t1, t1a)\n        self.assertNotEqual(t1, t2)\n\n        self.assertEqual(hash(t1), hash(t1a))\n        self.assertNotEqual(hash(t1), hash(t2))\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [1, 2, 0])\n        self.assertNotEqual(t1, t1a)\n        self.assertNotEqual(hash(t1), hash(t1a))\n\n    def test_fmt_interval(self):\n        def fmt(x):\n            return f\"{x:.2f}\"\n\n        f = Discretizer._fmt_interval\n        self.assertEqual(f(1, 2, str), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt, strip_zeros=False), \"1.00 - 2.00\")\n\n        self.assertEqual(f(-np.inf, 2, fmt), \"< 2\")\n        self.assertEqual(f(-np.inf, 2, fmt, strip_zeros=False), \"< 2.00\")\n        self.assertEqual(f(None, 2, fmt), \"< 2\")\n        self.assertEqual(f(None, 2, fmt, strip_zeros=False), \"< 2.00\")\n\n        self.assertEqual(f(2, np.inf, fmt), \"≥ 2\")\n        self.assertEqual(f(2, np.inf, fmt, strip_zeros=False), \"≥ 2.00\")\n        self.assertEqual(f(2, None, fmt), \"≥ 2\")\n        self.assertEqual(f(2, None, fmt, strip_zeros=False), \"≥ 2.00\")\n\n        with self.assertRaises(ValueError):\n            f(1.122, 1.123, fmt)\n\n\n    def test_get_labels(self):\n        points = [2.46, 2.68, 2.794]\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.1f}\", points),\n            ['< 2.5', '2.5 - 2.7', '2.7 - 2.8', '≥ 2.8']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.2f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.79', '≥ 2.79']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.794', '≥ 2.794']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points,\n                                    strip_zeros=False),\n            ['< 2.4600', '2.4600 - 2.6800', '2.6800 - 2.7940', '≥ 2.7940']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [100, 200]),\n            ['< 100', '100 - 200', '≥ 200']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [0]),\n            ['< 0', '≥ 0']\n        )\n\n    def test_get_discretized_values_empty(self):\n        x = ContinuousVariable(\"x\")\n        d = Discretizer(x, [])\n        points, values, to_sql = d._get_discretized_values(None, np.array([]))\n        self.assertEqual(len(points), 0)\n        self.assertEqual(values, [\"single_value\"])\n        self.assertIsInstance(to_sql, SingleValueSql)\n\n    def test_get_discretized_values_identical_points(self):\n        x = ContinuousVariable(\"x\")\n        with self.assertRaises(ValueError):\n            Discretizer._get_discretized_values(x, np.array([0, 1, 1, 2]))\n\n    def test_get_discretized_values_no_ndigits(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=2)\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2, 3, 4]))\n        np.testing.assert_equal(points, [1, 2, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2.1, 3, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1, 2.1, 3.1234, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3.1234, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3.1234', '3.1234 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            4]))\n        np.testing.assert_equal(points, [1, 2.1000000001, 2.1000000002, 4])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 4',\n                                  '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.100000000211,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n    def test_get_discretized_values_round_builtin_vs_numpy(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=0)\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.3455,\n                                                            2.346]))\n        np.testing.assert_equal(points,\n                                [2.345, 2.346])\n        self.assertEqual(values, ['< 2.345',\n                                  '2.345 - 2.346',\n                                  '≥ 2.346'])\n\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.1345,\n                                                            2.135]))\n        np.testing.assert_equal(points,\n                                [2.1345, 2.135])\n        self.assertEqual(values, ['< 2.1345',\n                                  '2.1345 - 2.135',\n                                  '≥ 2.135'])\n\n    def test_get_discretized_values_with_ndigits(self):\n        x = ContinuousVariable(\"x\")\n        apoints = [1, 2, 3, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=0)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=2)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1.00', '1.00 - 2.00', '2.00 - 3.00',\n                                  '3.00 - 4.00', '≥ 4.00'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        apoints = [1, 2.1234, 2.1345, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=1)\n        np.testing.assert_array_equal(points, np.array([1, 2.12, 2.13, 4]))\n        self.assertEqual(values,\n                         ['< 1', '1 - 2.12', '2.12 - 2.13', '2.13 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 1236,
                            "end_lineno": 1256,
                            "parent": {
                                "file_name": "Orange/preprocess/tests/test_discretize.py",
                                "type": "class",
                                "name": "TestDiscretizer",
                                "content": "class TestDiscretizer(unittest.TestCase):\n    def test_equality(self):\n        v1 = ContinuousVariable(\"x\")\n        v2 = ContinuousVariable(\"x\", number_of_decimals=42)\n        v3 = ContinuousVariable(\"y\")\n        assert v1 == v2\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [0, 2, 1])\n        t2 = Discretizer(v3, [0, 2, 1])\n        self.assertEqual(t1, t1)\n        self.assertEqual(t1, t1a)\n        self.assertNotEqual(t1, t2)\n\n        self.assertEqual(hash(t1), hash(t1a))\n        self.assertNotEqual(hash(t1), hash(t2))\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [1, 2, 0])\n        self.assertNotEqual(t1, t1a)\n        self.assertNotEqual(hash(t1), hash(t1a))\n\n    def test_fmt_interval(self):\n        def fmt(x):\n            return f\"{x:.2f}\"\n\n        f = Discretizer._fmt_interval\n        self.assertEqual(f(1, 2, str), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt, strip_zeros=False), \"1.00 - 2.00\")\n\n        self.assertEqual(f(-np.inf, 2, fmt), \"< 2\")\n        self.assertEqual(f(-np.inf, 2, fmt, strip_zeros=False), \"< 2.00\")\n        self.assertEqual(f(None, 2, fmt), \"< 2\")\n        self.assertEqual(f(None, 2, fmt, strip_zeros=False), \"< 2.00\")\n\n        self.assertEqual(f(2, np.inf, fmt), \"≥ 2\")\n        self.assertEqual(f(2, np.inf, fmt, strip_zeros=False), \"≥ 2.00\")\n        self.assertEqual(f(2, None, fmt), \"≥ 2\")\n        self.assertEqual(f(2, None, fmt, strip_zeros=False), \"≥ 2.00\")\n\n        with self.assertRaises(ValueError):\n            f(1.122, 1.123, fmt)\n\n\n    def test_get_labels(self):\n        points = [2.46, 2.68, 2.794]\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.1f}\", points),\n            ['< 2.5', '2.5 - 2.7', '2.7 - 2.8', '≥ 2.8']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.2f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.79', '≥ 2.79']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.794', '≥ 2.794']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points,\n                                    strip_zeros=False),\n            ['< 2.4600', '2.4600 - 2.6800', '2.6800 - 2.7940', '≥ 2.7940']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [100, 200]),\n            ['< 100', '100 - 200', '≥ 200']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [0]),\n            ['< 0', '≥ 0']\n        )\n\n    def test_get_discretized_values_empty(self):\n        x = ContinuousVariable(\"x\")\n        d = Discretizer(x, [])\n        points, values, to_sql = d._get_discretized_values(None, np.array([]))\n        self.assertEqual(len(points), 0)\n        self.assertEqual(values, [\"single_value\"])\n        self.assertIsInstance(to_sql, SingleValueSql)\n\n    def test_get_discretized_values_identical_points(self):\n        x = ContinuousVariable(\"x\")\n        with self.assertRaises(ValueError):\n            Discretizer._get_discretized_values(x, np.array([0, 1, 1, 2]))\n\n    def test_get_discretized_values_no_ndigits(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=2)\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2, 3, 4]))\n        np.testing.assert_equal(points, [1, 2, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2.1, 3, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1, 2.1, 3.1234, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3.1234, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3.1234', '3.1234 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            4]))\n        np.testing.assert_equal(points, [1, 2.1000000001, 2.1000000002, 4])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 4',\n                                  '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.100000000211,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n    def test_get_discretized_values_round_builtin_vs_numpy(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=0)\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.3455,\n                                                            2.346]))\n        np.testing.assert_equal(points,\n                                [2.345, 2.346])\n        self.assertEqual(values, ['< 2.345',\n                                  '2.345 - 2.346',\n                                  '≥ 2.346'])\n\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.1345,\n                                                            2.135]))\n        np.testing.assert_equal(points,\n                                [2.1345, 2.135])\n        self.assertEqual(values, ['< 2.1345',\n                                  '2.1345 - 2.135',\n                                  '≥ 2.135'])\n\n    def test_get_discretized_values_with_ndigits(self):\n        x = ContinuousVariable(\"x\")\n        apoints = [1, 2, 3, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=0)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=2)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1.00', '1.00 - 2.00', '2.00 - 3.00',\n                                  '3.00 - 4.00', '≥ 4.00'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        apoints = [1, 2.1234, 2.1345, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=1)\n        np.testing.assert_array_equal(points, np.array([1, 2.12, 2.13, 4]))\n        self.assertEqual(values,\n                         ['< 1', '1 - 2.12', '2.12 - 2.13', '2.13 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 1082,
                                "end_lineno": 1280,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "a410361107724d878c254d350715351c058050a5^",
    "new_commit_hash": "a410361107724d878c254d350715351c058050a5",
    "commit_message": "Discretization: fix conflicts between numpy's round and python's string formatting",
    "commit_date": "2024-11-05T15:39:17+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "a410361107724d878c254d350715351c058050a5",
    "test_file_codes": [
        "# File contains some long lines; breaking them would decrease readability\n# pylint: disable=line-too-long,too-many-lines,protected-access\nimport calendar\nimport unittest\nfrom unittest.mock import patch\nfrom time import struct_time, mktime\n\nimport numpy as np\n\nfrom Orange.data import ContinuousVariable, TimeVariable, Table, Domain\nfrom Orange.preprocess.discretize import \\\n    _time_binnings, time_binnings, BinDefinition, Discretizer, FixedWidth, \\\n    FixedTimeWidth, Binning, \\\n    TooManyIntervals, SingleValueSql, BinSql\n\n\nclass TestFixedWidth(unittest.TestCase):\n    def test_discretization(self):\n        x = np.array([[0.21, 0.335, 0, 0.26, np.nan],\n                      [0] * 5,\n                      [np.nan] * 5]).T\n        domain = Domain([ContinuousVariable(f\"c{i}\") for i in range(x.shape[1])])\n        data = Table.from_numpy(domain, x, None)\n\n        dvar = FixedWidth(0.1, 2)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points,\n                                       (0.1, 0.2, 0.3))\n        self.assertEqual(dvar.values,\n                         ('< 0.10', '0.10 - 0.20', '0.20 - 0.30', '≥ 0.30'))\n\n        dvar = FixedWidth(0.2, 1)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, (0.2, ))\n        self.assertEqual(dvar.values, ('< 0.2', '≥ 0.2'))\n\n        dvar = FixedWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedWidth(0.11, 2)(data, 1)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedWidth(0.11, 2)(data, 2)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        self.assertRaises(TooManyIntervals, FixedWidth(0.0001, 1), data, 0)\n\n\nclass TestFixedTimeWidth(unittest.TestCase):\n    def test_discretization(self):\n        t = TimeVariable(\"t\")\n        x = np.array([[t.to_val(\"1914\"), t.to_val(\"1945\"), np.nan],\n                      [t.to_val(\"1914\"), t.to_val(\"1914\"), np.nan],\n                      [np.nan, np.nan, np.nan],\n                      ]).T\n        domain = Domain([t, TimeVariable(\"t2\"), TimeVariable(\"t3\")])\n        data = Table.from_numpy(domain, x, None)\n\n        dvar = FixedTimeWidth(10, 1)(data, 1)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedTimeWidth(10, 2)(data, 2)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        self.assertRaises(TooManyIntervals, FixedWidth(0.0001, 1), data, 0)\n\n        dvar = FixedTimeWidth(10, 0)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(str(y))) for y in (1920, 1930, 1940)])\n        self.assertEqual(dvar.values,\n                         ('< 1920', '1920 - 1930', '1930 - 1940', '≥ 1940'))\n\n        dvar = FixedTimeWidth(5, 0)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(str(y))) for y in (1915, 1920, 1925, 1930, 1935,\n                                             1940, 1945)])\n        self.assertEqual(dvar.values,\n                         ('< 1915', '1915 - 1920', '1920 - 1925', '1925 - 1930',\n                          '1930 - 1935', '1935 - 1940', '1940 - 1945', '≥ 1945')\n                         )\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-07-28\"), t.to_val(\"1918-11-11\")]]).T)\n        dvar = FixedTimeWidth(6, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1915-01-01\", \"1915-07-01\",\n                                        \"1916-01-01\", \"1916-07-01\",\n                                        \"1917-01-01\", \"1917-07-01\",\n                                        \"1918-01-01\", \"1918-07-01\")])\n        self.assertEqual(dvar.values,\n                         ('< 15 Jan', '15 Jan - Jul', '15 Jul - 16 Jan',\n                          '16 Jan - Jul', '16 Jul - 17 Jan', '17 Jan - Jul',\n                          '17 Jul - 18 Jan', '18 Jan - Jul', '≥ 18 Jul'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-07-28\"), t.to_val(\"1914-11-11\")]]).T)\n        dvar = FixedTimeWidth(6, 1)(data, 0)\n        np.testing.assert_almost_equal(dvar.compute_value.points, [])\n\n        dvar = FixedTimeWidth(2, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-09-01\", \"1914-11-01\")])\n        self.assertEqual(dvar.values, ('< Sep', 'Sep - Nov', '≥ Nov'))\n\n        dvar = FixedTimeWidth(1, 1)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-08-01\", \"1914-09-01\",\n                                        \"1914-10-01\", \"1914-11-01\")])\n        self.assertEqual(dvar.values, ('< Aug', 'Aug - Sep', 'Sep - Oct',\n                                       'Oct - Nov', '≥ Nov'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-07-04 15:25\")]]).T)\n        dvar = FixedTimeWidth(2, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29\", \"1914-07-01\",\n                                        \"1914-07-03\")])\n        self.assertEqual(dvar.values, ('< Jun 29', 'Jun 29 - Jul 01',\n                                       'Jul 01 - Jul 03', '≥ Jul 03'))\n\n        dvar = FixedTimeWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29\", \"1914-06-30\",\n                                        \"1914-07-01\", \"1914-07-02\",\n                                        \"1914-07-03\", \"1914-07-04\")])\n        self.assertEqual(dvar.values, ('< Jun 29', 'Jun 29 - Jun 30',\n                                       'Jun 30 - Jul 01', 'Jul 01 - Jul 02',\n                                        'Jul 02 - Jul 03', 'Jul 03 - Jul 04',\n                                        '≥ Jul 04'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-12-30 22:45\"),\n                       t.to_val(\"1915-01-02 15:25\")]]).T)\n        dvar = FixedTimeWidth(1, 2)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-12-31\", \"1915-01-01\",\n                                        \"1915-01-02\")])\n        self.assertEqual(dvar.values, ('< 14 Dec 31',\n                                       '14 Dec 31 - 15 Jan 01',\n                                       '15 Jan 01 - Jan 02', '≥ 15 Jan 02'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-06-28 15:25\")]]).T)\n        dvar = FixedTimeWidth(2, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 12:00\", \"1914-06-28 14:00\")])\n        self.assertEqual(dvar.values, ('< 12:00', '12:00 - 14:00', '≥ 14:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 10:45\"),\n                       t.to_val(\"1914-06-28 15:25\")]]).T)\n        dvar = FixedTimeWidth(1, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 11:00\", \"1914-06-28 12:00\",\n                                        \"1914-06-28 13:00\", \"1914-06-28 14:00\",\n                                        \"1914-06-28 15:00\")])\n        self.assertEqual(dvar.values, ('< 11:00', '11:00 - 12:00',\n                                       '12:00 - 13:00', '13:00 - 14:00',\n                                       '14:00 - 15:00', '≥ 15:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 22:45\"),\n                       t.to_val(\"1914-06-29 03:25\")]]).T)\n        dvar = FixedTimeWidth(1, 3)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 23:00\", \"1914-06-29 00:00\",\n                                        \"1914-06-29 01:00\", \"1914-06-29 02:00\",\n                                        \"1914-06-29 03:00\")])\n        self.assertEqual(dvar.values, ('< Jun 28 23:00',\n                                       'Jun 28 23:00 - Jun 29 00:00',\n                                       'Jun 29 00:00 - 01:00',\n                                       'Jun 29 01:00 - 02:00',\n                                       'Jun 29 02:00 - 03:00',\n                                       '≥ Jun 29 03:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-28 22:43\"),\n                       t.to_val(\"1914-06-28 23:01\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-28 22:45\", \"1914-06-28 22:50\",\n                                        \"1914-06-28 22:55\", \"1914-06-28 23:00\")])\n        self.assertEqual(dvar.values, ('< 22:45', \"22:45 - 22:50\",\n                                       \"22:50 - 22:55\", \"22:55 - 23:00\",\n                                       '≥ 23:00'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-30 23:48\"),\n                       t.to_val(\"1914-07-01 00:06\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-30 23:50\", \"1914-06-30 23:55\",\n                                        \"1914-07-01 00:00\", \"1914-07-01 00:05\")])\n        self.assertEqual(dvar.values, ('< Jun 30 23:50', \"Jun 30 23:50 - 23:55\",\n                                       \"Jun 30 23:55 - Jul 01 00:00\",\n                                       \"Jul 01 00:00 - 00:05\", '≥ Jul 01 00:05'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48\"),\n                       t.to_val(\"1914-06-30 00:06\")]]).T)\n        dvar = FixedTimeWidth(5, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:50\", \"1914-06-29 23:55\",\n                                        \"1914-06-30 00:00\", \"1914-06-30 00:05\")])\n        self.assertEqual(dvar.values, ('< Jun 29 23:50', \"Jun 29 23:50 - 23:55\",\n                                       \"Jun 29 23:55 - Jun 30 00:00\",\n                                       \"Jun 30 00:00 - 00:05\", '≥ Jun 30 00:05'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48:05\"),\n                       t.to_val(\"1914-06-29 23:51:59\")]]).T)\n        dvar = FixedTimeWidth(1, 4)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:49\", \"1914-06-29 23:50\",\n                                        \"1914-06-29 23:51\")])\n        self.assertEqual(dvar.values, ('< 23:49', \"23:49 - 23:50\",\n                                       \"23:50 - 23:51\", '≥ 23:51'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-06-29 23:48:05.123\"),\n                       t.to_val(\"1914-06-29 23:48:33.684\")]]).T)\n        dvar = FixedTimeWidth(10, 5)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-06-29 23:48:10\",\n                                        \"1914-06-29 23:48:20\",\n                                        \"1914-06-29 23:48:30\")])\n        self.assertEqual(dvar.values, ('< 23:48:10', \"23:48:10 - 23:48:20\",\n                                       \"23:48:20 - 23:48:30\", '≥ 23:48:30'))\n\n        data = Table.from_numpy(\n            Domain([t]),\n            np.array([[t.to_val(\"1914-12-31 23:59:58.1\"),\n                       t.to_val(\"1915-01-01 00:00:01.8\")]]).T)\n        dvar = FixedTimeWidth(1, 5)(data, 0)\n        np.testing.assert_almost_equal(\n            dvar.compute_value.points,\n            [int(t.to_val(y)) for y in (\"1914-12-31 23:59:59\",\n                                        \"1915-01-01 00:00:00\",\n                                        \"1915-01-01 00:00:01\")])\n        self.assertEqual(dvar.values, ('< 23:59:59', \"23:59:59 - 00:00:00\",\n                                       \"00:00:00 - 00:00:01\", '≥ 00:00:01'))\n\n        self.assertRaises(TooManyIntervals, FixedTimeWidth(0.0001, 5), data, 0)\n\n\nclass TestBinningDiscretizer(unittest.TestCase):\n    def test_no_data(self):\n        no_data = Table(Domain([ContinuousVariable(\"y\")]), np.zeros((0, 1)))\n        dvar = Binning()(no_data, 0)\n        self.assertEqual(dvar.compute_value.points, [])\n\n    @patch(\"Orange.preprocess.discretize.time_binnings\")\n    @patch(\"Orange.preprocess.discretize.decimal_binnings\")\n    @patch(\"Orange.preprocess.discretize.Binning._create_binned_var\")\n    def test_call(self, _, decbin, timebin):\n        data = Table(Domain([ContinuousVariable(\"y\"), TimeVariable(\"t\")]),\n                     np.array([[1, 2], [3, 4]]))\n\n        Binning(5)(data, 0)\n        timebin.assert_not_called()\n        self.assertEqual(list(decbin.call_args[0][0]), [1, 3])\n        decbin.reset_mock()\n\n        Binning(5)(data, 1)\n        decbin.assert_not_called()\n        self.assertEqual(list(timebin.call_args[0][0]), [2, 4])\n\n    def test_binning_selection(self):\n        var = ContinuousVariable(\"y\")\n        discretize = Binning(2)\n        # pylint: disable=redefined-outer-name\n        create = discretize._create_binned_var\n\n        binnings = []\n        self.assertEqual(create(binnings, var).compute_value.points, [])\n\n        binnings = None\n        self.assertEqual(create(binnings, var).compute_value.points, [])\n\n        binnings = [\n            BinDefinition(np.arange(i + 1),\n                          [f\"t{x}\" for x in range(i + 1)],\n                          [f\"t{x}\" for x in range(i + 1)],\n                          1 / i, str(i)\n                          )\n            for i in (3, 5, 10, 20)\n        ]\n\n        for discretize.n in (2, 3):\n            self.assertEqual(create(binnings, var).values,\n                             ('< t1', \"t1 - t2\", \"≥ t2\"))\n\n        for discretize.n in (4, 5, 6, 7):\n            self.assertEqual(create(binnings, var).values,\n                             ('< t1', \"t1 - t2\", \"t2 - t3\", \"t3 - t4\", \"≥ t4\"))\n\n        for discretize.n in range(8, 15):\n            self.assertEqual(len(create(binnings, var).values), 10)\n\n        for discretize.n in range(16, 25):\n            self.assertEqual(len(create(binnings, var).values), 20)\n\n\n# pylint: disable=redefined-builtin\ndef create(year=1970, month=1, day=1, hour=0, min=0, sec=0):\n    return struct_time((year, month, day, hour, min, sec, 0, 0, 0))\n\n\nclass TestTimeBinning(unittest.TestCase):\n    def setUp(self):\n        self.dates = [mktime(x) for x in\n                      [(1975, 6, 9, 10, 0, 0, 0, 161, 0),\n                       (1975, 6, 9, 10, 50, 0, 0, 161, 0),\n                       (1975, 6, 9, 11, 40, 0, 0, 161, 0),\n                       (1975, 6, 9, 12, 30, 0, 0, 161, 0),\n                       (1975, 6, 9, 13, 20, 0, 0, 161, 0),\n                       (1975, 6, 9, 14, 10, 0, 0, 161, 0)]]\n\n    def test_binning(self):\n        def tr1(s):\n            for localname, engname in zip(\n                    calendar.month_abbr[1:],\n                    \"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec\".split()):\n                s = s.replace(localname, engname)\n            return s\n\n        def tr2(ss):\n            return list(map(tr1, ss))\n\n        def testbin(start, end):\n            bins = _time_binnings(create(*start), create(*end), 3, 51)\n            return [(bin.width_label, tr2(bin.short_labels),\n                     list(bin.thresholds))\n                    for bin in reversed(bins)]\n\n        self.assertEqual(\n            testbin((1975, 4, 2), (1989, 3, 1)),\n            [('10 years',\n              ['1970', '1980', '1990'],\n              [0, 315532800, 631152000]),\n             ('5 years',\n              ['1975', '1980', '1985', '1990'],\n              [157766400, 315532800, 473385600, 631152000]),\n             ('2 years',\n              ['1974', '1976', '1978', '1980', '1982', '1984', '1986', '1988',\n               '1990'],\n              [126230400, 189302400, 252460800, 315532800, 378691200, 441763200,\n               504921600, 567993600, 631152000]),\n             ('1 year',\n              ['1975', '1976', '1977', '1978', '1979', '1980', '1981', '1982',\n               '1983', '1984', '1985', '1986', '1987', '1988', '1989', '1990'],\n              [157766400, 189302400, 220924800, 252460800, 283996800, 315532800,\n               347155200, 378691200, 410227200, 441763200, 473385600, 504921600,\n               536457600, 567993600, 599616000, 631152000]),\n             ('6 months',\n              ['75 Jan', 'Jul', '76 Jan', 'Jul', '77 Jan', 'Jul', '78 Jan',\n               'Jul', '79 Jan', 'Jul', '80 Jan', 'Jul', '81 Jan', 'Jul',\n               '82 Jan', 'Jul', '83 Jan', 'Jul', '84 Jan', 'Jul', '85 Jan',\n               'Jul', '86 Jan', 'Jul', '87 Jan', 'Jul', '88 Jan', 'Jul',\n               '89 Jan', 'Jul'],\n              [157766400, 173404800, 189302400, 205027200, 220924800, 236563200,\n               252460800, 268099200, 283996800, 299635200, 315532800, 331257600,\n               347155200, 362793600, 378691200, 394329600, 410227200, 425865600,\n               441763200, 457488000, 473385600, 489024000, 504921600, 520560000,\n               536457600, 552096000, 567993600, 583718400, 599616000,\n               615254400])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 4, 2), (1978, 3, 1)),\n            [('2 years',\n              ['1974', '1976', '1978', '1980'],\n              [126230400, 189302400, 252460800, 315532800]),\n             ('1 year',\n              ['1975', '1976', '1977', '1978', '1979'],\n              [157766400, 189302400, 220924800, 252460800, 283996800]),\n             ('6 months',\n              ['75 Jan', 'Jul',\n               '76 Jan', 'Jul',\n               '77 Jan', 'Jul',\n               '78 Jan', 'Jul'],\n              [157766400, 173404800, 189302400, 205027200, 220924800, 236563200,\n               252460800, 268099200]),\n             ('3 months',\n              ['75 Apr', 'Jul', 'Oct',\n               '76 Jan', 'Apr', 'Jul', 'Oct',\n               '77 Jan', 'Apr', 'Jul', 'Oct',\n               '78 Jan', 'Apr'],\n              [165542400, 173404800, 181353600, 189302400, 197164800, 205027200,\n               212976000, 220924800, 228700800, 236563200, 244512000, 252460800,\n               260236800]),\n             ('2 months',\n              ['75 Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '76 Jan', 'Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '77 Jan', 'Mar', 'May', 'Jul', 'Sep', 'Nov',\n               '78 Jan', 'Mar', 'May'],\n              [162864000, 168134400, 173404800, 178761600, 184032000, 189302400,\n               194486400, 199756800, 205027200, 210384000, 215654400, 220924800,\n               226022400, 231292800, 236563200, 241920000, 247190400, 252460800,\n               257558400, 262828800]),\n             ('1 month',\n              ['75 Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '76 Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '77 Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n               '78 Jan', 'Feb', 'Mar', 'Apr'],\n              [165542400, 168134400, 170812800, 173404800, 176083200, 178761600,\n               181353600, 184032000, 186624000, 189302400, 191980800, 194486400,\n               197164800, 199756800, 202435200, 205027200, 207705600, 210384000,\n               212976000, 215654400, 218246400, 220924800, 223603200, 226022400,\n               228700800, 231292800, 233971200, 236563200, 239241600, 241920000,\n               244512000, 247190400, 249782400, 252460800, 255139200, 257558400,\n               260236800])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 2), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('2 weeks',\n              ['75 Dec 03', '17', '31', '76 Jan 14'],\n              [186796800, 188006400, 189216000, 190425600]),\n             ('1 week',\n              ['75 Dec 03', '10', '17', '24', '31',\n               '76 Jan 07'],\n              [186796800, 187401600, 188006400, 188611200, 189216000,\n               189820800]),\n             ('1 day',\n              ['75 Dec 02', '03', '04', '05', '06', '07', '08', '09', '10',\n               '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21',\n               '22', '23', '24', '25', '26', '27', '28', '29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [186710400, 186796800, 186883200, 186969600, 187056000, 187142400,\n               187228800, 187315200, 187401600, 187488000, 187574400, 187660800,\n               187747200, 187833600, 187920000, 188006400, 188092800, 188179200,\n               188265600, 188352000, 188438400, 188524800, 188611200, 188697600,\n               188784000, 188870400, 188956800, 189043200, 189129600, 189216000,\n               189302400, 189388800, 189475200, 189561600])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 25), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('1 day',\n              ['75 Dec 25', '26', '27', '28', '29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [188697600, 188784000, 188870400, 188956800, 189043200, 189129600,\n               189216000, 189302400, 189388800, 189475200, 189561600]),\n             ('12 hours',\n              ['75 Dec 25 00:00', '12:00',\n               '26 00:00', '12:00',\n               '27 00:00', '12:00',\n               '28 00:00', '12:00',\n               '29 00:00', '12:00',\n               '30 00:00', '12:00',\n               '31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00', '12:00',\n               '03 00:00', '12:00'],\n              [188697600, 188740800, 188784000, 188827200, 188870400, 188913600,\n               188956800, 189000000, 189043200, 189086400, 189129600, 189172800,\n               189216000, 189259200, 189302400, 189345600, 189388800, 189432000,\n               189475200, 189518400]),\n             ('6 hours',\n              ['75 Dec 25 00:00', '06:00', '12:00', '18:00',\n               '26 00:00', '06:00', '12:00', '18:00',\n               '27 00:00', '06:00', '12:00', '18:00',\n               '28 00:00', '06:00', '12:00', '18:00',\n               '29 00:00', '06:00', '12:00', '18:00',\n               '30 00:00', '06:00', '12:00', '18:00',\n               '31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00',\n               '02 00:00', '06:00', '12:00', '18:00',\n               '03 00:00', '06:00'],\n              [188697600, 188719200, 188740800, 188762400, 188784000, 188805600,\n               188827200, 188848800, 188870400, 188892000, 188913600, 188935200,\n               188956800, 188978400, 189000000, 189021600, 189043200, 189064800,\n               189086400, 189108000, 189129600, 189151200, 189172800, 189194400,\n               189216000, 189237600, 189259200, 189280800, 189302400, 189324000,\n               189345600, 189367200, 189388800, 189410400, 189432000, 189453600,\n               189475200, 189496800])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 29), (1976, 1, 3)),\n            [('1 month',\n              ['75 Dec', '76 Jan', 'Feb'],\n              [186624000, 189302400, 191980800]),\n             ('1 day',\n              ['75 Dec 29', '30', '31',\n               '76 Jan 01', '02', '03', '04'],\n              [189043200, 189129600, 189216000, 189302400, 189388800, 189475200,\n               189561600]),\n             ('12 hours',\n              ['75 Dec 29 00:00', '12:00',\n               '30 00:00', '12:00',\n               '31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00', '12:00',\n               '03 00:00', '12:00'],\n              [189043200, 189086400, 189129600, 189172800, 189216000, 189259200,\n               189302400, 189345600, 189388800, 189432000, 189475200,\n               189518400]),\n             ('6 hours',\n              ['75 Dec 29 00:00', '06:00', '12:00', '18:00',\n               '30 00:00', '06:00', '12:00', '18:00',\n               '31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00',\n               '02 00:00', '06:00', '12:00', '18:00',\n               '03 00:00', '06:00'],\n              [189043200, 189064800, 189086400, 189108000, 189129600, 189151200,\n               189172800, 189194400, 189216000, 189237600, 189259200, 189280800,\n               189302400, 189324000, 189345600, 189367200, 189388800, 189410400,\n               189432000, 189453600, 189475200, 189496800]),\n             ('3 hours',\n              ['75 Dec 29 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '30 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '31 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '02 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '03 00:00', '03:00'],\n              [189043200, 189054000, 189064800, 189075600, 189086400, 189097200,\n               189108000, 189118800, 189129600, 189140400, 189151200, 189162000,\n               189172800, 189183600, 189194400, 189205200, 189216000, 189226800,\n               189237600, 189248400, 189259200, 189270000, 189280800, 189291600,\n               189302400, 189313200, 189324000, 189334800, 189345600, 189356400,\n               189367200, 189378000, 189388800, 189399600, 189410400, 189421200,\n               189432000, 189442800, 189453600, 189464400, 189475200,\n               189486000])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 0, 0, 0), (1976, 1, 1, 14, 30)),\n            [('1 day',\n              ['75 Dec 31', '76 Jan 01', '02'],\n              [189216000, 189302400, 189388800]),\n             ('12 hours',\n              ['75 Dec 31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00',\n               '02 00:00'],\n              [189216000, 189259200, 189302400, 189345600, 189388800]),\n             ('6 hours',\n              ['75 Dec 31 00:00', '06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00', '12:00', '18:00'],\n              [189216000, 189237600, 189259200, 189280800, 189302400, 189324000,\n               189345600, 189367200]),\n             ('3 hours',\n              ['75 Dec 31 00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00', '06:00', '09:00', '12:00', '15:00'],\n              [189216000, 189226800, 189237600, 189248400, 189259200, 189270000,\n               189280800, 189291600, 189302400, 189313200, 189324000, 189334800,\n               189345600, 189356400]),\n             ('2 hours',\n              ['75 Dec 31 00:00', '02:00', '04:00', '06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00',\n               '76 Jan 01 00:00', '02:00', '04:00', '06:00', '08:00', '10:00', '12:00', '14:00', '16:00'],\n              [189216000, 189223200, 189230400, 189237600, 189244800, 189252000,\n               189259200, 189266400, 189273600, 189280800, 189288000, 189295200,\n               189302400, 189309600, 189316800, 189324000, 189331200, 189338400,\n               189345600, 189352800, 189360000]),\n             ('1 hour',\n              ['75 Dec 31 00:00', '01:00', '02:00', '03:00', '04:00', '05:00',\n               '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00',\n               '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00',\n               '20:00', '21:00', '22:00', '23:00',\n               '76 Jan 01 00:00', '01:00', '02:00', '03:00', '04:00', '05:00',\n               '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00',\n               '13:00', '14:00', '15:00'],\n              [189216000, 189219600, 189223200, 189226800, 189230400, 189234000,\n               189237600, 189241200, 189244800, 189248400, 189252000, 189255600,\n               189259200, 189262800, 189266400, 189270000, 189273600, 189277200,\n               189280800, 189284400, 189288000, 189291600, 189295200, 189298800,\n               189302400, 189306000, 189309600, 189313200, 189316800, 189320400,\n               189324000, 189327600, 189331200, 189334800, 189338400, 189342000,\n               189345600, 189349200, 189352800, 189356400])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 6), (1976, 1, 1)),\n            [('1 day',\n              ['75 Dec 31', '76 Jan 01', '02'],\n              [189216000, 189302400, 189388800]),\n             ('12 hours',\n              ['75 Dec 31 00:00', '12:00',\n               '76 Jan 01 00:00', '12:00'],\n              [189216000, 189259200, 189302400, 189345600]),\n             ('6 hours',\n              ['75 Dec 31 06:00', '12:00', '18:00',\n               '76 Jan 01 00:00', '06:00'],\n              [189237600, 189259200, 189280800, 189302400, 189324000]),\n             ('3 hours',\n              ['75 Dec 31 06:00', '09:00', '12:00', '15:00', '18:00', '21:00',\n               '76 Jan 01 00:00', '03:00'],\n              [189237600, 189248400, 189259200, 189270000, 189280800, 189291600,\n               189302400, 189313200]),\n             ('2 hours',\n              ['75 Dec 31 06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00',\n               '76 Jan 01 00:00', '02:00'],\n              [189237600, 189244800, 189252000, 189259200, 189266400, 189273600,\n               189280800, 189288000, 189295200, 189302400, 189309600]),\n             ('1 hour',\n              ['75 Dec 31 06:00', '07:00', '08:00', '09:00', '10:00', '11:00',\n               '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00',\n               '19:00', '20:00', '21:00', '22:00', '23:00',\n               '76 Jan 01 00:00', '01:00'],\n              [189237600, 189241200, 189244800, 189248400, 189252000, 189255600,\n               189259200, 189262800, 189266400, 189270000, 189273600, 189277200,\n               189280800, 189284400, 189288000, 189291600, 189295200, 189298800,\n               189302400, 189306000]),\n             ('30 minutes',\n              ['Dec 31 06:00', '06:30', '07:00', '07:30', '08:00', '08:30',\n               '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00',\n               '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30',\n               '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00',\n               '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30',\n               '23:00', '23:30',\n               'Jan 01 00:00', '00:30'],\n              [189237600, 189239400, 189241200, 189243000, 189244800, 189246600,\n               189248400, 189250200, 189252000, 189253800, 189255600, 189257400,\n               189259200, 189261000, 189262800, 189264600, 189266400, 189268200,\n               189270000, 189271800, 189273600, 189275400, 189277200, 189279000,\n               189280800, 189282600, 189284400, 189286200, 189288000, 189289800,\n               189291600, 189293400, 189295200, 189297000, 189298800, 189300600,\n               189302400, 189304200])]\n        )\n\n        self.assertEqual(\n            testbin((1975, 12, 31, 23), (1976, 1, 1, 2)),\n            [('3 hours',\n              ['75 Dec 31 21:00',\n               '76 Jan 01 00:00', '03:00'],\n              [189291600, 189302400, 189313200]),\n             ('2 hours',\n              ['75 Dec 31 22:00',\n               '76 Jan 01 00:00', '02:00', '04:00'],\n              [189295200, 189302400, 189309600, 189316800]),\n             ('1 hour',\n              ['75 Dec 31 23:00',\n               '76 Jan 01 00:00', '01:00', '02:00', '03:00'],\n              [189298800, 189302400, 189306000, 189309600, 189313200]),\n             ('30 minutes',\n              ['Dec 31 23:00', '23:30',\n               'Jan 01 00:00', '00:30', '01:00', '01:30', '02:00', '02:30'],\n              [189298800, 189300600, 189302400, 189304200, 189306000, 189307800,\n               189309600, 189311400]),\n             ('15 minutes',\n              ['Dec 31 23:00', '23:15', '23:30', '23:45',\n               'Jan 01 00:00', '00:15', '00:30', '00:45', '01:00', '01:15',\n               '01:30', '01:45', '02:00', '02:15'],\n              [189298800, 189299700, 189300600, 189301500, 189302400, 189303300,\n               189304200, 189305100, 189306000, 189306900, 189307800, 189308700,\n               189309600, 189310500]),\n             ('10 minutes',\n              ['Dec 31 23:00', '23:10', '23:20', '23:30', '23:40', '23:50',\n               'Jan 01 00:00', '00:10', '00:20', '00:30', '00:40', '00:50',\n               '01:00', '01:10', '01:20', '01:30', '01:40', '01:50', '02:00',\n               '02:10'],\n              [189298800, 189299400, 189300000, 189300600, 189301200, 189301800,\n               189302400, 189303000, 189303600, 189304200, 189304800, 189305400,\n               189306000, 189306600, 189307200, 189307800, 189308400, 189309000,\n               189309600, 189310200]),\n             ('5 minutes',\n              ['Dec 31 23:00', '23:05', '23:10', '23:15', '23:20', '23:25',\n               '23:30', '23:35', '23:40', '23:45', '23:50', '23:55',\n               'Jan 01 00:00', '00:05', '00:10', '00:15', '00:20', '00:25',\n               '00:30', '00:35', '00:40', '00:45', '00:50', '00:55', '01:00',\n               '01:05', '01:10', '01:15', '01:20', '01:25', '01:30', '01:35',\n               '01:40', '01:45', '01:50', '01:55', '02:00', '02:05'],\n              [189298800, 189299100, 189299400, 189299700, 189300000, 189300300,\n               189300600, 189300900, 189301200, 189301500, 189301800, 189302100,\n               189302400, 189302700, 189303000, 189303300, 189303600, 189303900,\n               189304200, 189304500, 189304800, 189305100, 189305400, 189305700,\n               189306000, 189306300, 189306600, 189306900, 189307200, 189307500,\n               189307800, 189308100, 189308400, 189308700, 189309000, 189309300,\n               189309600, 189309900])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 23, 18)),\n            [('12 hours',\n              ['Jun 09 00:00', '12:00', '10 00:00'],\n              [-1437868800, -1437825600, -1437782400]),\n             ('6 hours',\n              ['Jun 09 06:00', '12:00', '18:00', '10 00:00'],\n              [-1437847200, -1437825600, -1437804000, -1437782400]),\n             ('3 hours',\n              ['Jun 09 09:00', '12:00', '15:00', '18:00', '21:00', '10 00:00'],\n              [-1437836400, -1437825600, -1437814800, -1437804000, -1437793200,\n               -1437782400]),\n             ('2 hours',\n              ['Jun 09 10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '10 00:00'],\n              [-1437832800, -1437825600, -1437818400, -1437811200, -1437804000,\n               -1437796800, -1437789600, -1437782400]),\n             ('1 hour',\n              ['Jun 09 10:00', '11:00', '12:00', '13:00', '14:00', '15:00',\n               '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00',\n               '23:00',\n               '10 00:00'],\n              [-1437832800, -1437829200, -1437825600, -1437822000, -1437818400,\n               -1437814800, -1437811200, -1437807600, -1437804000, -1437800400,\n               -1437796800, -1437793200, -1437789600, -1437786000,\n               -1437782400]),\n             ('30 minutes',\n              ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',\n               '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30',\n               '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',\n               '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30'],\n              [-1437832800, -1437831000, -1437829200, -1437827400, -1437825600,\n               -1437823800, -1437822000, -1437820200, -1437818400, -1437816600,\n               -1437814800, -1437813000, -1437811200, -1437809400, -1437807600,\n               -1437805800, -1437804000, -1437802200, -1437800400, -1437798600,\n               -1437796800, -1437795000, -1437793200, -1437791400, -1437789600,\n               -1437787800, -1437786000, -1437784200])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 13, 18)),\n            [('2 hours',\n              ['10:00', '12:00', '14:00'],\n              [-1437832800, -1437825600, -1437818400]),\n             ('1 hour',\n              ['10:00', '11:00', '12:00', '13:00', '14:00'],\n              [-1437832800, -1437829200, -1437825600, -1437822000,\n               -1437818400]),\n             ('30 minutes',\n              ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',\n               '13:30'],\n              [-1437832800, -1437831000, -1437829200, -1437827400, -1437825600,\n               -1437823800, -1437822000, -1437820200]),\n             ('15 minutes',\n              ['10:00', '10:15', '10:30', '10:45', '11:00', '11:15', '11:30',\n               '11:45', '12:00', '12:15', '12:30', '12:45', '13:00', '13:15',\n               '13:30'],\n              [-1437832800, -1437831900, -1437831000, -1437830100, -1437829200,\n               -1437828300, -1437827400, -1437826500, -1437825600, -1437824700,\n               -1437823800, -1437822900, -1437822000, -1437821100,\n               -1437820200]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30', '10:40', '10:50', '11:00',\n               '11:10', '11:20', '11:30', '11:40', '11:50', '12:00', '12:10',\n               '12:20', '12:30', '12:40', '12:50', '13:00', '13:10', '13:20'],\n              [-1437832800, -1437832200, -1437831600, -1437831000, -1437830400,\n               -1437829800, -1437829200, -1437828600, -1437828000, -1437827400,\n               -1437826800, -1437826200, -1437825600, -1437825000, -1437824400,\n               -1437823800, -1437823200, -1437822600, -1437822000, -1437821400,\n               -1437820800]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30',\n               '10:35', '10:40', '10:45', '10:50', '10:55', '11:00', '11:05',\n               '11:10', '11:15', '11:20', '11:25', '11:30', '11:35', '11:40',\n               '11:45', '11:50', '11:55', '12:00', '12:05', '12:10', '12:15',\n               '12:20', '12:25', '12:30', '12:35', '12:40', '12:45', '12:50',\n               '12:55', '13:00', '13:05', '13:10', '13:15', '13:20'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300, -1437831000, -1437830700, -1437830400, -1437830100,\n               -1437829800, -1437829500, -1437829200, -1437828900, -1437828600,\n               -1437828300, -1437828000, -1437827700, -1437827400, -1437827100,\n               -1437826800, -1437826500, -1437826200, -1437825900, -1437825600,\n               -1437825300, -1437825000, -1437824700, -1437824400, -1437824100,\n               -1437823800, -1437823500, -1437823200, -1437822900, -1437822600,\n               -1437822300, -1437822000, -1437821700, -1437821400, -1437821100,\n               -1437820800])]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 10, 48)),\n            [('30 minutes',\n              ['10:00', '10:30', '11:00'],\n              [-1437832800, -1437831000, -1437829200]),\n             ('15 minutes',\n              ['10:00', '10:15', '10:30', '10:45', '11:00'],\n              [-1437832800, -1437831900, -1437831000, -1437830100,\n               -1437829200]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30', '10:40', '10:50'],\n              [-1437832800, -1437832200, -1437831600, -1437831000, -1437830400,\n               -1437829800]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30',\n               '10:35', '10:40', '10:45', '10:50'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300, -1437831000, -1437830700, -1437830400, -1437830100,\n               -1437829800]),\n             ('1 minute',\n              ['10:00', '10:01', '10:02', '10:03', '10:04', '10:05', '10:06',\n               '10:07', '10:08', '10:09', '10:10', '10:11', '10:12', '10:13',\n               '10:14', '10:15', '10:16', '10:17', '10:18', '10:19', '10:20',\n               '10:21', '10:22', '10:23', '10:24', '10:25', '10:26', '10:27',\n               '10:28', '10:29', '10:30', '10:31', '10:32', '10:33', '10:34',\n               '10:35', '10:36', '10:37', '10:38', '10:39', '10:40', '10:41',\n               '10:42', '10:43', '10:44', '10:45', '10:46', '10:47', '10:48',\n               '10:49'],\n              [-1437832800, -1437832740, -1437832680, -1437832620, -1437832560,\n               -1437832500, -1437832440, -1437832380, -1437832320, -1437832260,\n               -1437832200, -1437832140, -1437832080, -1437832020, -1437831960,\n               -1437831900, -1437831840, -1437831780, -1437831720, -1437831660,\n               -1437831600, -1437831540, -1437831480, -1437831420, -1437831360,\n               -1437831300, -1437831240, -1437831180, -1437831120, -1437831060,\n               -1437831000, -1437830940, -1437830880, -1437830820, -1437830760,\n               -1437830700, -1437830640, -1437830580, -1437830520, -1437830460,\n               -1437830400, -1437830340, -1437830280, -1437830220, -1437830160,\n               -1437830100, -1437830040, -1437829980, -1437829920, -1437829860]\n              )]\n        )\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10), (1924, 6, 9, 10, 20)),\n            [('15 minutes',\n              ['10:00', '10:15', '10:30'],\n              [-1437832800, -1437831900, -1437831000]),\n             ('10 minutes',\n              ['10:00', '10:10', '10:20', '10:30'],\n              [-1437832800, -1437832200, -1437831600, -1437831000]),\n             ('5 minutes',\n              ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25'],\n              [-1437832800, -1437832500, -1437832200, -1437831900, -1437831600,\n               -1437831300]),\n             ('1 minute',\n              ['10:00', '10:01', '10:02', '10:03', '10:04', '10:05', '10:06',\n               '10:07', '10:08', '10:09', '10:10', '10:11', '10:12', '10:13',\n               '10:14', '10:15', '10:16', '10:17', '10:18', '10:19', '10:20',\n               '10:21'],\n              [-1437832800, -1437832740, -1437832680, -1437832620, -1437832560,\n               -1437832500, -1437832440, -1437832380, -1437832320, -1437832260,\n               -1437832200, -1437832140, -1437832080, -1437832020, -1437831960,\n               -1437831900, -1437831840, -1437831780, -1437831720, -1437831660,\n               -1437831600, -1437831540]),\n             ('30 seconds',\n              ['10:00:00', '10:00:30', '10:01:00', '10:01:30', '10:02:00',\n               '10:02:30', '10:03:00', '10:03:30', '10:04:00', '10:04:30',\n               '10:05:00', '10:05:30', '10:06:00', '10:06:30', '10:07:00',\n               '10:07:30', '10:08:00', '10:08:30', '10:09:00', '10:09:30',\n               '10:10:00', '10:10:30', '10:11:00', '10:11:30', '10:12:00',\n               '10:12:30', '10:13:00', '10:13:30', '10:14:00', '10:14:30',\n               '10:15:00', '10:15:30', '10:16:00', '10:16:30', '10:17:00',\n               '10:17:30', '10:18:00', '10:18:30', '10:19:00', '10:19:30',\n               '10:20:00', '10:20:30'],\n              [-1437832800, -1437832770, -1437832740, -1437832710, -1437832680,\n               -1437832650, -1437832620, -1437832590, -1437832560, -1437832530,\n               -1437832500, -1437832470, -1437832440, -1437832410, -1437832380,\n               -1437832350, -1437832320, -1437832290, -1437832260, -1437832230,\n               -1437832200, -1437832170, -1437832140, -1437832110, -1437832080,\n               -1437832050, -1437832020, -1437831990, -1437831960, -1437831930,\n               -1437831900, -1437831870, -1437831840, -1437831810, -1437831780,\n               -1437831750, -1437831720, -1437831690, -1437831660, -1437831630,\n               -1437831600, -1437831570])])\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10, 12, 33), (1924, 6, 9, 10, 18, 12)),\n            [('5 minutes',\n              ['10:10', '10:15', '10:20'],\n              [-1437832200, -1437831900, -1437831600]),\n             ('1 minute',\n              ['10:12', '10:13', '10:14', '10:15', '10:16', '10:17', '10:18',\n               '10:19'],\n              [-1437832080, -1437832020, -1437831960, -1437831900, -1437831840,\n               -1437831780, -1437831720, -1437831660]),\n             ('30 seconds',\n              ['10:12:30', '10:13:00', '10:13:30', '10:14:00', '10:14:30',\n               '10:15:00', '10:15:30', '10:16:00', '10:16:30', '10:17:00',\n               '10:17:30', '10:18:00', '10:18:30'],\n              [-1437832050, -1437832020, -1437831990, -1437831960, -1437831930,\n               -1437831900, -1437831870, -1437831840, -1437831810, -1437831780,\n               -1437831750, -1437831720, -1437831690]),\n             ('15 seconds',\n              ['10:12:30', '10:12:45', '10:13:00', '10:13:15', '10:13:30',\n               '10:13:45', '10:14:00', '10:14:15', '10:14:30', '10:14:45',\n               '10:15:00', '10:15:15', '10:15:30', '10:15:45', '10:16:00',\n               '10:16:15', '10:16:30', '10:16:45', '10:17:00', '10:17:15',\n               '10:17:30', '10:17:45', '10:18:00', '10:18:15'],\n              [-1437832050, -1437832035, -1437832020, -1437832005, -1437831990,\n               -1437831975, -1437831960, -1437831945, -1437831930, -1437831915,\n               -1437831900, -1437831885, -1437831870, -1437831855, -1437831840,\n               -1437831825, -1437831810, -1437831795, -1437831780, -1437831765,\n               -1437831750, -1437831735, -1437831720, -1437831705]),\n             ('10 seconds',\n              ['10:12:30', '10:12:40', '10:12:50', '10:13:00', '10:13:10',\n               '10:13:20', '10:13:30', '10:13:40', '10:13:50', '10:14:00',\n               '10:14:10', '10:14:20', '10:14:30', '10:14:40', '10:14:50',\n               '10:15:00', '10:15:10', '10:15:20', '10:15:30', '10:15:40',\n               '10:15:50', '10:16:00', '10:16:10', '10:16:20', '10:16:30',\n               '10:16:40', '10:16:50', '10:17:00', '10:17:10', '10:17:20',\n               '10:17:30', '10:17:40', '10:17:50', '10:18:00', '10:18:10',\n               '10:18:20'],\n              [-1437832050, -1437832040, -1437832030, -1437832020, -1437832010,\n               -1437832000, -1437831990, -1437831980, -1437831970, -1437831960,\n               -1437831950, -1437831940, -1437831930, -1437831920, -1437831910,\n               -1437831900, -1437831890, -1437831880, -1437831870, -1437831860,\n               -1437831850, -1437831840, -1437831830, -1437831820, -1437831810,\n               -1437831800, -1437831790, -1437831780, -1437831770, -1437831760,\n               -1437831750, -1437831740, -1437831730, -1437831720, -1437831710,\n               -1437831700])])\n\n        self.assertEqual(\n            testbin((1924, 6, 9, 10, 12, 33), (1924, 6, 9, 10, 13, 12)),\n            [('30 seconds',\n              ['10:12:30', '10:13:00', '10:13:30'],\n              [-1437832050, -1437832020, -1437831990]),\n             ('15 seconds',\n              ['10:12:30', '10:12:45', '10:13:00', '10:13:15'],\n              [-1437832050, -1437832035, -1437832020, -1437832005]),\n             ('10 seconds',\n              ['10:12:30', '10:12:40', '10:12:50', '10:13:00', '10:13:10',\n               '10:13:20'],\n              [-1437832050, -1437832040, -1437832030, -1437832020, -1437832010,\n               -1437832000]),\n             ('5 seconds',\n              ['10:12:30', '10:12:35', '10:12:40', '10:12:45', '10:12:50',\n               '10:12:55', '10:13:00', '10:13:05', '10:13:10', '10:13:15'],\n              [-1437832050, -1437832045, -1437832040, -1437832035, -1437832030,\n               -1437832025, -1437832020, -1437832015, -1437832010,\n               -1437832005]),\n             ('1 second',\n              ['10:12:33', '10:12:34', '10:12:35', '10:12:36', '10:12:37',\n               '10:12:38', '10:12:39', '10:12:40', '10:12:41', '10:12:42',\n               '10:12:43', '10:12:44', '10:12:45', '10:12:46', '10:12:47',\n               '10:12:48', '10:12:49', '10:12:50', '10:12:51', '10:12:52',\n               '10:12:53', '10:12:54', '10:12:55', '10:12:56', '10:12:57',\n               '10:12:58', '10:12:59', '10:13:00', '10:13:01', '10:13:02',\n               '10:13:03', '10:13:04', '10:13:05', '10:13:06', '10:13:07',\n               '10:13:08', '10:13:09', '10:13:10', '10:13:11', '10:13:12',\n               '10:13:13'],\n              [-1437832047, -1437832046, -1437832045, -1437832044, -1437832043,\n               -1437832042, -1437832041, -1437832040, -1437832039, -1437832038,\n               -1437832037, -1437832036, -1437832035, -1437832034, -1437832033,\n               -1437832032, -1437832031, -1437832030, -1437832029, -1437832028,\n               -1437832027, -1437832026, -1437832025, -1437832024, -1437832023,\n               -1437832022, -1437832021, -1437832020, -1437832019, -1437832018,\n               -1437832017, -1437832016, -1437832015, -1437832014, -1437832013,\n               -1437832012, -1437832011, -1437832010, -1437832009, -1437832008,\n               -1437832007])])\n\n        self.assertEqual(\n            testbin((1973, 9, 14), (2010, 9, 8)),\n            [\n                ('50 years',\n                 ['1950', '2000', '2050'],\n                 [-631152000, 946684800, 2524608000]),\n                ('25 years',\n                 ['1950', '1975', '2000', '2025'],\n                 [-631152000, 157766400, 946684800, 1735689600]),\n                ('10 years',\n                 ['1970', '1980', '1990', '2000', '2010', '2020'],\n                 [0, 315532800, 631152000, 946684800, 1262304000, 1577836800]),\n                ('5 years',\n                 ['1970', '1975', '1980', '1985', '1990', '1995', '2000',\n                  '2005', '2010', '2015'],\n                 [0, 157766400, 315532800, 473385600, 631152000, 788918400,\n                  946684800, 1104537600, 1262304000, 1420070400]),\n                ('2 years',\n                 ['1972', '1974', '1976', '1978', '1980', '1982', '1984',\n                  '1986', '1988', '1990', '1992', '1994', '1996', '1998',\n                  '2000', '2002', '2004', '2006', '2008', '2010', '2012'],\n                 [63072000, 126230400, 189302400, 252460800, 315532800,\n                  378691200, 441763200, 504921600, 567993600, 631152000,\n                  694224000, 757382400, 820454400, 883612800, 946684800,\n                  1009843200, 1072915200, 1136073600, 1199145600, 1262304000,\n                  1325376000]),\n                ('1 year',\n                 ['1973', '1974', '1975', '1976', '1977', '1978', '1979',\n                  '1980', '1981', '1982', '1983', '1984', '1985', '1986',\n                  '1987', '1988', '1989', '1990', '1991', '1992', '1993',\n                  '1994', '1995', '1996', '1997', '1998', '1999', '2000',\n                  '2001', '2002', '2003', '2004', '2005', '2006', '2007',\n                  '2008', '2009', '2010', '2011'],\n                 [94694400, 126230400, 157766400, 189302400, 220924800,\n                  252460800, 283996800, 315532800, 347155200, 378691200,\n                  410227200, 441763200, 473385600, 504921600, 536457600,\n                  567993600, 599616000, 631152000, 662688000, 694224000,\n                  725846400, 757382400, 788918400, 820454400, 852076800,\n                  883612800, 915148800, 946684800, 978307200, 1009843200,\n                  1041379200, 1072915200, 1104537600, 1136073600, 1167609600,\n                  1199145600, 1230768000, 1262304000, 1293840000])\n            ]\n        )\n\n    def test_min_unique(self):\n        bins = time_binnings(self.dates, min_unique=7)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds[:-1], self.dates)\n\n    def test_add_unique(self):\n        bins = time_binnings(self.dates, add_unique=7)\n        self.assertNotEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds[:-1], self.dates)\n\n    def test_limits(self):\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=9, max_bins=17)},\n            {9, 17})\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=9, max_bins=16)},\n            {9})\n        self.assertEqual(\n            {b.nbins\n             for b in time_binnings(self.dates, min_bins=10, max_bins=17)},\n            {17})\n\n    def test_single_value(self):\n        dates = np.array([42])\n        bins = time_binnings(dates)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds, [42, 43])\n\n    def test_multiple_identical(self):\n        dates = np.array([42] * 5)\n        bins = time_binnings(dates)\n        self.assertEqual(len(bins), 1)\n        np.testing.assert_equal(bins[0].thresholds, [42, 43])\n\n    def test_no_values(self):\n        dates = np.array([])\n        self.assertRaises(ValueError, time_binnings, dates)\n\n        dates = np.array([np.nan, np.nan])\n        self.assertRaises(ValueError, time_binnings, dates)\n\n    def test_before_epoch(self):\n        hour = 24 * 60 * 60\n        dates = [-hour, 0, hour,]\n        bins = time_binnings(dates)\n        self.assertEqual(list(bins[0].thresholds), [-hour, 0, hour, 2 * hour])\n\n\nclass TestBinDefinition(unittest.TestCase):\n    def test_labels(self):\n        thresholds = np.array([1, 2, 3.14])\n        self.assertEqual(BinDefinition(thresholds).labels,\n                         [\"1\", \"2\", \"3.14\"])\n        self.assertEqual(BinDefinition(thresholds, \"%.3f\").labels,\n                         [\"1.000\", \"2.000\", \"3.140\"])\n        self.assertEqual(BinDefinition(thresholds, lambda x: f\"b{x:g}\").labels,\n                         [\"b1\", \"b2\", \"b3.14\"])\n        self.assertEqual(BinDefinition(thresholds, list(\"abc\")).labels,\n                         list(\"abc\"))\n\n    def test_width_label(self):\n        thresholds = np.array([1, 2, 3.14])\n        self.assertEqual(BinDefinition(thresholds).width_label, \"\")\n        self.assertEqual(BinDefinition(thresholds, width=3).width_label, \"3\")\n        self.assertEqual(BinDefinition(thresholds, width=3.14).width_label, \"3.14\")\n\n    def test_thresholds(self):\n        thresholds = np.array([1, 2, 3.14])\n        bindef = BinDefinition(thresholds)\n        np.testing.assert_equal(bindef.thresholds, thresholds)\n        self.assertEqual(bindef.start, 1)\n        self.assertEqual(bindef.nbins, 2)\n\n\nclass TestDiscretizer(unittest.TestCase):\n    def test_equality(self):\n        v1 = ContinuousVariable(\"x\")\n        v2 = ContinuousVariable(\"x\", number_of_decimals=42)\n        v3 = ContinuousVariable(\"y\")\n        assert v1 == v2\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [0, 2, 1])\n        t2 = Discretizer(v3, [0, 2, 1])\n        self.assertEqual(t1, t1)\n        self.assertEqual(t1, t1a)\n        self.assertNotEqual(t1, t2)\n\n        self.assertEqual(hash(t1), hash(t1a))\n        self.assertNotEqual(hash(t1), hash(t2))\n\n        t1 = Discretizer(v1, [0, 2, 1])\n        t1a = Discretizer(v2, [1, 2, 0])\n        self.assertNotEqual(t1, t1a)\n        self.assertNotEqual(hash(t1), hash(t1a))\n\n    def test_fmt_interval(self):\n        def fmt(x):\n            return f\"{x:.2f}\"\n\n        f = Discretizer._fmt_interval\n        self.assertEqual(f(1, 2, str), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt), \"1 - 2\")\n        self.assertEqual(f(1, 2, fmt, strip_zeros=False), \"1.00 - 2.00\")\n\n        self.assertEqual(f(-np.inf, 2, fmt), \"< 2\")\n        self.assertEqual(f(-np.inf, 2, fmt, strip_zeros=False), \"< 2.00\")\n        self.assertEqual(f(None, 2, fmt), \"< 2\")\n        self.assertEqual(f(None, 2, fmt, strip_zeros=False), \"< 2.00\")\n\n        self.assertEqual(f(2, np.inf, fmt), \"≥ 2\")\n        self.assertEqual(f(2, np.inf, fmt, strip_zeros=False), \"≥ 2.00\")\n        self.assertEqual(f(2, None, fmt), \"≥ 2\")\n        self.assertEqual(f(2, None, fmt, strip_zeros=False), \"≥ 2.00\")\n\n        with self.assertRaises(ValueError):\n            f(1.122, 1.123, fmt)\n\n\n    def test_get_labels(self):\n        points = [2.46, 2.68, 2.794]\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.1f}\", points),\n            ['< 2.5', '2.5 - 2.7', '2.7 - 2.8', '≥ 2.8']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.2f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.79', '≥ 2.79']\n        )\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points),\n            ['< 2.46', '2.46 - 2.68', '2.68 - 2.794', '≥ 2.794']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", points,\n                                    strip_zeros=False),\n            ['< 2.4600', '2.4600 - 2.6800', '2.6800 - 2.7940', '≥ 2.7940']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [100, 200]),\n            ['< 100', '100 - 200', '≥ 200']\n        )\n\n        self.assertEqual(\n            Discretizer._get_labels(lambda x: f\"{x:.4f}\", [0]),\n            ['< 0', '≥ 0']\n        )\n\n    def test_get_discretized_values_empty(self):\n        x = ContinuousVariable(\"x\")\n        d = Discretizer(x, [])\n        points, values, to_sql = d._get_discretized_values(None, np.array([]))\n        self.assertEqual(len(points), 0)\n        self.assertEqual(values, [\"single_value\"])\n        self.assertIsInstance(to_sql, SingleValueSql)\n\n    def test_get_discretized_values_identical_points(self):\n        x = ContinuousVariable(\"x\")\n        with self.assertRaises(ValueError):\n            Discretizer._get_discretized_values(x, np.array([0, 1, 1, 2]))\n\n    def test_get_discretized_values_no_ndigits(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=2)\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2, 3, 4]))\n        np.testing.assert_equal(points, [1, 2, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, np.array([1, 2.1, 3, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1, 2.1, 3.1234, 4]))\n        np.testing.assert_equal(points, [1, 2.1, 3.1234, 4])\n        self.assertEqual(values, ['< 1', '1 - 2.1', '2.1 - 3.1234', '3.1234 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            4]))\n        np.testing.assert_equal(points, [1, 2.1000000001, 2.1000000002, 4])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 4',\n                                  '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.1000000002,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([1,\n                                                            2.1000000001,\n                                                            2.100000000211,\n                                                            2.1000000003]))\n        np.testing.assert_equal(points,\n                                [1, 2.1000000001, 2.1000000002, 2.1000000003])\n        self.assertEqual(values, ['< 1',\n                                  '1 - 2.1000000001',\n                                  '2.1000000001 - 2.1000000002',\n                                  '2.1000000002 - 2.1000000003',\n                                  '≥ 2.1000000003'])\n        self.assertIsInstance(to_sql, BinSql)\n\n    def test_get_discretized_values_round_builtin_vs_numpy(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=0)\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.3455,\n                                                            2.346]))\n        np.testing.assert_equal(points,\n                                [2.345, 2.346])\n        self.assertEqual(values, ['< 2.345',\n                                  '2.345 - 2.346',\n                                  '≥ 2.346'])\n\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.1345,\n                                                            2.135]))\n        np.testing.assert_equal(points,\n                                [2.1345, 2.135])\n        self.assertEqual(values, ['< 2.1345',\n                                  '2.1345 - 2.135',\n                                  '≥ 2.135'])\n\n    def test_get_discretized_values_with_ndigits(self):\n        x = ContinuousVariable(\"x\")\n        apoints = [1, 2, 3, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=0)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1', '1 - 2', '2 - 3', '3 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=2)\n        np.testing.assert_array_equal(points, np.array([1, 2, 3, 4]))\n        self.assertEqual(values, ['< 1.00', '1.00 - 2.00', '2.00 - 3.00',\n                                  '3.00 - 4.00', '≥ 4.00'])\n        self.assertIsInstance(to_sql, BinSql)\n\n        apoints = [1, 2.1234, 2.1345, 4]\n        points, values, to_sql \\\n            = Discretizer._get_discretized_values(x, apoints, ndigits=1)\n        np.testing.assert_array_equal(points, np.array([1, 2.12, 2.13, 4]))\n        self.assertEqual(values,\n                         ['< 1', '1 - 2.12', '2.12 - 2.13', '2.13 - 4', '≥ 4'])\n        self.assertIsInstance(to_sql, BinSql)\n\n\nif __name__ == '__main__':\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nVerifying Orange installation...\n❌ Orange verification failed\nPython 3.7 installation failed, trying Python 3.8...\nAttempting installation with Python 3.8...\nVerifying Orange installation...\n❌ Orange verification failed\nPython 3.7,3.8 installation failed, trying Python 3.8...\nAttempting installation with Python 3.10...\nCompiling Orange/classification/_tree_scorers.pyx because it changed.\nCompiling Orange/data/_contingency.pyx because it changed.\nCompiling Orange/data/_io.pyx because it changed.\nCompiling Orange/data/_valuecount.pyx because it changed.\nCompiling Orange/data/_variable.pyx because it changed.\nCompiling Orange/distance/_distance.pyx because it changed.\nCompiling Orange/preprocess/_discretize.pyx because it changed.\nCompiling Orange/preprocess/_relieff.pyx because it changed.\nCompiling Orange/projection/_som.pyx because it changed.\n[1/9] Cythonizing Orange/classification/_tree_scorers.pyx\n[2/9] Cythonizing Orange/data/_contingency.pyx\n[3/9] Cythonizing Orange/data/_io.pyx\n[4/9] Cythonizing Orange/data/_valuecount.pyx\n[5/9] Cythonizing Orange/data/_variable.pyx\n[6/9] Cythonizing Orange/distance/_distance.pyx\n[7/9] Cythonizing Orange/preprocess/_discretize.pyx\n[8/9] Cythonizing Orange/preprocess/_relieff.pyx\n[9/9] Cythonizing Orange/projection/_som.pyx\nrunning build_ext\nbuilding 'Orange.classification._simple_tree' extension\ncreating build/temp.linux-x86_64-cpython-310/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/classification/_simple_tree.c -o build/temp.linux-x86_64-cpython-310/Orange/classification/_simple_tree.o\ncreating build/lib.linux-x86_64-cpython-310/Orange/classification\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/classification/_simple_tree.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncreating build/temp.linux-x86_64-cpython-310/Orange/widgets/utils\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/widgets/utils/_grid_density.cpp -o build/temp.linux-x86_64-cpython-310/Orange/widgets/utils/_grid_density.o\ncreating build/lib.linux-x86_64-cpython-310/Orange/widgets/utils\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -pthread -shared build/temp.linux-x86_64-cpython-310/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/widgets/utils/_grid_density.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.classification._tree_scorers' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/classification/_tree_scorers.c -o build/temp.linux-x86_64-cpython-310/Orange/classification/_tree_scorers.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/classification/_tree_scorers.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncreating build/temp.linux-x86_64-cpython-310/Orange/data\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/data/_contingency.c -o build/temp.linux-x86_64-cpython-310/Orange/data/_contingency.o\ncreating build/lib.linux-x86_64-cpython-310/Orange/data\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/data/_contingency.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/data/_io.c -o build/temp.linux-x86_64-cpython-310/Orange/data/_io.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/data/_io.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/data/_valuecount.c -o build/temp.linux-x86_64-cpython-310/Orange/data/_valuecount.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/data/_valuecount.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/data/_variable.c -o build/temp.linux-x86_64-cpython-310/Orange/data/_variable.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/data/_variable.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncreating build/temp.linux-x86_64-cpython-310/Orange/distance\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/distance/_distance.c -o build/temp.linux-x86_64-cpython-310/Orange/distance/_distance.o\ncreating build/lib.linux-x86_64-cpython-310/Orange/distance\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/distance/_distance.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncreating build/temp.linux-x86_64-cpython-310/Orange/preprocess\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/preprocess/_discretize.c -o build/temp.linux-x86_64-cpython-310/Orange/preprocess/_discretize.o\ncreating build/lib.linux-x86_64-cpython-310/Orange/preprocess\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/preprocess/_discretize.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/preprocess/_relieff.cpp -o build/temp.linux-x86_64-cpython-310/Orange/preprocess/_relieff.o\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -pthread -shared build/temp.linux-x86_64-cpython-310/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/preprocess/_relieff.cpython-310-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncreating build/temp.linux-x86_64-cpython-310/Orange/projection\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10 -c Orange/projection/_som.c -o build/temp.linux-x86_64-cpython-310/Orange/projection/_som.o\ncreating build/lib.linux-x86_64-cpython-310/Orange/projection\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-310/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-310/Orange/projection/_som.cpython-310-x86_64-linux-gnu.so\ncopying build/lib.linux-x86_64-cpython-310/Orange/classification/_simple_tree.cpython-310-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-310/Orange/widgets/utils/_grid_density.cpython-310-x86_64-linux-gnu.so -> Orange/widgets/utils\ncopying build/lib.linux-x86_64-cpython-310/Orange/classification/_tree_scorers.cpython-310-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_contingency.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_io.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_valuecount.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_variable.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/distance/_distance.cpython-310-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-cpython-310/Orange/preprocess/_discretize.cpython-310-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-310/Orange/preprocess/_relieff.cpython-310-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-310/Orange/projection/_som.cpython-310-x86_64-linux-gnu.so -> Orange/projection\nrunning develop\nrunning egg_info\ncreating Orange3.egg-info\nwriting Orange3.egg-info/PKG-INFO\nwriting dependency_links to Orange3.egg-info/dependency_links.txt\nwriting entry points to Orange3.egg-info/entry_points.txt\nwriting requirements to Orange3.egg-info/requires.txt\nwriting top-level names to Orange3.egg-info/top_level.txt\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncopying build/lib.linux-x86_64-cpython-310/Orange/classification/_simple_tree.cpython-310-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-310/Orange/widgets/utils/_grid_density.cpython-310-x86_64-linux-gnu.so -> Orange/widgets/utils\ncopying build/lib.linux-x86_64-cpython-310/Orange/classification/_tree_scorers.cpython-310-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_contingency.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_io.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_valuecount.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/data/_variable.cpython-310-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-310/Orange/distance/_distance.cpython-310-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-cpython-310/Orange/preprocess/_discretize.cpython-310-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-310/Orange/preprocess/_relieff.cpython-310-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-310/Orange/projection/_som.cpython-310-x86_64-linux-gnu.so -> Orange/projection\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.38.0.dev0+a410361 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5\nProcessing dependencies for Orange3==3.38.0.dev0+a410361\nSearching for XlsxWriter==3.2.0\nBest match: XlsxWriter 3.2.0\nAdding XlsxWriter 3.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for xgboost==2.0.3\nBest match: xgboost 2.0.3\nAdding xgboost 2.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for scipy==1.15.0\nBest match: scipy 1.15.0\nAdding scipy 1.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for scikit-learn==1.6.0\nBest match: scikit-learn 1.6.0\nAdding scikit-learn 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for requests==2.32.3\nBest match: requests 2.32.3\nAdding requests 2.32.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for qtconsole==5.6.1\nBest match: qtconsole 5.6.1\nAdding qtconsole 5.6.1 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for PyYAML==6.0.2\nBest match: PyYAML 6.0.2\nAdding PyYAML 6.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pyqtgraph==0.13.7\nBest match: pyqtgraph 0.13.7\nAdding pyqtgraph 0.13.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pygments==2.19.1\nBest match: pygments 2.19.1\nAdding pygments 2.19.1 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pip==24.3.1\nBest match: pip 24.3.1\nAdding pip 24.3.1 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pandas==2.2.3\nBest match: pandas 2.2.3\nAdding pandas 2.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for packaging==24.2\nBest match: packaging 24.2\nAdding packaging 24.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/_vendor\nSearching for orange-widget-base==4.25.1\nBest match: orange-widget-base 4.25.1\nAdding orange-widget-base 4.25.1 to easy-install.pth file\ndetected new path './setuptools/_vendor'\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for orange-canvas-core==0.2.5\nBest match: orange-canvas-core 0.2.5\nAdding orange-canvas-core 0.2.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for openpyxl==3.1.5\nBest match: openpyxl 3.1.5\nAdding openpyxl 3.1.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for openTSNE==1.0.2\nBest match: openTSNE 1.0.2\nAdding openTSNE 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for numpy==1.26.4\nBest match: numpy 1.26.4\nAdding numpy 1.26.4 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for networkx==3.4.2\nBest match: networkx 3.4.2\nAdding networkx 3.4.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for matplotlib==3.10.0\nBest match: matplotlib 3.10.0\nAdding matplotlib 3.10.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for keyrings.alt==5.0.2\nBest match: keyrings.alt 5.0.2\nAdding keyrings.alt 5.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for keyring==25.6.0\nBest match: keyring 25.6.0\nAdding keyring 25.6.0 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for joblib==1.4.2\nBest match: joblib 1.4.2\nAdding joblib 1.4.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for httpx==0.28.1\nBest match: httpx 0.28.1\nAdding httpx 0.28.1 to easy-install.pth file\nInstalling httpx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for catboost==1.2.7\nBest match: catboost 1.2.7\nAdding catboost 1.2.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for Bottleneck==1.4.2\nBest match: Bottleneck 1.4.2\nAdding Bottleneck 1.4.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for threadpoolctl==3.5.0\nBest match: threadpoolctl 3.5.0\nAdding threadpoolctl 3.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for urllib3==2.3.0\nBest match: urllib3 2.3.0\nAdding urllib3 2.3.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for QtPy==2.4.2\nBest match: QtPy 2.4.2\nAdding QtPy 2.4.2 to easy-install.pth file\nInstalling qtpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for ipykernel==6.29.5\nBest match: ipykernel 6.29.5\nAdding ipykernel 6.29.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jupyter-client==8.6.3\nBest match: jupyter-client 8.6.3\nAdding jupyter-client 8.6.3 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jupyter-core==5.7.2\nBest match: jupyter-core 5.7.2\nAdding jupyter-core 5.7.2 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for traitlets==5.14.3\nBest match: traitlets 5.14.3\nAdding traitlets 5.14.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for tzdata==2024.2\nBest match: tzdata 2024.2\nAdding tzdata 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for typing-extensions==4.12.2\nBest match: typing-extensions 4.12.2\ntyping-extensions 4.12.2 is already the active version in easy-install.pth\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/_vendor\nSearching for qasync==0.27.1\nBest match: qasync 0.27.1\nAdding qasync 0.27.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for requests-cache==1.2.1\nBest match: requests-cache 1.2.1\nAdding requests-cache 1.2.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for docutils==0.21.2\nBest match: docutils 0.21.2\nAdding docutils 0.21.2 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2html script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2html4 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2html5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2latex script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2man script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2odt script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2pseudoxml script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2s5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2xetex script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling rst2xml script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for et-xmlfile==2.0.0\nBest match: et-xmlfile 2.0.0\nAdding et-xmlfile 2.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pyparsing==3.2.1\nBest match: pyparsing 3.2.1\nAdding pyparsing 3.2.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pillow==11.1.0\nBest match: pillow 11.1.0\nAdding pillow 11.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for kiwisolver==1.4.8\nBest match: kiwisolver 1.4.8\nAdding kiwisolver 1.4.8 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for fonttools==4.55.3\nBest match: fonttools 4.55.3\nAdding fonttools 4.55.3 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for cycler==0.12.1\nBest match: cycler 0.12.1\nAdding cycler 0.12.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for contourpy==1.3.1\nBest match: contourpy 1.3.1\nAdding contourpy 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jaraco.context==6.0.1\nBest match: jaraco.context 6.0.1\nAdding jaraco.context 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jaraco.classes==3.4.0\nBest match: jaraco.classes 3.4.0\nAdding jaraco.classes 3.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jaraco.functools==4.1.0\nBest match: jaraco.functools 4.1.0\nAdding jaraco.functools 4.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for importlib-metadata==8.5.0\nBest match: importlib-metadata 8.5.0\nAdding importlib-metadata 8.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for httpcore==1.0.7\nBest match: httpcore 1.0.7\nAdding httpcore 1.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for anyio==4.8.0\nBest match: anyio 4.8.0\nAdding anyio 4.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for plotly==5.24.1\nBest match: plotly 5.24.1\nAdding plotly 5.24.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for graphviz==0.20.3\nBest match: graphviz 0.20.3\nAdding graphviz 0.20.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for tornado==6.4.2\nBest match: tornado 6.4.2\nAdding tornado 6.4.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pyzmq==26.2.0\nBest match: pyzmq 26.2.0\nAdding pyzmq 26.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for psutil==6.1.1\nBest match: psutil 6.1.1\nAdding psutil 6.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for nest-asyncio==1.6.0\nBest match: nest-asyncio 1.6.0\nAdding nest-asyncio 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for matplotlib-inline==0.1.7\nBest match: matplotlib-inline 0.1.7\nAdding matplotlib-inline 0.1.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for ipython==8.31.0\nBest match: ipython 8.31.0\nAdding ipython 8.31.0 to easy-install.pth file\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for debugpy==1.8.11\nBest match: debugpy 1.8.11\nAdding debugpy 1.8.11 to easy-install.pth file\nInstalling debugpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for comm==0.2.2\nBest match: comm 0.2.2\nAdding comm 0.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for platformdirs==4.3.6\nBest match: platformdirs 4.3.6\nAdding platformdirs 4.3.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for cattrs==24.1.2\nBest match: cattrs 24.1.2\nAdding cattrs 24.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for attrs==24.3.0\nBest match: attrs 24.3.0\nAdding attrs 24.3.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for backports.tarfile==1.2.0\nBest match: backports.tarfile 1.2.0\nbackports.tarfile 1.2.0 is already the active version in easy-install.pth\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/_vendor\nSearching for more-itertools==10.5.0\nBest match: more-itertools 10.5.0\nAdding more-itertools 10.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for zipp==3.21.0\nBest match: zipp 3.21.0\nAdding zipp 3.21.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for h11==0.14.0\nBest match: h11 0.14.0\nAdding h11 0.14.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for tenacity==9.0.0\nBest match: tenacity 9.0.0\nAdding tenacity 9.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for stack-data==0.6.3\nBest match: stack-data 0.6.3\nAdding stack-data 0.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for prompt-toolkit==3.0.48\nBest match: prompt-toolkit 3.0.48\nAdding prompt-toolkit 3.0.48 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pexpect==4.9.0\nBest match: pexpect 4.9.0\nAdding pexpect 4.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for jedi==0.19.2\nBest match: jedi 0.19.2\nAdding jedi 0.19.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for decorator==5.1.1\nBest match: decorator 5.1.1\nAdding decorator 5.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for cffi==1.17.1\nBest match: cffi 1.17.1\nAdding cffi 1.17.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pure-eval==0.2.3\nBest match: pure-eval 0.2.3\nAdding pure-eval 0.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for asttokens==3.0.0\nBest match: asttokens 3.0.0\nAdding asttokens 3.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for executing==2.1.0\nBest match: executing 2.1.0\nAdding executing 2.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for wcwidth==0.2.13\nBest match: wcwidth 0.2.13\nAdding wcwidth 0.2.13 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for ptyprocess==0.7.0\nBest match: ptyprocess 0.7.0\nAdding ptyprocess 0.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for parso==0.8.4\nBest match: parso 0.8.4\nAdding parso 0.8.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nSearching for pycparser==2.22\nBest match: pycparser 2.22\nAdding pycparser 2.22 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages\nFinished processing dependencies for Orange3==3.38.0.dev0+a410361\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.10\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 152ms\nPrepared 18 packages in 19ms\nInstalled 18 packages in 153ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\n  × No solution found when resolving dependencies:\n  ╰─▶ Because the current Python version (3.7.9) does not satisfy Python>=3.8 and all of:\n          pandas>=1.4.0,<=1.4.4\n          pandas>=1.5.1,<=1.5.3\n          pandas>=2.0.1,<=2.0.3\n      depend on Python>=3.8, we can conclude that all of:\n          pandas>=1.4.0,<=1.4.4\n          pandas>=1.5.1,<=1.5.3\n          pandas>=2.0.1,<=2.0.3\n       cannot be used.\n      And because only the following versions of pandas are available:\n          pandas<=1.4.0\n          pandas==1.4.1\n          pandas==1.4.2\n          pandas==1.4.3\n          pandas==1.4.4\n          pandas==1.5.0\n          pandas==1.5.1\n          pandas==1.5.2\n          pandas==1.5.3\n          pandas==2.0.0\n          pandas==2.0.1\n          pandas==2.0.2\n          pandas==2.0.3\n          pandas==2.1.0\n          pandas==2.1.1\n          pandas==2.1.2\n          pandas==2.1.3\n          pandas==2.1.4\n          pandas==2.2.0\n          pandas==2.2.1\n          pandas==2.2.2\n          pandas==2.2.3\n      we can conclude that all of:\n          pandas>=1.4.0,<1.5.0\n          pandas>1.5.0,<2.0.0\n          pandas>2.0.0,<2.1.0\n       cannot be used. (1)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.9 and pandas>=2.1.0 depends on Python>=3.9, we can\n      conclude that pandas>=2.1.0 cannot be used.\n      And because we know from (1) that all of:\n          pandas>=1.4.0,<1.5.0\n          pandas>1.5.0,<2.0.0\n          pandas>2.0.0,<2.1.0\n       cannot be used, we can conclude that all of:\n          pandas>=1.4.0,<1.5.0\n          pandas>1.5.0,<2.0.0\n          pandas>2.0.0\n       cannot be used.\n      And because you require one of:\n          pandas>=1.4.0,<1.5.0\n          pandas>1.5.0,<2.0.0\n          pandas>2.0.0\n      we can conclude that your requirements are unsatisfiable.\n\n      hint: Pre-releases are available for `pandas` in the requested range (e.g., 2.2.0rc0), but pre-releases weren't enabled\n      (try: `--prerelease=allow`)\n  × No solution found when resolving dependencies:\n  ╰─▶ Because the current Python version (3.7.9) does not satisfy Python>=3.8 and orange-canvas-core==0.2.2 depends on\n      Python>=3.8, we can conclude that orange-canvas-core==0.2.2 cannot be used.\n      And because only the following versions of orange-canvas-core are available:\n          orange-canvas-core<=0.2.2\n          orange-canvas-core==0.2.3\n          orange-canvas-core==0.2.4\n          orange-canvas-core==0.2.5\n      and orange-canvas-core==0.2.3 was yanked (reason: Source package is missing some files), we can conclude that\n      orange-canvas-core>=0.2.2,<0.2.4 cannot be used. (1)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.9 and orange-canvas-core>=0.2.4 depends on\n      Python>=3.9, we can conclude that orange-canvas-core>=0.2.4 cannot be used.\n      And because we know from (1) that orange-canvas-core>=0.2.2,<0.2.4 cannot be used, we can conclude that\n      orange-canvas-core>=0.2.2 cannot be used.\n      And because you require orange-canvas-core>=0.2.2, we can conclude that your requirements are unsatisfiable.\nResolved 2 packages in 47ms\nInstalled 2 packages in 14ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 5 packages in 68ms\nInstalled 4 packages in 132ms\n + joblib==1.3.2\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + threadpoolctl==3.1.0\nTraceback (most recent call last):\n  File \"setup.py\", line 14, in <module>\n    from trubar import translate\nModuleNotFoundError: No module named 'trubar'\nTraceback (most recent call last):\n  File \"setup.py\", line 14, in <module>\n    from trubar import translate\nModuleNotFoundError: No module named 'trubar'\nUsing CPython 3.8.20\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 15 packages in 197ms\nPrepared 15 packages in 4ms\nInstalled 15 packages in 166ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + iniconfig==2.0.0\n + numpy==1.24.4\n + packaging==24.2\n + pluggy==1.5.0\n + pyqt5==5.15.11\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.15.0\n + pyqtwebengine==5.15.7\n + pyqtwebengine-qt5==5.15.16\n + pytest==8.3.4\n + setuptools==75.3.0\n + tomli==2.2.1\n + wheel==0.45.1\n  × No solution found when resolving dependencies:\n  ╰─▶ Because the current Python version (3.8.20) does not satisfy Python>=3.9 and scikit-learn>=1.5.1 depends on Python>=3.9,\n      we can conclude that scikit-learn>=1.5.1 cannot be used.\n      And because only the following versions of scikit-learn are available:\n          scikit-learn<=1.5.1\n          scikit-learn==1.5.2\n          scikit-learn==1.6.0\n      and you require scikit-learn>=1.5.1, we can conclude that your requirements are unsatisfiable.\n\n      hint: Pre-releases are available for `scikit-learn` in the requested range (e.g., 1.6.0rc1), but pre-releases weren't\n      enabled (try: `--prerelease=allow`)\n  × No solution found when resolving dependencies:\n  ╰─▶ Because the current Python version (3.8.20) does not satisfy Python>=3.9 and orange-widget-base>=4.25.0 depends on\n      Python>=3.9, we can conclude that orange-widget-base>=4.25.0 cannot be used.\n      And because only the following versions of orange-widget-base are available:\n          orange-widget-base<=4.25.0\n          orange-widget-base==4.25.1\n      and you require orange-widget-base>=4.25.0, we can conclude that your requirements are unsatisfiable.\nResolved 2 packages in 11ms\nInstalled 2 packages in 30ms\n + psycopg2==2.9.10\n + pymssql==2.3.2\nTraceback (most recent call last):\n  File \"setup.py\", line 14, in <module>\n    from trubar import translate\nModuleNotFoundError: No module named 'trubar'\nTraceback (most recent call last):\n  File \"setup.py\", line 14, in <module>\n    from trubar import translate\nModuleNotFoundError: No module named 'trubar'\nUsing CPython 3.10.16\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 15 packages in 84ms\nPrepared 15 packages in 1ms\nInstalled 15 packages in 101ms\n + cython==3.0.11\n + exceptiongroup==1.2.2\n + iniconfig==2.0.0\n + numpy==2.2.1\n + packaging==24.2\n + pluggy==1.5.0\n + pyqt5==5.15.11\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.16.1\n + pyqtwebengine==5.15.7\n + pyqtwebengine-qt5==5.15.16\n + pytest==8.3.4\n + setuptools==75.8.0\n + tomli==2.2.1\n + wheel==0.45.1\nResolved 62 packages in 73ms\nUninstalled 1 package in 19ms\nInstalled 60 packages in 780ms\n + anyio==4.8.0\n + backports-tarfile==1.2.0\n + baycomp==1.0.3\n + bottleneck==1.4.2\n + catboost==1.2.7\n + certifi==2024.12.14\n + cffi==1.17.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + contourpy==1.3.1\n + cryptography==44.0.0\n + cycler==0.12.1\n + et-xmlfile==2.0.0\n + fonttools==4.55.3\n + graphviz==0.20.3\n + h11==0.14.0\n + httpcore==1.0.7\n + httpx==0.28.1\n + idna==3.10\n + importlib-metadata==8.5.0\n + jaraco-classes==3.4.0\n + jaraco-context==6.0.1\n + jaraco-functools==4.1.0\n + jeepney==0.8.0\n + joblib==1.4.2\n + keyring==25.6.0\n + keyrings-alt==5.0.2\n + kiwisolver==1.4.8\n + matplotlib==3.10.0\n + more-itertools==10.5.0\n + networkx==3.4.2\n - numpy==2.2.1\n + numpy==1.26.4\n + openpyxl==3.1.5\n + opentsne==1.0.2\n + pandas==2.2.3\n + pillow==11.1.0\n + pip==24.3.1\n + plotly==5.24.1\n + pycparser==2.22\n + pyparsing==3.2.1\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.2\n + requests==2.32.3\n + scikit-learn==1.6.0\n + scipy==1.15.0\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + tenacity==9.0.0\n + threadpoolctl==3.5.0\n + typing-extensions==4.12.2\n + tzdata==2024.2\n + urllib3==2.3.0\n + xgboost==2.0.3\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\n + zipp==3.21.0\nResolved 58 packages in 143ms\nInstalled 39 packages in 206ms\n + anyqt==0.2.0\n + asttokens==3.0.0\n + attrs==24.3.0\n + cattrs==24.1.2\n + comm==0.2.2\n + commonmark==0.9.1\n + debugpy==1.8.11\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.21.2\n + executing==2.1.0\n + ipykernel==6.29.5\n + ipython==8.31.0\n + jedi==0.19.2\n + jupyter-client==8.6.3\n + jupyter-core==5.7.2\n + matplotlib-inline==0.1.7\n + nest-asyncio==1.6.0\n + orange-canvas-core==0.2.5\n + orange-widget-base==4.25.1\n + parso==0.8.4\n + pexpect==4.9.0\n + platformdirs==4.3.6\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pure-eval==0.2.3\n + pygments==2.19.1\n + pyqtgraph==0.13.7\n + pyzmq==26.2.0\n + qasync==0.27.1\n + qtconsole==5.6.1\n + qtpy==2.4.2\n + requests-cache==1.2.1\n + stack-data==0.6.3\n + tornado==6.4.2\n + traitlets==5.14.3\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 39 packages in 128ms\nInstalled 25 packages in 116ms\n + alabaster==1.0.0\n + astroid==3.3.8\n + babel==2.16.0\n + colorama==0.4.6\n + dill==0.3.9\n + imagesize==1.4.1\n + isort==5.13.2\n + jinja2==3.1.5\n + libcst==1.5.1\n + mando==0.7.1\n + markupsafe==3.0.2\n + mccabe==0.7.0\n + pylint==3.3.3\n + radon==6.0.1\n + recommonmark==0.7.1\n + snowballstemmer==2.2.0\n + sphinx==8.1.3\n + sphinxcontrib-applehelp==2.0.0\n + sphinxcontrib-devhelp==2.0.0\n + sphinxcontrib-htmlhelp==2.1.0\n + sphinxcontrib-jsmath==1.0.1\n + sphinxcontrib-qthelp==2.0.0\n + sphinxcontrib-serializinghtml==2.0.0\n + tomlkit==0.13.2\n + trubar==0.3.4\nResolved 2 packages in 3ms\nInstalled 2 packages in 7ms\n + psycopg2==2.9.10\n + pymssql==2.3.2\nperformance hint: Orange/preprocess/_relieff.pyx:63:5: Exception check on 'calc_difference' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'calc_difference' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'calc_difference' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:119:5: Exception check on 'k_nearest_reg' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'k_nearest_reg' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'k_nearest_reg' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:183:5: Exception check on 'k_nearest_per_class' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'k_nearest_per_class' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'k_nearest_per_class' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:161:23: Exception check after calling 'calc_difference' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'calc_difference' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'calc_difference' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:177:23: Exception check after calling 'calc_difference' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'calc_difference' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'calc_difference' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:201:23: Exception check after calling 'calc_difference' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'calc_difference' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'calc_difference' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:217:27: Exception check after calling 'calc_difference' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'calc_difference' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'calc_difference' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:250:25: Exception check after calling 'k_nearest_reg' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'k_nearest_reg' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'k_nearest_reg' to allow an error code to be returned.\nperformance hint: Orange/preprocess/_relieff.pyx:287:31: Exception check after calling 'k_nearest_per_class' will always require the GIL to be acquired.\nPossible solutions:\n\t1. Declare 'k_nearest_per_class' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.\n\t2. Use an 'int' return type on 'k_nearest_per_class' to allow an error code to be returned.\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py:270: UserWarning: Unknown distribution option: 'test_suite'\n  warnings.warn(msg)\nIn file included from /home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10/Python.h:8,\n                 from Orange/classification/_simple_tree.c:781:\n/home/gcpuser/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/include/python3.10/pyconfig.h:1621: warning: \"_GNU_SOURCE\" redefined\n 1621 | #define _GNU_SOURCE 1\n      | \nOrange/classification/_simple_tree.c:2: note: this is the location of the previous definition\n    2 | #define _GNU_SOURCE\n      | \nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/classification/_tree_scorers.c:1253:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:20278:26: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n20278 |   __pyx_t_7 = (__pyx_v_N <= __pyx_v_min_leaf);\n      |                          ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:21847:26: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n21847 |   __pyx_t_1 = (__pyx_v_N <= __pyx_v_min_leaf);\n      |                          ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:22657:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n22657 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:22778:38: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n22778 |           __pyx_t_20 = (__pyx_v_left >= __pyx_v_min_leaf);\n      |                                      ^~\nOrange/classification/_tree_scorers.c:22784:52: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n22784 |           __pyx_t_20 = ((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf);\n      |                                                    ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:24434:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n24434 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:25156:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n25156 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:25216:149: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n25216 |               __pyx_t_16 = ((*((__pyx_t_5numpy_int32_t const  *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i);\n      |                                                                                                                                                     ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/data/_contingency.c:1253:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/data/_io.c: In function ‘__pyx_pf_6Orange_4data_3_io_sparse_read_float.constprop’:\nOrange/data/_io.c:5091:43: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5091 |           __pyx_v_value = ((__pyx_v_value * __pyx_v_decs) + (__pyx_v_c & 0xf));\n      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/data/_io.c:5261:23: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5261 |           __pyx_t_5 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L5_error)\n      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:1148:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 1148 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:2863:7: note: ‘__pyx_v_attr_index’ was declared here\n 2863 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:4691:30: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4691 |           (__pyx_v_atomp[0]) = 0;\n      |           ~~~~~~~~~~~~~~~~~~~^~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/data/_valuecount.c:1253:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/distance/_distance.c:1253:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/preprocess/_discretize.c:1252:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/preprocess/_relieff.cpp:1265:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/projection/_som.c:1253:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_5update_hex’:\nOrange/projection/_som.c:20732:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n20732 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:20731:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n20731 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_10update_sparse_hex.constprop’:\nOrange/projection/_som.c:22819:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n22819 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:22818:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n22818 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_8update_sparse.constprop’:\nOrange/projection/_som.c:21996:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n21996 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:21995:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n21995 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:19911:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n19911 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:19558:7: note: ‘__pyx_v_win_y’ was declared here\n19558 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:19900:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n19900 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:19557:7: note: ‘__pyx_v_win_x’ was declared here\n19557 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:20161:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n20161 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:21717:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n21717 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:21234:7: note: ‘__pyx_v_win_y’ was declared here\n21234 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:21706:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n21706 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:21233:7: note: ‘__pyx_v_win_x’ was declared here\n21233 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py:270: UserWarning: Unknown distribution option: 'test_suite'\n  warnings.warn(msg)\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/command/develop.py:41: EasyInstallDeprecationWarning: easy_install command is deprecated.\n!!\n\n        ********************************************************************************\n        Please avoid running ``setup.py`` and ``easy_install``.\n        Instead, use pypa/build, pypa/installer or other\n        standards-based tools.\n\n        See https://github.com/pypa/setuptools/issues/917 for details.\n        ********************************************************************************\n\n!!\n  easy_install.initialize_options(self)\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:79: SetuptoolsDeprecationWarning: setup.py install is deprecated.\n!!\n\n        ********************************************************************************\n        Please avoid running ``setup.py`` directly.\n        Instead, use pypa/build, pypa/installer or other\n        standards-based tools.\n\n        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.\n        ********************************************************************************\n\n!!\n  self.initialize_options()\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.svg' under directory 'Orange/canvas'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching '*.svg' under directory 'distribute'\nwarning: no files found matching 'COPYING'\nResolved 102 packages in 3.20s\nPrepared 1 package in 51.00s\nUninstalled 1 package in 0.22ms\nInstalled 1 package in 1ms\n - orange3==3.38.0.dev0+a410361\n + orange3==3.38.0.dev0+a410361 (from file:///home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5)\n",
    "new_commit_res_code": 0,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.10.16, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5\nconfigfile: pyproject.toml\nplugins: anyio-4.8.0, typeguard-4.3.0\ncollected 24 items\n\nr2e_tests/test_1.py ........................                             [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestFixedWidth::test_discretization\nPASSED r2e_tests/test_1.py::TestFixedTimeWidth::test_discretization\nPASSED r2e_tests/test_1.py::TestBinningDiscretizer::test_binning_selection\nPASSED r2e_tests/test_1.py::TestBinningDiscretizer::test_call\nPASSED r2e_tests/test_1.py::TestBinningDiscretizer::test_no_data\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_add_unique\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_before_epoch\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_binning\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_limits\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_min_unique\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_multiple_identical\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_no_values\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_single_value\nPASSED r2e_tests/test_1.py::TestBinDefinition::test_labels\nPASSED r2e_tests/test_1.py::TestBinDefinition::test_thresholds\nPASSED r2e_tests/test_1.py::TestBinDefinition::test_width_label\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_equality\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_fmt_interval\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_empty\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_identical_points\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_no_ndigits\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_round_builtin_vs_numpy\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_with_ndigits\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_labels\n============================== 24 passed in 1.92s ==============================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.10.16, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a410361107724d878c254d350715351c058050a5\nconfigfile: pyproject.toml\nplugins: anyio-4.8.0, typeguard-4.3.0\ncollected 24 items\n\nr2e_tests/test_1.py .....................F..                             [100%]\n\n=================================== FAILURES ===================================\n______ TestDiscretizer.test_get_discretized_values_round_builtin_vs_numpy ______\n\nself = <r2e_tests.test_1.TestDiscretizer testMethod=test_get_discretized_values_round_builtin_vs_numpy>\n\n    def test_get_discretized_values_round_builtin_vs_numpy(self):\n        x = ContinuousVariable(\"x\", number_of_decimals=0)\n        points, values, _ \\\n            = Discretizer._get_discretized_values(x,\n                                                  np.array([2.3455,\n                                                            2.346]))\n>       np.testing.assert_equal(points,\n                                [2.345, 2.346])\nE       AssertionError: \nE       Items are not equal:\nE       item=0\nE       \nE        ACTUAL: 2.3455\nE        DESIRED: 2.345\n\nr2e_tests/test_1.py:1242: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestFixedWidth::test_discretization\nPASSED r2e_tests/test_1.py::TestFixedTimeWidth::test_discretization\nPASSED r2e_tests/test_1.py::TestBinningDiscretizer::test_binning_selection\nPASSED r2e_tests/test_1.py::TestBinningDiscretizer::test_call\nPASSED r2e_tests/test_1.py::TestBinningDiscretizer::test_no_data\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_add_unique\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_before_epoch\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_binning\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_limits\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_min_unique\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_multiple_identical\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_no_values\nPASSED r2e_tests/test_1.py::TestTimeBinning::test_single_value\nPASSED r2e_tests/test_1.py::TestBinDefinition::test_labels\nPASSED r2e_tests/test_1.py::TestBinDefinition::test_thresholds\nPASSED r2e_tests/test_1.py::TestBinDefinition::test_width_label\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_equality\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_fmt_interval\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_empty\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_identical_points\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_no_ndigits\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_with_ndigits\nPASSED r2e_tests/test_1.py::TestDiscretizer::test_get_labels\nFAILED r2e_tests/test_1.py::TestDiscretizer::test_get_discretized_values_round_builtin_vs_numpy\n========================= 1 failed, 23 passed in 1.53s =========================\n",
    "old_commit_res_stderr": ""
}
Orange/preprocess/discretize.py Orange/preprocess/tests/test_discretize.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Inconsistent Rounding in Discretizer Causes Incorrect Threshold Values

**Description:**
When discretizing continuous variables, the rounding of threshold points is expected to align with Python's string formatting to ensure consistency and uniqueness of labels. However, using NumPy's `round` function leads to discrepancies in the threshold values, causing inconsistencies in the labeling.

**Example Code:**
```python
x = ContinuousVariable("x", number_of_decimals=0)
points, values, _ = Discretizer._get_discretized_values(x, np.array([2.3455, 2.346]))
print(points)  # Output: [2.3455, 2.346]
print(values)  # Output: ['< 2.345', '2.345 - 2.346', '≥ 2.346']
```

In this example, the expected rounded points should be `[2.345, 2.346]` to match the string formatting in the labels. However, using NumPy's `round` results in the first point remaining as `2.3455`, causing the labels to be inconsistent and potentially duplicated.

**Expected Behavior:**
Threshold points should be rounded in a manner consistent with Python's built-in `round` function and string formatting. This ensures that the threshold values are unique and correctly formatted, preventing any duplication or labeling errors.

**Actual Behavior:**
Using NumPy's `round` leads to threshold values that do not align with the expected rounded values from Python's `round`. This results in incorrect threshold points, causing tests to fail and potentially leading to misleading discretization labels.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/preprocess/discretize.py
import calendar
import re
import time
from numbers import Number
from typing import NamedTuple, List, Union, Callable, Optional
import datetime
from itertools import count, chain

import numpy as np
import scipy.sparse as sp

from Orange.data import DiscreteVariable, Domain, TimeVariable, Table
from Orange.data.sql.table import SqlTable
from Orange.statistics import distribution, contingency, util as ut
from Orange.statistics.basic_stats import BasicStats
from Orange.util import Reprable, utc_from_timestamp
from .transformation import Transformation
from . import _discretize

__all__ = ["EqualFreq", "EqualWidth", "EntropyMDL", "DomainDiscretizer",
           "decimal_binnings", "time_binnings", "short_time_units",
           "BinDefinition"]


class Discretizer(Transformation):
    """Value transformer that returns an index of the bin for the given value.
    """
    def __init__(self, variable, points):
        super().__init__(variable)
        self.points = points

    @staticmethod
    def digitize(x, bins):
        if sp.issparse(x):
            if len(bins):
                x.data = np.digitize(x.data, bins)
            else:
                x = sp.csr_matrix(x.shape)
            return x
        else:
            return np.digitize(x, bins) if len(bins) else [0]*len(x)

    def transform(self, c):
        if sp.issparse(c):
            return self.digitize(c, self.points)
        elif c.size:
            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))
        else:
            return np.array([], dtype=int)

    @staticmethod
    def _fmt_interval(low, high, formatter, strip_zeros=True):
        assert low is None or high is None or low < high

        def strip0(s):
            if strip_zeros and re.match(r"^\d+\.\d+", s):
                return s.rstrip("0").rstrip(".")
            return s

        lows = (low is not None and not np.isinf(low)
                and strip0(formatter(low)))
        highs = (high is not None and not np.isinf(high)
                 and strip0(formatter(high)))
        assert lows or highs
        if lows == highs:
            raise ValueError(f"Formatter returned identical thresholds: {lows}")

        if not lows:
            return f"< {highs}"
        if not highs:
            return f"≥ {lows}"
        return f"{lows} - {highs}"

    @classmethod
    def _get_labels(cls, fmt, points, strip_zeros=True):
        return [
            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)
            for low, high in zip(
                chain([-np.inf], points),
                chain(points, [np.inf]))]

    @classmethod
    def _get_discretized_values(cls, var, points, ndigits=None):
        if len(points) == 0:
            values = ["single_value"]
            to_sql = SingleValueSql(values[0])
            return points, values, to_sql

        npoints = np.array(points, dtype=np.float64)
        if len(points) > 1:
            mindiff = np.min(npoints[1:] - npoints[:-1])
            if mindiff == 0:
                raise ValueError("Some interval thresholds are identical")
        else:
            mindiff = 1  # prevent warnings

        if ndigits is None or len(points) == 1:
            try:
                values = cls._get_labels(var.str_val, points)
            except ValueError:
                pass
            else:
                if len(values) == len(set(values)):
                    to_sql = BinSql(var, points)
                    return points, values, to_sql

        mindigits = max(ndigits or 0,
                        int(-np.log10(mindiff)))
        maxdigits = np.finfo(npoints.dtype).precision + 2
        for digits in range(mindigits, maxdigits + 1):
            npoints = np.round(points, digits)
            if len(npoints) == len(set(npoints)):
                def fmt_fixed(val):
                    # We break the loop, pylint: disable=cell-var-from-loop
                    return f"{val:.{digits}f}"

                points = list(npoints)
                break
        else:
            # pragma: no cover
            assert False

        values = cls._get_labels(
            fmt_fixed, points,
            strip_zeros=digits != ndigits)
        assert len(values) == len(set(values))
        to_sql = BinSql(var, points)
        return points, values, to_sql

    @classmethod
    def create_discretized_var(cls, var, points, ndigits=None):
        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)
        dvar = DiscreteVariable(name=var.name, values=values,
                                compute_value=cls(var, points),
                                sparse=var.sparse)
        dvar.source_variable = var
        dvar.to_sql = to_sql
        return dvar

    def __eq__(self, other):
        return super().__eq__(other) and self.points == other.points

    def __hash__(self):
        return hash((type(self), self.variable, tuple(self.points)))


class BinSql:
    def __init__(self, var, points):
        self.var = var
        self.points = points

    def __call__(self):
        return f'width_bucket({self.var.to_sql()}, ' \
               f'ARRAY{str(self.points)}::double precision[])'


class SingleValueSql:
    def __init__(self, value):
        self.value = value

    def __call__(self):
        return "'%s'" % self.value


class Discretization(Reprable):
    """Abstract base class for discretization classes."""
    def __call__(self, data, variable):
        """
        Compute discretization of the given variable on the given data.
        Return a new variable with the appropriate domain
        (:obj:`Orange.data.DiscreteVariable.values`) and transformer
        (:obj:`Orange.data.Variable.compute_value`).
        """
        raise NotImplementedError(
            "Subclasses of 'Discretization' need to implement "
            "the call operator")


class EqualFreq(Discretization):
    """Discretization into bins with approximately equal number of data
    instances.

    .. attribute:: n

        Number of bins (default: 4). The actual number may be lower if the
        variable has less than n distinct values.
    """
    def __init__(self, n=4):
        self.n = n

    # noinspection PyProtectedMember
    def __call__(self, data, attribute):
        if type(data) == SqlTable:
            att = attribute.to_sql()
            quantiles = [(i + 1) / self.n for i in range(self.n - 1)]
            query = data._sql_query(
                ['quantile(%s, ARRAY%s)' % (att, str(quantiles))],
                use_time_sample=1000)
            with data._execute_sql_query(query) as cur:
                points = sorted(set(cur.fetchone()[0]))
        else:
            d = distribution.get_distribution(data, attribute)
            points = _discretize.split_eq_freq(d, self.n)
            # np.unique handles cases in which differences are below precision
            points = list(np.unique(points))
        return Discretizer.create_discretized_var(
            data.domain[attribute], points)

class EqualWidth(Discretization):
    """Discretization into a fixed number of bins with equal widths.

    .. attribute:: n

        Number of bins (default: 4).
    """
    def __init__(self, n=4):
        self.n = n

    # noinspection PyProtectedMember
    def __call__(self, data: Table, attribute, fixed=None):
        if fixed:
            mn, mx = fixed[attribute.name]
            points = self._split_eq_width(mn, mx)
        else:
            if type(data) == SqlTable:
                stats = BasicStats(data, attribute)
                points = self._split_eq_width(stats.min, stats.max)
            else:
                values = data.get_column(attribute)
                if values.size:
                    mn, mx = ut.nanmin(values), ut.nanmax(values)
                    points = self._split_eq_width(mn, mx)
                else:
                    points = []
        return Discretizer.create_discretized_var(
            data.domain[attribute], points)

    def _split_eq_width(self, mn, mx):
        if np.isnan(mn) or np.isnan(mx) or mn == mx:
            return []
        dif = (mx - mn) / self.n
        return [mn + i * dif for i in range(1, self.n)]


class TooManyIntervals(ValueError):
    pass


class FixedWidth(Discretization):
    def __init__(self, width, digits=None):
        super().__init__()
        self.width = width
        self.digits = digits

    def __call__(self, data: Table, attribute):
        values = data.get_column(attribute)
        points = []
        if values.size:
            mn, mx = ut.nanmin(values), ut.nanmax(values)
            if not np.isnan(mn):
                minf = int(1 + np.floor(mn / self.width))
                maxf = int(1 + np.floor(mx / self.width))
                if maxf - minf - 1 >= 100:
                    raise TooManyIntervals
                points = [i * self.width for i in range(minf, maxf)]
        return Discretizer.create_discretized_var(
                    data.domain[attribute], points, ndigits=self.digits)


class FixedTimeWidth(Discretization):
    def __init__(self, width, unit):
        # unit: 0=year, 1=month, 2=day, 3=hour, 4=minute, 5=second
        # for week, use day with a width of 7
        super().__init__()
        self.width = width
        self.unit = unit

    def __call__(self, data: Table, attribute):
        fmt = ["%Y", "%y %b", "%y %b %d", "%y %b %d %H:%M", "%y %b %d %H:%M",
                "%H:%M:%S"][self.unit]
        values = data.get_column(attribute)
        times = []
        if values.size:
            mn, mx = ut.nanmin(values), ut.nanmax(values)
            if not np.isnan(mn):
                mn = utc_from_timestamp(mn).timetuple()
                mx = utc_from_timestamp(mx).timetuple()
                times = _time_range(mn, mx, self.unit, self.width, 0, 100)
                if times is None:
                    raise TooManyIntervals
        times = [time.struct_time(t + (0, 0, 0)) for t in times][1:-1]
        points = np.array([calendar.timegm(t) for t in times])
        values = [time.strftime(fmt, t) for t in times]
        values = _simplified_time_intervals(values)
        var = data.domain[attribute]
        return DiscreteVariable(name=var.name, values=values,
                                compute_value=Discretizer(var, points),
                                sparse=var.sparse)


def _simplified_time_intervals(labels):
    def no_common(a, b):
        for i, pa, pb in zip(count(), a, b):
            if pa != pb:
                if common + i == 2:
                    i -= 1
                return b[i:]
        # can't come here (unless a == b?!)
        return b  # pragma: no cover


    if not labels:
        return []
    common = 100
    labels = [label.split() for label in labels]
    for common, parts in enumerate(map(set, zip(*labels))):
        if len(parts) > 1:
            break
    if common == 2:  # If we keep days, we must also keep months
        common = 1
    labels = [label[common:] for label in labels]
    join = " ".join
    return [f"< {join(labels[0])}"] + [
        f"{join(low)} - {join(no_common(low, high))}"
        for low, high in zip(labels, labels[1:])
        ] + [f"≥ {join(labels[-1])}"]



class Binning(Discretization):
    """Discretization with nice thresholds

    This class creates different decimal or time binnings and picks the one
    in which the number of interval is closest to the desired number.
    The difference is measured as proportion; e.g. having 30 % less intervals
    is the same difference as having 30 % too many.

    .. attribute:: n

        Desired number of bins (default: 4).
    """
    def __init__(self, n=4):
        self.n = n

    def __call__(self, data: Table, attribute):
        attribute = data.domain[attribute]
        values = data.get_column(attribute)
        values = values.astype(float)
        if not values.size:
            return self._create_binned_var(None, attribute)

        var = data.domain[attribute]
        if isinstance(var, TimeVariable):
            binnings = time_binnings(values)
        else:
            binnings = decimal_binnings(values)
        return self._create_binned_var(binnings, attribute)

    def _create_binned_var(self, binnings, variable):
        if not binnings:
            return Discretizer.create_discretized_var(variable, [])

        # If self.n is 2, require two intervals (one threshold, excluding top
        # and bottom), else require at least three intervals
        # ... unless this is the only option, in which case we use it
        # Break ties in favour of more bins
        binning = min(
            (binning for binning in binnings
             if len(binning.thresholds) - 2 >= 1 + (self.n != 2)),
            key=lambda binning: (abs(self.n - (len(binning.short_labels) - 1)),
                                 -len(binning.short_labels)),
            default=binnings[-1])

        if len(binning.thresholds) == 2:
            return Discretizer.create_discretized_var(variable, [])

        blabels = binning.labels[1:-1]
        labels = [f"< {blabels[0]}"] + [
            f"{lab1} - {lab2}" for lab1, lab2 in zip(blabels, blabels[1:])
        ] + [f"≥ {blabels[-1]}"]

        discretizer = Discretizer(variable, list(binning.thresholds[1:-1]))
        dvar = DiscreteVariable(name=variable.name, values=labels,
                                compute_value=discretizer,
                                sparse=variable.sparse)
        dvar.source_variable = variable
        return dvar


class BinDefinition(NamedTuple):
    thresholds: np.ndarray  # thresholds, including the top
    labels: List[str]  # friendly-formatted thresholds
    short_labels: List[str]  # shorter labels (e.g. simplified dates)
    width: Union[float, None]  # widths, if uniform; otherwise None
    width_label: str  # friendly-formatted width (e.g. '50' or '2 weeks')


# NamedTupleMeta doesn't allow to define __new__ so we need a subclass
# Name of the class has to be the same to match the namedtuple name
# pylint: disable=function-redefined
class BinDefinition(BinDefinition):
    def __new__(cls, thresholds, labels="%g",
                short_labels=None, width=None, width_label=""):

        def get_labels(fmt, default=None):
            if fmt is None:
                return default
            if isinstance(fmt, str):
                return [fmt % x for x in thresholds]
            elif isinstance(fmt, Callable):
                return [fmt(x) for x in thresholds]
            else:
                return fmt

        labels = get_labels(labels)
        short_labels = get_labels(short_labels, labels)
        if not width_label and width is not None:
            width_label = f"{width:g}"
        return super().__new__(
            cls, thresholds, labels, short_labels, width, width_label)

    @property
    def start(self) -> float:
        return self.thresholds[0]

    @property
    def nbins(self) -> int:
        return len(self.thresholds) - 1


def decimal_binnings(
        data, *, min_width=0, min_bins=2, max_bins=50,
        min_unique=5, add_unique=0,
        factors=(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20),
        label_fmt="%g") -> List[BinDefinition]:
    """
    Find a set of nice splits of data into bins

    The function first computes the scaling factor that is, the power of 10
    that brings the interval of values within [0, 1]. For instances, if the
    numbers come from interaval 10004001 and 10007005, the width of the
    interval is 3004, so the scaling factor is 1000.

    The function next considers bin widths that are products of scaling and
    different factors from 20 to 0.01 that make sense in decimal scale
    (see default value for argument `factors`). For each width, it rounds the
    minimal value down to this width and the maximal value up, and it computes
    the number of bins of that width that fit between these two values.
    If the number of bins is between `min_bins` and `max_bins`, and the width
    is at least `min_width`, this is a valid interval.

    If the data has no more than `min_unique` unique values, the function will
    add a set of bins that put each value into its own bin.

    If the data has no more than `add_unique` values, that last bins will put
    each value into its own bin.

    Args:
        data (np.ndarray):
            vector of data points; values may repeat, and nans and infs are
            filtered out.
        min_width (float): minimal bin width
        min_bins (int): minimal number of bins
        max_bins (int):
            maximal number of bins; the number of bins will never exceed the
            number of unique values
        min_unique (int):
            if the number of unique values are less or equal to `min_unique`,
            the function returns a single binning that matches that values in
            the data
        add_unique (int):
            similar to `min_unique` except that such bins are added to the list;
            set to 0 to disable
        factors (list of float):
            The factors with which the scaling is multiplied. Default is
            `(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20)`,
            so if scaling is 1000, considered bin widths are 20000, 10000,
            5000, 2000, 1000, 500, 250, 200, 100, 50, 25, 20 and 10.
        label_fmt (str or Callable):
            A format string (default: "%g") used for threshold labels,
            or a function for formatting thresholds (e.g. var.str_val)

    Returns:
        bin_definition (list of BinDefinition):
            `BinDefinition` is a named tuple containing the beginning of the
            first bin (`start`), number of bins (`nbins`) and their widths
            (`width`). The last value can also be a `nd.array` with `nbins + 1`
            elements, which describes bins of unequal width and is used for
            binnings that match the unique values in the data (see `min_unique`
            and `add_unique`).
    """
    bins = []

    mn, mx, unique = _min_max_unique(data)
    if len(unique) <= max(min_unique, add_unique):
        bins.append(BinDefinition(_unique_thresholds(unique), label_fmt))
        if len(unique) <= min_unique:
            return bins

    diff = mx - mn
    f10 = 10 ** -np.floor(np.log10(diff))
    max_bins = min(max_bins, len(unique))
    for f in factors:
        width = f / f10
        if width < min_width:
            continue
        mn_ = np.floor(mn / width) * width
        mx_ = np.ceil(mx / width) * width
        nbins = np.round((mx_ - mn_) / width)
        if min_bins <= nbins <= max_bins \
                and (not bins or bins[-1].nbins != nbins):
            bins_ = mn_ + width * np.arange(nbins + 1)
            # to prevent values on the edge of the bin fall in the wrong bin
            # due to precision error on decimals that are not precise
            bins_ = np.around(bins_, decimals=np.finfo(bins_.dtype).precision)
            bin_def = BinDefinition(bins_, label_fmt, None, width)
            bins.append(bin_def)
    return bins


def time_binnings(data, *, min_bins=2, max_bins=50, min_unique=5, add_unique=0
                  ) -> List[BinDefinition]:
    """
    Find a set of nice splits of time variable data into bins

    The function considers bin widths of

    - 1, 5, 10, 15, 30 seconds.
    - 1, 5, 10, 15, 30 minutes,
    - 1, 2, 3, 6, 12 hours,
    - 1 day,
    - 1, 2 weeks,
    - 1, 2, 3, 6 months,
    - 1, 2, 5, 10, 25, 50, 100 years,

    and returns those that yield between `min_bins` and `max_bins` intervals.

    Args:
        data (np.ndarray):
            vector of data points; values may repeat, and nans and infs are
            filtered out.
        min_bins (int): minimal number of bins
        max_bins (int):
            maximal number of bins; the number of bins will never exceed the
            number of unique values

    Returns:
        bin_boundaries (list of BinDefinition): a list of possible binning.
            Each element of `bin_boundaries` is a tuple consisting of a label
            describing the bin size (e.g. `2 weeks`) and a list of thresholds.
            Thresholds are given as pairs
            (number_of_seconds_since_epoch, label).
    """
    mn, mx, unique = _min_max_unique(data)
    mn = utc_from_timestamp(mn).timetuple()
    mx = utc_from_timestamp(mx).timetuple()
    bins = []
    if len(unique) <= max(min_unique, add_unique):
        bins.append(_unique_time_bins(unique))
    if len(unique) > min_unique:
        bins += _time_binnings(mn, mx, min_bins + 1, max_bins + 1)
    return bins


def _time_binnings(mn, mx, min_pts, max_pts):
    bins = []
    for place, step, fmt, unit in (
            [(5, x, "%H:%M:%S", "second") for x in (1, 5, 10, 15, 30)] +
            [(4, x, "%b %d %H:%M", "minute") for x in (1, 5, 10, 15, 30)] +
            [(3, x, "%y %b %d %H:%M", "hour") for x in (1, 2, 3, 6, 12)] +
            [(2, 1, "%y %b %d", "day")] +
            [(2, x, "%y %b %d", "week") for x in (7, 14)] +
            [(1, x, "%y %b", "month") for x in (1, 2, 3, 6)] +
            [(0, x, "%Y", "year") for x in (1, 2, 5, 10, 25, 50, 100)]):
        times = _time_range(mn, mx, place, step, min_pts, max_pts)
        if not times:
            continue
        times = [time.struct_time(t + (0, 0, 0)) for t in times]
        thresholds = np.array([calendar.timegm(t) for t in times])
        labels = [time.strftime(fmt, t) for t in times]
        short_labels = _simplified_labels(labels)
        if place == 2 and step >= 7:
            unit_label = f"{step // 7} week{'s' * (step > 7)}"
        else:
            unit_label = f"{step} {unit}{'s' * (step > 1)}"
        new_bins = BinDefinition(
            thresholds, labels, short_labels, None, unit_label)
        if not bins or new_bins.nbins != bins[-1].nbins:
            bins.append(new_bins)
    return bins


# datetime + deltatime is not very useful here because deltatime is
# given a number of days, not years or months, so it doesn't allow
# for specifying a step of 1 month
def _time_range(start, end, place, step, min_pts, max_pts,
                _zeros=(0, 1, 1, 0, 0, 0)):
    if place == 2 and step % 7 == 0:
        startd = datetime.date(*start[:3])
        startd -= datetime.timedelta(days=-startd.weekday())
        start = [startd.year, startd.month, startd.day, 0, 0, 0]
    else:
        start = list(
            start[:place]
            + ((start[place] - _zeros[place]) // step * step + _zeros[place], )
            + _zeros[place + 1:])
    end = list(end[:place + 1] + _zeros[place + 1:])
    s = [tuple(start)]
    for _ in range(max_pts - 1):
        start[place] += step
        if place >= 3:  # hours, minutes, seconds
            for pos, maxval in enumerate((60, 60, 24), start=1):
                if start[-pos] >= maxval:
                    start[-pos - 1] += 1
                    start[-pos] %= maxval
        if place >= 2:
            md = _month_days(*start[:2])
            if start[2] > md:
                start[1] += 1
                start[2] %= md
        if start[1] > 12:
            start[0] += 1
            start[1] %= 12
        s.append(tuple(start))
        if start > end:
            return s if len(s) >= min_pts else None
    return None


def _month_days(year, month,
                _md=(None, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)):
    return _md[month] + (
        month == 2 and (year % 400 == 0 or year % 4 == 0 and year % 100 != 0))


def _simplified_labels(labels):
    labels = labels[:]
    to_remove = "42"
    while True:
        firsts = {f for f, *_ in (lab.split() for lab in labels)}
        if len(firsts) != 1:  # can be 0 if there are no labels
            break
        to_remove = firsts.pop()
        flen = len(to_remove)
        if any(len(lab) == flen for lab in labels):
            break
        labels = [lab[flen+1:] for lab in labels]
    for i in range(len(labels) - 1, 0, -1):
        for k, c, d in zip(count(), labels[i].split(), labels[i - 1].split()):
            if c != d:
                labels[i] = " ".join(labels[i].split()[k:])
                break
    # If the last thing removed were month names and the labels continues with
    # hours, keep month name in the first label; "08 12:29" looks awkward.
    if not to_remove[0].isdigit() and ":" in labels[0]:
        labels[0] = f"{to_remove} {labels[0]}"
    return labels


def _unique_time_bins(unique):
    times = [utc_from_timestamp(x).timetuple() for x in unique]
    fmt = f'%y %b %d'
    fmt += " %H:%M" * (len({t[2:] for t in times}) > 1)
    fmt += ":%S" * bool(np.all(unique % 60 == 0))
    labels = [time.strftime(fmt, x) for x in times]
    short_labels = _simplified_labels(labels)
    return BinDefinition(_unique_thresholds(unique), labels, short_labels)


def _unique_thresholds(unique):
    if len(unique) >= 2:
        # make the last bin the same width as the one before
        last_boundary = 2 * unique[-1] - unique[-2]
    else:
        last_boundary = unique[0] + 1
    return np.hstack((unique, [last_boundary]))


def _min_max_unique(data):
    unique = np.unique(data)
    unique = unique[np.isfinite(unique)]
    if not unique.size:
        raise ValueError("no valid (non-nan) data")
    return unique[0], unique[-1], unique


short_time_units = dict(seconds="sec", minutes="min", hours="hrs",
                        weeks="wks", months="mon", years="yrs",
                        second="sec", minute="min", month="mon")


# noinspection PyPep8Naming
class EntropyMDL(Discretization):
    """
    Discretization into bins inferred by recursively splitting the values to
    minimize the class-entropy. The procedure stops when further splits would
    decrease the entropy for less than the corresponding increase of minimal
    description length (MDL). [FayyadIrani93].

    If there are no suitable cut-off points, the procedure returns a single bin,
    which means that the new feature is constant and can be removed.

    .. attribute:: force

        Induce at least one cut-off point, even when its information
        gain is lower than MDL (default: False).

    """
    def __init__(self, force=False):
        self.force = force

    def __call__(self, data, attribute):
        cont = contingency.get_contingency(data, attribute)
        values, I = cont.values, cont.counts.T
        cut_ind = np.array(self._entropy_discretize_sorted(I, self.force))
        if len(cut_ind) > 0:
            # "the midpoint between each successive pair of examples" (FI p.1)
            points = (values[cut_ind] + values[cut_ind - 1]) / 2.
        else:
            points = []
        return Discretizer.create_discretized_var(
            data.domain[attribute], points)

    @classmethod
    def _normalize(cls,
                   X: Union[List[List[Number]], np.ndarray],
                   axis: Optional[int] = None,
                   out: Optional[np.ndarray] = None) -> np.ndarray:
        """
        Normalize `X` array so it sums to 1.0 over the `axis`.

        Parameters
        ----------
        X : array
            Array to normalize.
        axis : optional int
            Axis over which the resulting array sums to 1.
        out : optional array
            Output array of the same shape as X.
        """
        X = np.asarray(X, dtype=float)
        scale = np.sum(X, axis=axis, keepdims=True)
        scale[scale == 0] = 1
        if out is None:
            return X / scale
        else:
            if out is not X:
                assert out.shape == X.shape
                out[:] = X
            out /= scale
            return out

    @classmethod
    def _entropy_normalized(cls, D, axis=None):
        """
        Compute the entropy of distribution array `D`.

        `D` must be a distribution (i.e. sum to 1.0 over `axis`)

        Parameters
        ----------
        D : array
            Distribution.
        axis : optional int
            Axis of `D` along which to compute the entropy.

        """
        # req: (np.sum(D, axis=axis) >= 0).all()
        # req: (np.sum(D, axis=axis) <= 1).all()
        # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9)

        D = np.asarray(D)
        if np.sum(D) == 0:
            return 0
        Dc = np.clip(D, np.finfo(D.dtype).eps, 1.0)
        return - np.sum(D * np.log2(Dc), axis=axis)

    @classmethod
    def _entropy(cls, D, axis=None):
        """
        Compute the entropy of distribution `D`.

        Parameters
        ----------
        D : array
            Distribution.
        axis : optional int
            Axis of `D` along which to compute the entropy.

        """
        D = cls._normalize(D, axis=axis)
        return cls._entropy_normalized(D, axis=axis)

    @classmethod
    def _entropy1(cls, D):
        """
        Compute the entropy of distributions in `D`
        (one per each row).
        """
        D = cls._normalize(D)
        return _discretize.entropy_normalized1(D)

    @classmethod
    def _entropy2(cls, D):
        """
        Compute the entropy of distributions in `D`
        (one per each row).
        """
        D = cls._normalize(D, axis=1)
        return _discretize.entropy_normalized2(D)

    @classmethod
    def _entropy_cuts_sorted(cls, CS):
        """
        Return the class information entropy induced by partitioning
        the `CS` distribution at all N-1 candidate cut points.

        Parameters
        ----------
        CS : (N, K) array of class distributions.
        """
        CS = np.asarray(CS)
        # |--|-------|--------|
        #  S1    ^       S2
        # S1 contains all points which are <= to cut point
        # Cumulative distributions for S1 and S2 (left right set)
        # i.e. a cut at index i separates the CS into S1Dist[i] and S2Dist[i]
        S1Dist = np.cumsum(CS, axis=0)[:-1]
        S2Dist = np.cumsum(CS[::-1], axis=0)[-2::-1]

        # Entropy of S1[i] and S2[i] sets
        ES1 = cls._entropy2(S1Dist)
        ES2 = cls._entropy2(S2Dist)

        # Number of cases in S1[i] and S2[i] sets
        S1_count = np.sum(S1Dist, axis=1)
        S2_count = np.sum(S2Dist, axis=1)

        # Number of all cases
        S_count = np.sum(CS)

        ES1w = ES1 * S1_count / S_count
        ES2w = ES2 * S2_count / S_count

        # E(A, T; S) Class information entropy of the partition S
        E = ES1w + ES2w

        return E, ES1, ES2

    @classmethod
    def _entropy_discretize_sorted(cls, C, force=False):
        """
        Entropy discretization on a sorted C.

        :param C: (N, K) array of class distributions.

        """
        E, ES1, ES2 = cls._entropy_cuts_sorted(C)
        # TODO: Also get the left right distribution counts from
        # entropy_cuts_sorted,

        # Note the + 1
        if len(E) == 0:
            return []
        cut_index = np.argmin(E) + 1

        # Distribution of classed in S1, S2 and S
        S1_c = np.sum(C[:cut_index], axis=0)
        S2_c = np.sum(C[cut_index:], axis=0)
        S_c = S1_c + S2_c

        ES = cls._entropy1(np.sum(C, axis=0))
        ES1, ES2 = ES1[cut_index - 1], ES2[cut_index - 1]

        # Information gain of the best split
        Gain = ES - E[cut_index - 1]
        # Number of different classes in S, S1 and S2
        k = float(np.sum(S_c > 0))
        k1 = float(np.sum(S1_c > 0))
        k2 = float(np.sum(S2_c > 0))

        assert k > 0
        delta = np.log2(3 ** k - 2) - (k * ES - k1 * ES1 - k2 * ES2)
        N = float(np.sum(S_c))

        if N > 1 and Gain > np.log2(N - 1) / N + delta / N:
            # Accept the cut point and recursively split the subsets.
            left, right = [], []
            if k1 > 1 and cut_index > 1:
                left = cls._entropy_discretize_sorted(C[:cut_index, :])
            if k2 > 1 and cut_index < len(C) - 1:
                right = cls._entropy_discretize_sorted(C[cut_index:, :])
            return left + [cut_index] + [i + cut_index for i in right]
        elif force:
            return [cut_index]
        else:
            return []


class DomainDiscretizer(Reprable):
    """Discretizes all continuous features in the data.

    .. attribute:: method

        Feature discretization method (instance of
        :obj:`Orange.preprocess.Discretization`). If `None` (default),
        :class:`Orange.preprocess.EqualFreq` with 4 intervals is
        used.

    .. attribute:: clean

        If `True`, features discretized into a single interval constant are
        removed. This is useful for discretization methods that infer the
        number of intervals from the data, such as
        :class:`Orange.preprocess.EntropyMDL` (default: `True`).

    .. attribute:: discretize_class

        Determines whether a target is also discretized if it is continuous.
        (default: `False`)
    """
    def __init__(self, discretize_class=False, method=None, clean=True,
                 fixed=None):
        self.discretize_class = discretize_class
        self.method = method
        self.clean = clean
        self.fixed = fixed

    def __call__(self, data, fixed=None):
        """
        Compute and return discretized domain.

        :param data: Data to discretize.
        """

        def transform_list(s, fixed=None):
            new_vars = []
            for var in s:
                if var.is_continuous:
                    if fixed and var.name in fixed.keys():
                        nv = method(data, var, fixed)
                    else:
                        nv = method(data, var)
                    if not self.clean or len(nv.values) > 1:
                        new_vars.append(nv)
                else:
                    new_vars.append(var)
            return new_vars
        if self.method is None:
            method = EqualFreq(n=4)
        else:
            method = self.method
        domain = data.domain
        new_attrs = transform_list(domain.attributes, fixed or self.fixed)
        if self.discretize_class:
            new_classes = transform_list(domain.class_vars)
        else:
            new_classes = domain.class_vars
        return Domain(new_attrs, new_classes)

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]
**Title:** Inconsistent Rounding in Discretizer Causes Incorrect Threshold Values

**Description:**
When discretizing continuous variables, the rounding of threshold points is expected to align with Python's string formatting to ensure consistency and uniqueness of labels. However, using NumPy's `round` function leads to discrepancies in the threshold values, causing inconsistencies in the labeling.

**Example Code:**
```python
x = ContinuousVariable("x", number_of_decimals=0)
points, values, _ = Discretizer._get_discretized_values(x, np.array([2.3455, 2.346]))
print(points)  # Output: [2.3455, 2.346]
print(values)  # Output: ['< 2.345', '2.345 - 2.346', '≥ 2.346']
```

In this example, the expected rounded points should be `[2.345, 2.346]` to match the string formatting in the labels. However, using NumPy's `round` results in the first point remaining as `2.3455`, causing the labels to be inconsistent and potentially duplicated.

**Expected Behavior:**
Threshold points should be rounded in a manner consistent with Python's built-in `round` function and string formatting. This ensures that the threshold values are unique and correctly formatted, preventing any duplication or labeling errors.

**Actual Behavior:**
Using NumPy's `round` leads to threshold values that do not align with the expected rounded values from Python's `round`. This results in incorrect threshold points, causing tests to fail and potentially leading to misleading discretization labels.

[/ISSUE]
{
    "TestFixedWidth.test_discretization": "PASSED",
    "TestFixedTimeWidth.test_discretization": "PASSED",
    "TestBinningDiscretizer.test_binning_selection": "PASSED",
    "TestBinningDiscretizer.test_call": "PASSED",
    "TestBinningDiscretizer.test_no_data": "PASSED",
    "TestTimeBinning.test_add_unique": "PASSED",
    "TestTimeBinning.test_before_epoch": "PASSED",
    "TestTimeBinning.test_binning": "PASSED",
    "TestTimeBinning.test_limits": "PASSED",
    "TestTimeBinning.test_min_unique": "PASSED",
    "TestTimeBinning.test_multiple_identical": "PASSED",
    "TestTimeBinning.test_no_values": "PASSED",
    "TestTimeBinning.test_single_value": "PASSED",
    "TestBinDefinition.test_labels": "PASSED",
    "TestBinDefinition.test_thresholds": "PASSED",
    "TestBinDefinition.test_width_label": "PASSED",
    "TestDiscretizer.test_equality": "PASSED",
    "TestDiscretizer.test_fmt_interval": "PASSED",
    "TestDiscretizer.test_get_discretized_values_empty": "PASSED",
    "TestDiscretizer.test_get_discretized_values_identical_points": "PASSED",
    "TestDiscretizer.test_get_discretized_values_no_ndigits": "PASSED",
    "TestDiscretizer.test_get_discretized_values_round_builtin_vs_numpy": "PASSED",
    "TestDiscretizer.test_get_discretized_values_with_ndigits": "PASSED",
    "TestDiscretizer.test_get_labels": "PASSED"
}
diff --git a/Orange/preprocess/discretize.py b/Orange/preprocess/discretize.py
index d9642efa5..ab5062c53 100644
--- a/Orange/preprocess/discretize.py
+++ b/Orange/preprocess/discretize.py
@@ -97,7 +97,7 @@ class Discretizer(Transformation):
         if ndigits is None or len(points) == 1:
             try:
                 values = cls._get_labels(var.str_val, points)
-            except ValueError:
+            except ValueError:  # points would create identical formatted thresholds
                 pass
             else:
                 if len(values) == len(set(values)):
@@ -108,7 +108,9 @@ class Discretizer(Transformation):
                         int(-np.log10(mindiff)))
         maxdigits = np.finfo(npoints.dtype).precision + 2
         for digits in range(mindigits, maxdigits + 1):
-            npoints = np.round(points, digits)
+            # ensure that builtin round is used for compatibility with float formatting
+            # de-numpyize points p (otherwise np.floats use numpy's round)
+            npoints = [round(float(p), digits) for p in points]
             if len(npoints) == len(set(npoints)):
                 def fmt_fixed(val):
                     # We break the loop, pylint: disable=cell-var-from-loop

{"Orange/preprocess/discretize.py": "import calendar\nimport re\nimport time\nfrom numbers import Number\nfrom typing import NamedTuple, List, Union, Callable, Optional\nimport datetime\nfrom itertools import count, chain\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange.data import DiscreteVariable, Domain, TimeVariable, Table\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics import distribution, contingency, util as ut\nfrom Orange.statistics.basic_stats import BasicStats\nfrom Orange.util import Reprable, utc_from_timestamp\nfrom .transformation import Transformation\nfrom . import _discretize\n\n__all__ = [\"EqualFreq\", \"EqualWidth\", \"EntropyMDL\", \"DomainDiscretizer\",\n           \"decimal_binnings\", \"time_binnings\", \"short_time_units\",\n           \"BinDefinition\"]\n\n\nclass Discretizer(Transformation):\n    \"\"\"Value transformer that returns an index of the bin for the given value.\n    \"\"\"\n    def __init__(self, variable, points):\n        super().__init__(variable)\n        self.points = points\n\n    @staticmethod\n    def digitize(x, bins):\n        if sp.issparse(x):\n            if len(bins):\n                x.data = np.digitize(x.data, bins)\n            else:\n                x = sp.csr_matrix(x.shape)\n            return x\n        else:\n            return np.digitize(x, bins) if len(bins) else [0]*len(x)\n\n    def transform(self, c):\n        if sp.issparse(c):\n            return self.digitize(c, self.points)\n        elif c.size:\n            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))\n        else:\n            return np.array([], dtype=int)\n\n    @staticmethod\n    def _fmt_interval(low, high, formatter, strip_zeros=True):\n        assert low is None or high is None or low < high\n\n        def strip0(s):\n            if strip_zeros and re.match(r\"^\\d+\\.\\d+\", s):\n                return s.rstrip(\"0\").rstrip(\".\")\n            return s\n\n        lows = (low is not None and not np.isinf(low)\n                and strip0(formatter(low)))\n        highs = (high is not None and not np.isinf(high)\n                 and strip0(formatter(high)))\n        assert lows or highs\n        if lows == highs:\n            raise ValueError(f\"Formatter returned identical thresholds: {lows}\")\n\n        if not lows:\n            return f\"< {highs}\"\n        if not highs:\n            return f\"\u2265 {lows}\"\n        return f\"{lows} - {highs}\"\n\n    @classmethod\n    def _get_labels(cls, fmt, points, strip_zeros=True):\n        return [\n            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)\n            for low, high in zip(\n                chain([-np.inf], points),\n                chain(points, [np.inf]))]\n\n    @classmethod\n    def _get_discretized_values(cls, var, points, ndigits=None):\n        if len(points) == 0:\n            values = [\"single_value\"]\n            to_sql = SingleValueSql(values[0])\n            return points, values, to_sql\n\n        npoints = np.array(points, dtype=np.float64)\n        if len(points) > 1:\n            mindiff = np.min(npoints[1:] - npoints[:-1])\n            if mindiff == 0:\n                raise ValueError(\"Some interval thresholds are identical\")\n        else:\n            mindiff = 1  # prevent warnings\n\n        if ndigits is None or len(points) == 1:\n            try:\n                values = cls._get_labels(var.str_val, points)\n            except ValueError:\n                pass\n            else:\n                if len(values) == len(set(values)):\n                    to_sql = BinSql(var, points)\n                    return points, values, to_sql\n\n        mindigits = max(ndigits or 0,\n                        int(-np.log10(mindiff)))\n        maxdigits = np.finfo(npoints.dtype).precision + 2\n        for digits in range(mindigits, maxdigits + 1):\n            npoints = np.round(points, digits)\n            if len(npoints) == len(set(npoints)):\n                def fmt_fixed(val):\n                    # We break the loop, pylint: disable=cell-var-from-loop\n                    return f\"{val:.{digits}f}\"\n\n                points = list(npoints)\n                break\n        else:\n            # pragma: no cover\n            assert False\n\n        values = cls._get_labels(\n            fmt_fixed, points,\n            strip_zeros=digits != ndigits)\n        assert len(values) == len(set(values))\n        to_sql = BinSql(var, points)\n        return points, values, to_sql\n\n    @classmethod\n    def create_discretized_var(cls, var, points, ndigits=None):\n        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)\n        dvar = DiscreteVariable(name=var.name, values=values,\n                                compute_value=cls(var, points),\n                                sparse=var.sparse)\n        dvar.source_variable = var\n        dvar.to_sql = to_sql\n        return dvar\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.points == other.points\n\n    def __hash__(self):\n        return hash((type(self), self.variable, tuple(self.points)))\n\n\nclass BinSql:\n    def __init__(self, var, points):\n        self.var = var\n        self.points = points\n\n    def __call__(self):\n        return f'width_bucket({self.var.to_sql()}, ' \\\n               f'ARRAY{str(self.points)}::double precision[])'\n\n\nclass SingleValueSql:\n    def __init__(self, value):\n        self.value = value\n\n    def __call__(self):\n        return \"'%s'\" % self.value\n\n\nclass Discretization(Reprable):\n    \"\"\"Abstract base class for discretization classes.\"\"\"\n    def __call__(self, data, variable):\n        \"\"\"\n        Compute discretization of the given variable on the given data.\n        Return a new variable with the appropriate domain\n        (:obj:`Orange.data.DiscreteVariable.values`) and transformer\n        (:obj:`Orange.data.Variable.compute_value`).\n        \"\"\"\n        raise NotImplementedError(\n            \"Subclasses of 'Discretization' need to implement \"\n            \"the call operator\")\n\n\nclass EqualFreq(Discretization):\n    \"\"\"Discretization into bins with approximately equal number of data\n    instances.\n\n    .. attribute:: n\n\n        Number of bins (default: 4). The actual number may be lower if the\n        variable has less than n distinct values.\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    # noinspection PyProtectedMember\n    def __call__(self, data, attribute):\n        if type(data) == SqlTable:\n            att = attribute.to_sql()\n            quantiles = [(i + 1) / self.n for i in range(self.n - 1)]\n            query = data._sql_query(\n                ['quantile(%s, ARRAY%s)' % (att, str(quantiles))],\n                use_time_sample=1000)\n            with data._execute_sql_query(query) as cur:\n                points = sorted(set(cur.fetchone()[0]))\n        else:\n            d = distribution.get_distribution(data, attribute)\n            points = _discretize.split_eq_freq(d, self.n)\n            # np.unique handles cases in which differences are below precision\n            points = list(np.unique(points))\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\nclass EqualWidth(Discretization):\n    \"\"\"Discretization into a fixed number of bins with equal widths.\n\n    .. attribute:: n\n\n        Number of bins (default: 4).\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    # noinspection PyProtectedMember\n    def __call__(self, data: Table, attribute, fixed=None):\n        if fixed:\n            mn, mx = fixed[attribute.name]\n            points = self._split_eq_width(mn, mx)\n        else:\n            if type(data) == SqlTable:\n                stats = BasicStats(data, attribute)\n                points = self._split_eq_width(stats.min, stats.max)\n            else:\n                values = data.get_column(attribute)\n                if values.size:\n                    mn, mx = ut.nanmin(values), ut.nanmax(values)\n                    points = self._split_eq_width(mn, mx)\n                else:\n                    points = []\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\n    def _split_eq_width(self, mn, mx):\n        if np.isnan(mn) or np.isnan(mx) or mn == mx:\n            return []\n        dif = (mx - mn) / self.n\n        return [mn + i * dif for i in range(1, self.n)]\n\n\nclass TooManyIntervals(ValueError):\n    pass\n\n\nclass FixedWidth(Discretization):\n    def __init__(self, width, digits=None):\n        super().__init__()\n        self.width = width\n        self.digits = digits\n\n    def __call__(self, data: Table, attribute):\n        values = data.get_column(attribute)\n        points = []\n        if values.size:\n            mn, mx = ut.nanmin(values), ut.nanmax(values)\n            if not np.isnan(mn):\n                minf = int(1 + np.floor(mn / self.width))\n                maxf = int(1 + np.floor(mx / self.width))\n                if maxf - minf - 1 >= 100:\n                    raise TooManyIntervals\n                points = [i * self.width for i in range(minf, maxf)]\n        return Discretizer.create_discretized_var(\n                    data.domain[attribute], points, ndigits=self.digits)\n\n\nclass FixedTimeWidth(Discretization):\n    def __init__(self, width, unit):\n        # unit: 0=year, 1=month, 2=day, 3=hour, 4=minute, 5=second\n        # for week, use day with a width of 7\n        super().__init__()\n        self.width = width\n        self.unit = unit\n\n    def __call__(self, data: Table, attribute):\n        fmt = [\"%Y\", \"%y %b\", \"%y %b %d\", \"%y %b %d %H:%M\", \"%y %b %d %H:%M\",\n                \"%H:%M:%S\"][self.unit]\n        values = data.get_column(attribute)\n        times = []\n        if values.size:\n            mn, mx = ut.nanmin(values), ut.nanmax(values)\n            if not np.isnan(mn):\n                mn = utc_from_timestamp(mn).timetuple()\n                mx = utc_from_timestamp(mx).timetuple()\n                times = _time_range(mn, mx, self.unit, self.width, 0, 100)\n                if times is None:\n                    raise TooManyIntervals\n        times = [time.struct_time(t + (0, 0, 0)) for t in times][1:-1]\n        points = np.array([calendar.timegm(t) for t in times])\n        values = [time.strftime(fmt, t) for t in times]\n        values = _simplified_time_intervals(values)\n        var = data.domain[attribute]\n        return DiscreteVariable(name=var.name, values=values,\n                                compute_value=Discretizer(var, points),\n                                sparse=var.sparse)\n\n\ndef _simplified_time_intervals(labels):\n    def no_common(a, b):\n        for i, pa, pb in zip(count(), a, b):\n            if pa != pb:\n                if common + i == 2:\n                    i -= 1\n                return b[i:]\n        # can't come here (unless a == b?!)\n        return b  # pragma: no cover\n\n\n    if not labels:\n        return []\n    common = 100\n    labels = [label.split() for label in labels]\n    for common, parts in enumerate(map(set, zip(*labels))):\n        if len(parts) > 1:\n            break\n    if common == 2:  # If we keep days, we must also keep months\n        common = 1\n    labels = [label[common:] for label in labels]\n    join = \" \".join\n    return [f\"< {join(labels[0])}\"] + [\n        f\"{join(low)} - {join(no_common(low, high))}\"\n        for low, high in zip(labels, labels[1:])\n        ] + [f\"\u2265 {join(labels[-1])}\"]\n\n\n\nclass Binning(Discretization):\n    \"\"\"Discretization with nice thresholds\n\n    This class creates different decimal or time binnings and picks the one\n    in which the number of interval is closest to the desired number.\n    The difference is measured as proportion; e.g. having 30 % less intervals\n    is the same difference as having 30 % too many.\n\n    .. attribute:: n\n\n        Desired number of bins (default: 4).\n    \"\"\"\n    def __init__(self, n=4):\n        self.n = n\n\n    def __call__(self, data: Table, attribute):\n        attribute = data.domain[attribute]\n        values = data.get_column(attribute)\n        values = values.astype(float)\n        if not values.size:\n            return self._create_binned_var(None, attribute)\n\n        var = data.domain[attribute]\n        if isinstance(var, TimeVariable):\n            binnings = time_binnings(values)\n        else:\n            binnings = decimal_binnings(values)\n        return self._create_binned_var(binnings, attribute)\n\n    def _create_binned_var(self, binnings, variable):\n        if not binnings:\n            return Discretizer.create_discretized_var(variable, [])\n\n        # If self.n is 2, require two intervals (one threshold, excluding top\n        # and bottom), else require at least three intervals\n        # ... unless this is the only option, in which case we use it\n        # Break ties in favour of more bins\n        binning = min(\n            (binning for binning in binnings\n             if len(binning.thresholds) - 2 >= 1 + (self.n != 2)),\n            key=lambda binning: (abs(self.n - (len(binning.short_labels) - 1)),\n                                 -len(binning.short_labels)),\n            default=binnings[-1])\n\n        if len(binning.thresholds) == 2:\n            return Discretizer.create_discretized_var(variable, [])\n\n        blabels = binning.labels[1:-1]\n        labels = [f\"< {blabels[0]}\"] + [\n            f\"{lab1} - {lab2}\" for lab1, lab2 in zip(blabels, blabels[1:])\n        ] + [f\"\u2265 {blabels[-1]}\"]\n\n        discretizer = Discretizer(variable, list(binning.thresholds[1:-1]))\n        dvar = DiscreteVariable(name=variable.name, values=labels,\n                                compute_value=discretizer,\n                                sparse=variable.sparse)\n        dvar.source_variable = variable\n        return dvar\n\n\nclass BinDefinition(NamedTuple):\n    thresholds: np.ndarray  # thresholds, including the top\n    labels: List[str]  # friendly-formatted thresholds\n    short_labels: List[str]  # shorter labels (e.g. simplified dates)\n    width: Union[float, None]  # widths, if uniform; otherwise None\n    width_label: str  # friendly-formatted width (e.g. '50' or '2 weeks')\n\n\n# NamedTupleMeta doesn't allow to define __new__ so we need a subclass\n# Name of the class has to be the same to match the namedtuple name\n# pylint: disable=function-redefined\nclass BinDefinition(BinDefinition):\n    def __new__(cls, thresholds, labels=\"%g\",\n                short_labels=None, width=None, width_label=\"\"):\n\n        def get_labels(fmt, default=None):\n            if fmt is None:\n                return default\n            if isinstance(fmt, str):\n                return [fmt % x for x in thresholds]\n            elif isinstance(fmt, Callable):\n                return [fmt(x) for x in thresholds]\n            else:\n                return fmt\n\n        labels = get_labels(labels)\n        short_labels = get_labels(short_labels, labels)\n        if not width_label and width is not None:\n            width_label = f\"{width:g}\"\n        return super().__new__(\n            cls, thresholds, labels, short_labels, width, width_label)\n\n    @property\n    def start(self) -> float:\n        return self.thresholds[0]\n\n    @property\n    def nbins(self) -> int:\n        return len(self.thresholds) - 1\n\n\ndef decimal_binnings(\n        data, *, min_width=0, min_bins=2, max_bins=50,\n        min_unique=5, add_unique=0,\n        factors=(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20),\n        label_fmt=\"%g\") -> List[BinDefinition]:\n    \"\"\"\n    Find a set of nice splits of data into bins\n\n    The function first computes the scaling factor that is, the power of 10\n    that brings the interval of values within [0, 1]. For instances, if the\n    numbers come from interaval 10004001 and 10007005, the width of the\n    interval is 3004, so the scaling factor is 1000.\n\n    The function next considers bin widths that are products of scaling and\n    different factors from 20 to 0.01 that make sense in decimal scale\n    (see default value for argument `factors`). For each width, it rounds the\n    minimal value down to this width and the maximal value up, and it computes\n    the number of bins of that width that fit between these two values.\n    If the number of bins is between `min_bins` and `max_bins`, and the width\n    is at least `min_width`, this is a valid interval.\n\n    If the data has no more than `min_unique` unique values, the function will\n    add a set of bins that put each value into its own bin.\n\n    If the data has no more than `add_unique` values, that last bins will put\n    each value into its own bin.\n\n    Args:\n        data (np.ndarray):\n            vector of data points; values may repeat, and nans and infs are\n            filtered out.\n        min_width (float): minimal bin width\n        min_bins (int): minimal number of bins\n        max_bins (int):\n            maximal number of bins; the number of bins will never exceed the\n            number of unique values\n        min_unique (int):\n            if the number of unique values are less or equal to `min_unique`,\n            the function returns a single binning that matches that values in\n            the data\n        add_unique (int):\n            similar to `min_unique` except that such bins are added to the list;\n            set to 0 to disable\n        factors (list of float):\n            The factors with which the scaling is multiplied. Default is\n            `(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20)`,\n            so if scaling is 1000, considered bin widths are 20000, 10000,\n            5000, 2000, 1000, 500, 250, 200, 100, 50, 25, 20 and 10.\n        label_fmt (str or Callable):\n            A format string (default: \"%g\") used for threshold labels,\n            or a function for formatting thresholds (e.g. var.str_val)\n\n    Returns:\n        bin_definition (list of BinDefinition):\n            `BinDefinition` is a named tuple containing the beginning of the\n            first bin (`start`), number of bins (`nbins`) and their widths\n            (`width`). The last value can also be a `nd.array` with `nbins + 1`\n            elements, which describes bins of unequal width and is used for\n            binnings that match the unique values in the data (see `min_unique`\n            and `add_unique`).\n    \"\"\"\n    bins = []\n\n    mn, mx, unique = _min_max_unique(data)\n    if len(unique) <= max(min_unique, add_unique):\n        bins.append(BinDefinition(_unique_thresholds(unique), label_fmt))\n        if len(unique) <= min_unique:\n            return bins\n\n    diff = mx - mn\n    f10 = 10 ** -np.floor(np.log10(diff))\n    max_bins = min(max_bins, len(unique))\n    for f in factors:\n        width = f / f10\n        if width < min_width:\n            continue\n        mn_ = np.floor(mn / width) * width\n        mx_ = np.ceil(mx / width) * width\n        nbins = np.round((mx_ - mn_) / width)\n        if min_bins <= nbins <= max_bins \\\n                and (not bins or bins[-1].nbins != nbins):\n            bins_ = mn_ + width * np.arange(nbins + 1)\n            # to prevent values on the edge of the bin fall in the wrong bin\n            # due to precision error on decimals that are not precise\n            bins_ = np.around(bins_, decimals=np.finfo(bins_.dtype).precision)\n            bin_def = BinDefinition(bins_, label_fmt, None, width)\n            bins.append(bin_def)\n    return bins\n\n\ndef time_binnings(data, *, min_bins=2, max_bins=50, min_unique=5, add_unique=0\n                  ) -> List[BinDefinition]:\n    \"\"\"\n    Find a set of nice splits of time variable data into bins\n\n    The function considers bin widths of\n\n    - 1, 5, 10, 15, 30 seconds.\n    - 1, 5, 10, 15, 30 minutes,\n    - 1, 2, 3, 6, 12 hours,\n    - 1 day,\n    - 1, 2 weeks,\n    - 1, 2, 3, 6 months,\n    - 1, 2, 5, 10, 25, 50, 100 years,\n\n    and returns those that yield between `min_bins` and `max_bins` intervals.\n\n    Args:\n        data (np.ndarray):\n            vector of data points; values may repeat, and nans and infs are\n            filtered out.\n        min_bins (int): minimal number of bins\n        max_bins (int):\n            maximal number of bins; the number of bins will never exceed the\n            number of unique values\n\n    Returns:\n        bin_boundaries (list of BinDefinition): a list of possible binning.\n            Each element of `bin_boundaries` is a tuple consisting of a label\n            describing the bin size (e.g. `2 weeks`) and a list of thresholds.\n            Thresholds are given as pairs\n            (number_of_seconds_since_epoch, label).\n    \"\"\"\n    mn, mx, unique = _min_max_unique(data)\n    mn = utc_from_timestamp(mn).timetuple()\n    mx = utc_from_timestamp(mx).timetuple()\n    bins = []\n    if len(unique) <= max(min_unique, add_unique):\n        bins.append(_unique_time_bins(unique))\n    if len(unique) > min_unique:\n        bins += _time_binnings(mn, mx, min_bins + 1, max_bins + 1)\n    return bins\n\n\ndef _time_binnings(mn, mx, min_pts, max_pts):\n    bins = []\n    for place, step, fmt, unit in (\n            [(5, x, \"%H:%M:%S\", \"second\") for x in (1, 5, 10, 15, 30)] +\n            [(4, x, \"%b %d %H:%M\", \"minute\") for x in (1, 5, 10, 15, 30)] +\n            [(3, x, \"%y %b %d %H:%M\", \"hour\") for x in (1, 2, 3, 6, 12)] +\n            [(2, 1, \"%y %b %d\", \"day\")] +\n            [(2, x, \"%y %b %d\", \"week\") for x in (7, 14)] +\n            [(1, x, \"%y %b\", \"month\") for x in (1, 2, 3, 6)] +\n            [(0, x, \"%Y\", \"year\") for x in (1, 2, 5, 10, 25, 50, 100)]):\n        times = _time_range(mn, mx, place, step, min_pts, max_pts)\n        if not times:\n            continue\n        times = [time.struct_time(t + (0, 0, 0)) for t in times]\n        thresholds = np.array([calendar.timegm(t) for t in times])\n        labels = [time.strftime(fmt, t) for t in times]\n        short_labels = _simplified_labels(labels)\n        if place == 2 and step >= 7:\n            unit_label = f\"{step // 7} week{'s' * (step > 7)}\"\n        else:\n            unit_label = f\"{step} {unit}{'s' * (step > 1)}\"\n        new_bins = BinDefinition(\n            thresholds, labels, short_labels, None, unit_label)\n        if not bins or new_bins.nbins != bins[-1].nbins:\n            bins.append(new_bins)\n    return bins\n\n\n# datetime + deltatime is not very useful here because deltatime is\n# given a number of days, not years or months, so it doesn't allow\n# for specifying a step of 1 month\ndef _time_range(start, end, place, step, min_pts, max_pts,\n                _zeros=(0, 1, 1, 0, 0, 0)):\n    if place == 2 and step % 7 == 0:\n        startd = datetime.date(*start[:3])\n        startd -= datetime.timedelta(days=-startd.weekday())\n        start = [startd.year, startd.month, startd.day, 0, 0, 0]\n    else:\n        start = list(\n            start[:place]\n            + ((start[place] - _zeros[place]) // step * step + _zeros[place], )\n            + _zeros[place + 1:])\n    end = list(end[:place + 1] + _zeros[place + 1:])\n    s = [tuple(start)]\n    for _ in range(max_pts - 1):\n        start[place] += step\n        if place >= 3:  # hours, minutes, seconds\n            for pos, maxval in enumerate((60, 60, 24), start=1):\n                if start[-pos] >= maxval:\n                    start[-pos - 1] += 1\n                    start[-pos] %= maxval\n        if place >= 2:\n            md = _month_days(*start[:2])\n            if start[2] > md:\n                start[1] += 1\n                start[2] %= md\n        if start[1] > 12:\n            start[0] += 1\n            start[1] %= 12\n        s.append(tuple(start))\n        if start > end:\n            return s if len(s) >= min_pts else None\n    return None\n\n\ndef _month_days(year, month,\n                _md=(None, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)):\n    return _md[month] + (\n        month == 2 and (year % 400 == 0 or year % 4 == 0 and year % 100 != 0))\n\n\ndef _simplified_labels(labels):\n    labels = labels[:]\n    to_remove = \"42\"\n    while True:\n        firsts = {f for f, *_ in (lab.split() for lab in labels)}\n        if len(firsts) != 1:  # can be 0 if there are no labels\n            break\n        to_remove = firsts.pop()\n        flen = len(to_remove)\n        if any(len(lab) == flen for lab in labels):\n            break\n        labels = [lab[flen+1:] for lab in labels]\n    for i in range(len(labels) - 1, 0, -1):\n        for k, c, d in zip(count(), labels[i].split(), labels[i - 1].split()):\n            if c != d:\n                labels[i] = \" \".join(labels[i].split()[k:])\n                break\n    # If the last thing removed were month names and the labels continues with\n    # hours, keep month name in the first label; \"08 12:29\" looks awkward.\n    if not to_remove[0].isdigit() and \":\" in labels[0]:\n        labels[0] = f\"{to_remove} {labels[0]}\"\n    return labels\n\n\ndef _unique_time_bins(unique):\n    times = [utc_from_timestamp(x).timetuple() for x in unique]\n    fmt = f'%y %b %d'\n    fmt += \" %H:%M\" * (len({t[2:] for t in times}) > 1)\n    fmt += \":%S\" * bool(np.all(unique % 60 == 0))\n    labels = [time.strftime(fmt, x) for x in times]\n    short_labels = _simplified_labels(labels)\n    return BinDefinition(_unique_thresholds(unique), labels, short_labels)\n\n\ndef _unique_thresholds(unique):\n    if len(unique) >= 2:\n        # make the last bin the same width as the one before\n        last_boundary = 2 * unique[-1] - unique[-2]\n    else:\n        last_boundary = unique[0] + 1\n    return np.hstack((unique, [last_boundary]))\n\n\ndef _min_max_unique(data):\n    unique = np.unique(data)\n    unique = unique[np.isfinite(unique)]\n    if not unique.size:\n        raise ValueError(\"no valid (non-nan) data\")\n    return unique[0], unique[-1], unique\n\n\nshort_time_units = dict(seconds=\"sec\", minutes=\"min\", hours=\"hrs\",\n                        weeks=\"wks\", months=\"mon\", years=\"yrs\",\n                        second=\"sec\", minute=\"min\", month=\"mon\")\n\n\n# noinspection PyPep8Naming\nclass EntropyMDL(Discretization):\n    \"\"\"\n    Discretization into bins inferred by recursively splitting the values to\n    minimize the class-entropy. The procedure stops when further splits would\n    decrease the entropy for less than the corresponding increase of minimal\n    description length (MDL). [FayyadIrani93].\n\n    If there are no suitable cut-off points, the procedure returns a single bin,\n    which means that the new feature is constant and can be removed.\n\n    .. attribute:: force\n\n        Induce at least one cut-off point, even when its information\n        gain is lower than MDL (default: False).\n\n    \"\"\"\n    def __init__(self, force=False):\n        self.force = force\n\n    def __call__(self, data, attribute):\n        cont = contingency.get_contingency(data, attribute)\n        values, I = cont.values, cont.counts.T\n        cut_ind = np.array(self._entropy_discretize_sorted(I, self.force))\n        if len(cut_ind) > 0:\n            # \"the midpoint between each successive pair of examples\" (FI p.1)\n            points = (values[cut_ind] + values[cut_ind - 1]) / 2.\n        else:\n            points = []\n        return Discretizer.create_discretized_var(\n            data.domain[attribute], points)\n\n    @classmethod\n    def _normalize(cls,\n                   X: Union[List[List[Number]], np.ndarray],\n                   axis: Optional[int] = None,\n                   out: Optional[np.ndarray] = None) -> np.ndarray:\n        \"\"\"\n        Normalize `X` array so it sums to 1.0 over the `axis`.\n\n        Parameters\n        ----------\n        X : array\n            Array to normalize.\n        axis : optional int\n            Axis over which the resulting array sums to 1.\n        out : optional array\n            Output array of the same shape as X.\n        \"\"\"\n        X = np.asarray(X, dtype=float)\n        scale = np.sum(X, axis=axis, keepdims=True)\n        scale[scale == 0] = 1\n        if out is None:\n            return X / scale\n        else:\n            if out is not X:\n                assert out.shape == X.shape\n                out[:] = X\n            out /= scale\n            return out\n\n    @classmethod\n    def _entropy_normalized(cls, D, axis=None):\n        \"\"\"\n        Compute the entropy of distribution array `D`.\n\n        `D` must be a distribution (i.e. sum to 1.0 over `axis`)\n\n        Parameters\n        ----------\n        D : array\n            Distribution.\n        axis : optional int\n            Axis of `D` along which to compute the entropy.\n\n        \"\"\"\n        # req: (np.sum(D, axis=axis) >= 0).all()\n        # req: (np.sum(D, axis=axis) <= 1).all()\n        # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9)\n\n        D = np.asarray(D)\n        if np.sum(D) == 0:\n            return 0\n        Dc = np.clip(D, np.finfo(D.dtype).eps, 1.0)\n        return - np.sum(D * np.log2(Dc), axis=axis)\n\n    @classmethod\n    def _entropy(cls, D, axis=None):\n        \"\"\"\n        Compute the entropy of distribution `D`.\n\n        Parameters\n        ----------\n        D : array\n            Distribution.\n        axis : optional int\n            Axis of `D` along which to compute the entropy.\n\n        \"\"\"\n        D = cls._normalize(D, axis=axis)\n        return cls._entropy_normalized(D, axis=axis)\n\n    @classmethod\n    def _entropy1(cls, D):\n        \"\"\"\n        Compute the entropy of distributions in `D`\n        (one per each row).\n        \"\"\"\n        D = cls._normalize(D)\n        return _discretize.entropy_normalized1(D)\n\n    @classmethod\n    def _entropy2(cls, D):\n        \"\"\"\n        Compute the entropy of distributions in `D`\n        (one per each row).\n        \"\"\"\n        D = cls._normalize(D, axis=1)\n        return _discretize.entropy_normalized2(D)\n\n    @classmethod\n    def _entropy_cuts_sorted(cls, CS):\n        \"\"\"\n        Return the class information entropy induced by partitioning\n        the `CS` distribution at all N-1 candidate cut points.\n\n        Parameters\n        ----------\n        CS : (N, K) array of class distributions.\n        \"\"\"\n        CS = np.asarray(CS)\n        # |--|-------|--------|\n        #  S1    ^       S2\n        # S1 contains all points which are <= to cut point\n        # Cumulative distributions for S1 and S2 (left right set)\n        # i.e. a cut at index i separates the CS into S1Dist[i] and S2Dist[i]\n        S1Dist = np.cumsum(CS, axis=0)[:-1]\n        S2Dist = np.cumsum(CS[::-1], axis=0)[-2::-1]\n\n        # Entropy of S1[i] and S2[i] sets\n        ES1 = cls._entropy2(S1Dist)\n        ES2 = cls._entropy2(S2Dist)\n\n        # Number of cases in S1[i] and S2[i] sets\n        S1_count = np.sum(S1Dist, axis=1)\n        S2_count = np.sum(S2Dist, axis=1)\n\n        # Number of all cases\n        S_count = np.sum(CS)\n\n        ES1w = ES1 * S1_count / S_count\n        ES2w = ES2 * S2_count / S_count\n\n        # E(A, T; S) Class information entropy of the partition S\n        E = ES1w + ES2w\n\n        return E, ES1, ES2\n\n    @classmethod\n    def _entropy_discretize_sorted(cls, C, force=False):\n        \"\"\"\n        Entropy discretization on a sorted C.\n\n        :param C: (N, K) array of class distributions.\n\n        \"\"\"\n        E, ES1, ES2 = cls._entropy_cuts_sorted(C)\n        # TODO: Also get the left right distribution counts from\n        # entropy_cuts_sorted,\n\n        # Note the + 1\n        if len(E) == 0:\n            return []\n        cut_index = np.argmin(E) + 1\n\n        # Distribution of classed in S1, S2 and S\n        S1_c = np.sum(C[:cut_index], axis=0)\n        S2_c = np.sum(C[cut_index:], axis=0)\n        S_c = S1_c + S2_c\n\n        ES = cls._entropy1(np.sum(C, axis=0))\n        ES1, ES2 = ES1[cut_index - 1], ES2[cut_index - 1]\n\n        # Information gain of the best split\n        Gain = ES - E[cut_index - 1]\n        # Number of different classes in S, S1 and S2\n        k = float(np.sum(S_c > 0))\n        k1 = float(np.sum(S1_c > 0))\n        k2 = float(np.sum(S2_c > 0))\n\n        assert k > 0\n        delta = np.log2(3 ** k - 2) - (k * ES - k1 * ES1 - k2 * ES2)\n        N = float(np.sum(S_c))\n\n        if N > 1 and Gain > np.log2(N - 1) / N + delta / N:\n            # Accept the cut point and recursively split the subsets.\n            left, right = [], []\n            if k1 > 1 and cut_index > 1:\n                left = cls._entropy_discretize_sorted(C[:cut_index, :])\n            if k2 > 1 and cut_index < len(C) - 1:\n                right = cls._entropy_discretize_sorted(C[cut_index:, :])\n            return left + [cut_index] + [i + cut_index for i in right]\n        elif force:\n            return [cut_index]\n        else:\n            return []\n\n\nclass DomainDiscretizer(Reprable):\n    \"\"\"Discretizes all continuous features in the data.\n\n    .. attribute:: method\n\n        Feature discretization method (instance of\n        :obj:`Orange.preprocess.Discretization`). If `None` (default),\n        :class:`Orange.preprocess.EqualFreq` with 4 intervals is\n        used.\n\n    .. attribute:: clean\n\n        If `True`, features discretized into a single interval constant are\n        removed. This is useful for discretization methods that infer the\n        number of intervals from the data, such as\n        :class:`Orange.preprocess.EntropyMDL` (default: `True`).\n\n    .. attribute:: discretize_class\n\n        Determines whether a target is also discretized if it is continuous.\n        (default: `False`)\n    \"\"\"\n    def __init__(self, discretize_class=False, method=None, clean=True,\n                 fixed=None):\n        self.discretize_class = discretize_class\n        self.method = method\n        self.clean = clean\n        self.fixed = fixed\n\n    def __call__(self, data, fixed=None):\n        \"\"\"\n        Compute and return discretized domain.\n\n        :param data: Data to discretize.\n        \"\"\"\n\n        def transform_list(s, fixed=None):\n            new_vars = []\n            for var in s:\n                if var.is_continuous:\n                    if fixed and var.name in fixed.keys():\n                        nv = method(data, var, fixed)\n                    else:\n                        nv = method(data, var)\n                    if not self.clean or len(nv.values) > 1:\n                        new_vars.append(nv)\n                else:\n                    new_vars.append(var)\n            return new_vars\n        if self.method is None:\n            method = EqualFreq(n=4)\n        else:\n            method = self.method\n        domain = data.domain\n        new_attrs = transform_list(domain.attributes, fixed or self.fixed)\n        if self.discretize_class:\n            new_classes = transform_list(domain.class_vars)\n        else:\n            new_classes = domain.class_vars\n        return Domain(new_attrs, new_classes)\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Inconsistent Rounding in Discretizer Causes Incorrect Threshold Values

**Description:**
When discretizing continuous variables, the rounding of threshold points is expected to align with Python's string formatting to ensure consistency and uniqueness of labels. However, using NumPy's `round` function leads to discrepancies in the threshold values, causing inconsistencies in the labeling.

**Example Code:**
```python
x = ContinuousVariable("x", number_of_decimals=0)
points, values, _ = Discretizer._get_discretized_values(x, np.array([2.3455, 2.346]))
print(points)  # Output: [2.3455, 2.346]
print(values)  # Output: ['< 2.345', '2.345 - 2.346', '≥ 2.346']
```

In this example, the expected rounded points should be `[2.345, 2.346]` to match the string formatting in the labels. However, using NumPy's `round` results in the first point remaining as `2.3455`, causing the labels to be inconsistent and potentially duplicated.

**Expected Behavior:**
Threshold points should be rounded in a manner consistent with Python's built-in `round` function and string formatting. This ensures that the threshold values are unique and correctly formatted, preventing any duplication or labeling errors.

**Actual Behavior:**
Using NumPy's `round` leads to threshold values that do not align with the expected rounded values from Python's `round`. This results in incorrect threshold points, causing tests to fail and potentially leading to misleading discretization labels.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/preprocess/discretize.py
import calendar
import re
import time
from numbers import Number
from typing import NamedTuple, List, Union, Callable, Optional
import datetime
from itertools import count, chain

import numpy as np
import scipy.sparse as sp

from Orange.data import DiscreteVariable, Domain, TimeVariable, Table
from Orange.data.sql.table import SqlTable
from Orange.statistics import distribution, contingency, util as ut
from Orange.statistics.basic_stats import BasicStats
from Orange.util import Reprable, utc_from_timestamp
from .transformation import Transformation
from . import _discretize

__all__ = ["EqualFreq", "EqualWidth", "EntropyMDL", "DomainDiscretizer",
           "decimal_binnings", "time_binnings", "short_time_units",
           "BinDefinition"]


class Discretizer(Transformation):
    """Value transformer that returns an index of the bin for the given value.
    """
    def __init__(self, variable, points):
        super().__init__(variable)
        self.points = points

    @staticmethod
    def digitize(x, bins):
        if sp.issparse(x):
            if len(bins):
                x.data = np.digitize(x.data, bins)
            else:
                x = sp.csr_matrix(x.shape)
            return x
        else:
            return np.digitize(x, bins) if len(bins) else [0]*len(x)

    def transform(self, c):
        if sp.issparse(c):
            return self.digitize(c, self.points)
        elif c.size:
            return np.where(np.isnan(c), np.NaN, self.digitize(c, self.points))
        else:
            return np.array([], dtype=int)

    @staticmethod
    def _fmt_interval(low, high, formatter, strip_zeros=True):
        assert low is None or high is None or low < high

        def strip0(s):
            if strip_zeros and re.match(r"^\d+\.\d+", s):
                return s.rstrip("0").rstrip(".")
            return s

        lows = (low is not None and not np.isinf(low)
                and strip0(formatter(low)))
        highs = (high is not None and not np.isinf(high)
                 and strip0(formatter(high)))
        assert lows or highs
        if lows == highs:
            raise ValueError(f"Formatter returned identical thresholds: {lows}")

        if not lows:
            return f"< {highs}"
        if not highs:
            return f"≥ {lows}"
        return f"{lows} - {highs}"

    @classmethod
    def _get_labels(cls, fmt, points, strip_zeros=True):
        return [
            cls._fmt_interval(low, high, fmt, strip_zeros=strip_zeros)
            for low, high in zip(
                chain([-np.inf], points),
                chain(points, [np.inf]))]

    @classmethod
    def _get_discretized_values(cls, var, points, ndigits=None):
        if len(points) == 0:
            values = ["single_value"]
            to_sql = SingleValueSql(values[0])
            return points, values, to_sql

        npoints = np.array(points, dtype=np.float64)
        if len(points) > 1:
            mindiff = np.min(npoints[1:] - npoints[:-1])
            if mindiff == 0:
                raise ValueError("Some interval thresholds are identical")
        else:
            mindiff = 1  # prevent warnings

        if ndigits is None or len(points) == 1:
            try:
                values = cls._get_labels(var.str_val, points)
            except ValueError:
                pass
            else:
                if len(values) == len(set(values)):
                    to_sql = BinSql(var, points)
                    return points, values, to_sql

        mindigits = max(ndigits or 0,
                        int(-np.log10(mindiff)))
        maxdigits = np.finfo(npoints.dtype).precision + 2
        for digits in range(mindigits, maxdigits + 1):
            npoints = np.round(points, digits)
            if len(npoints) == len(set(npoints)):
                def fmt_fixed(val):
                    # We break the loop, pylint: disable=cell-var-from-loop
                    return f"{val:.{digits}f}"

                points = list(npoints)
                break
        else:
            # pragma: no cover
            assert False

        values = cls._get_labels(
            fmt_fixed, points,
            strip_zeros=digits != ndigits)
        assert len(values) == len(set(values))
        to_sql = BinSql(var, points)
        return points, values, to_sql

    @classmethod
    def create_discretized_var(cls, var, points, ndigits=None):
        points, values, to_sql = cls._get_discretized_values(var, points, ndigits)
        dvar = DiscreteVariable(name=var.name, values=values,
                                compute_value=cls(var, points),
                                sparse=var.sparse)
        dvar.source_variable = var
        dvar.to_sql = to_sql
        return dvar

    def __eq__(self, other):
        return super().__eq__(other) and self.points == other.points

    def __hash__(self):
        return hash((type(self), self.variable, tuple(self.points)))


class BinSql:
    def __init__(self, var, points):
        self.var = var
        self.points = points

    def __call__(self):
        return f'width_bucket({self.var.to_sql()}, ' \
               f'ARRAY{str(self.points)}::double precision[])'


class SingleValueSql:
    def __init__(self, value):
        self.value = value

    def __call__(self):
        return "'%s'" % self.value


class Discretization(Reprable):
    """Abstract base class for discretization classes."""
    def __call__(self, data, variable):
        """
        Compute discretization of the given variable on the given data.
        Return a new variable with the appropriate domain
        (:obj:`Orange.data.DiscreteVariable.values`) and transformer
        (:obj:`Orange.data.Variable.compute_value`).
        """
        raise NotImplementedError(
            "Subclasses of 'Discretization' need to implement "
            "the call operator")


class EqualFreq(Discretization):
    """Discretization into bins with approximately equal number of data
    instances.

    .. attribute:: n

        Number of bins (default: 4). The actual number may be lower if the
        variable has less than n distinct values.
    """
    def __init__(self, n=4):
        self.n = n

    # noinspection PyProtectedMember
    def __call__(self, data, attribute):
        if type(data) == SqlTable:
            att = attribute.to_sql()
            quantiles = [(i + 1) / self.n for i in range(self.n - 1)]
            query = data._sql_query(
                ['quantile(%s, ARRAY%s)' % (att, str(quantiles))],
                use_time_sample=1000)
            with data._execute_sql_query(query) as cur:
                points = sorted(set(cur.fetchone()[0]))
        else:
            d = distribution.get_distribution(data, attribute)
            points = _discretize.split_eq_freq(d, self.n)
            # np.unique handles cases in which differences are below precision
            points = list(np.unique(points))
        return Discretizer.create_discretized_var(
            data.domain[attribute], points)

class EqualWidth(Discretization):
    """Discretization into a fixed number of bins with equal widths.

    .. attribute:: n

        Number of bins (default: 4).
    """
    def __init__(self, n=4):
        self.n = n

    # noinspection PyProtectedMember
    def __call__(self, data: Table, attribute, fixed=None):
        if fixed:
            mn, mx = fixed[attribute.name]
            points = self._split_eq_width(mn, mx)
        else:
            if type(data) == SqlTable:
                stats = BasicStats(data, attribute)
                points = self._split_eq_width(stats.min, stats.max)
            else:
                values = data.get_column(attribute)
                if values.size:
                    mn, mx = ut.nanmin(values), ut.nanmax(values)
                    points = self._split_eq_width(mn, mx)
                else:
                    points = []
        return Discretizer.create_discretized_var(
            data.domain[attribute], points)

    def _split_eq_width(self, mn, mx):
        if np.isnan(mn) or np.isnan(mx) or mn == mx:
            return []
        dif = (mx - mn) / self.n
        return [mn + i * dif for i in range(1, self.n)]


class TooManyIntervals(ValueError):
    pass


class FixedWidth(Discretization):
    def __init__(self, width, digits=None):
        super().__init__()
        self.width = width
        self.digits = digits

    def __call__(self, data: Table, attribute):
        values = data.get_column(attribute)
        points = []
        if values.size:
            mn, mx = ut.nanmin(values), ut.nanmax(values)
            if not np.isnan(mn):
                minf = int(1 + np.floor(mn / self.width))
                maxf = int(1 + np.floor(mx / self.width))
                if maxf - minf - 1 >= 100:
                    raise TooManyIntervals
                points = [i * self.width for i in range(minf, maxf)]
        return Discretizer.create_discretized_var(
                    data.domain[attribute], points, ndigits=self.digits)


class FixedTimeWidth(Discretization):
    def __init__(self, width, unit):
        # unit: 0=year, 1=month, 2=day, 3=hour, 4=minute, 5=second
        # for week, use day with a width of 7
        super().__init__()
        self.width = width
        self.unit = unit

    def __call__(self, data: Table, attribute):
        fmt = ["%Y", "%y %b", "%y %b %d", "%y %b %d %H:%M", "%y %b %d %H:%M",
                "%H:%M:%S"][self.unit]
        values = data.get_column(attribute)
        times = []
        if values.size:
            mn, mx = ut.nanmin(values), ut.nanmax(values)
            if not np.isnan(mn):
                mn = utc_from_timestamp(mn).timetuple()
                mx = utc_from_timestamp(mx).timetuple()
                times = _time_range(mn, mx, self.unit, self.width, 0, 100)
                if times is None:
                    raise TooManyIntervals
        times = [time.struct_time(t + (0, 0, 0)) for t in times][1:-1]
        points = np.array([calendar.timegm(t) for t in times])
        values = [time.strftime(fmt, t) for t in times]
        values = _simplified_time_intervals(values)
        var = data.domain[attribute]
        return DiscreteVariable(name=var.name, values=values,
                                compute_value=Discretizer(var, points),
                                sparse=var.sparse)


def _simplified_time_intervals(labels):
    def no_common(a, b):
        for i, pa, pb in zip(count(), a, b):
            if pa != pb:
                if common + i == 2:
                    i -= 1
                return b[i:]
        # can't come here (unless a == b?!)
        return b  # pragma: no cover


    if not labels:
        return []
    common = 100
    labels = [label.split() for label in labels]
    for common, parts in enumerate(map(set, zip(*labels))):
        if len(parts) > 1:
            break
    if common == 2:  # If we keep days, we must also keep months
        common = 1
    labels = [label[common:] for label in labels]
    join = " ".join
    return [f"< {join(labels[0])}"] + [
        f"{join(low)} - {join(no_common(low, high))}"
        for low, high in zip(labels, labels[1:])
        ] + [f"≥ {join(labels[-1])}"]



class Binning(Discretization):
    """Discretization with nice thresholds

    This class creates different decimal or time binnings and picks the one
    in which the number of interval is closest to the desired number.
    The difference is measured as proportion; e.g. having 30 % less intervals
    is the same difference as having 30 % too many.

    .. attribute:: n

        Desired number of bins (default: 4).
    """
    def __init__(self, n=4):
        self.n = n

    def __call__(self, data: Table, attribute):
        attribute = data.domain[attribute]
        values = data.get_column(attribute)
        values = values.astype(float)
        if not values.size:
            return self._create_binned_var(None, attribute)

        var = data.domain[attribute]
        if isinstance(var, TimeVariable):
            binnings = time_binnings(values)
        else:
            binnings = decimal_binnings(values)
        return self._create_binned_var(binnings, attribute)

    def _create_binned_var(self, binnings, variable):
        if not binnings:
            return Discretizer.create_discretized_var(variable, [])

        # If self.n is 2, require two intervals (one threshold, excluding top
        # and bottom), else require at least three intervals
        # ... unless this is the only option, in which case we use it
        # Break ties in favour of more bins
        binning = min(
            (binning for binning in binnings
             if len(binning.thresholds) - 2 >= 1 + (self.n != 2)),
            key=lambda binning: (abs(self.n - (len(binning.short_labels) - 1)),
                                 -len(binning.short_labels)),
            default=binnings[-1])

        if len(binning.thresholds) == 2:
            return Discretizer.create_discretized_var(variable, [])

        blabels = binning.labels[1:-1]
        labels = [f"< {blabels[0]}"] + [
            f"{lab1} - {lab2}" for lab1, lab2 in zip(blabels, blabels[1:])
        ] + [f"≥ {blabels[-1]}"]

        discretizer = Discretizer(variable, list(binning.thresholds[1:-1]))
        dvar = DiscreteVariable(name=variable.name, values=labels,
                                compute_value=discretizer,
                                sparse=variable.sparse)
        dvar.source_variable = variable
        return dvar


class BinDefinition(NamedTuple):
    thresholds: np.ndarray  # thresholds, including the top
    labels: List[str]  # friendly-formatted thresholds
    short_labels: List[str]  # shorter labels (e.g. simplified dates)
    width: Union[float, None]  # widths, if uniform; otherwise None
    width_label: str  # friendly-formatted width (e.g. '50' or '2 weeks')


# NamedTupleMeta doesn't allow to define __new__ so we need a subclass
# Name of the class has to be the same to match the namedtuple name
# pylint: disable=function-redefined
class BinDefinition(BinDefinition):
    def __new__(cls, thresholds, labels="%g",
                short_labels=None, width=None, width_label=""):

        def get_labels(fmt, default=None):
            if fmt is None:
                return default
            if isinstance(fmt, str):
                return [fmt % x for x in thresholds]
            elif isinstance(fmt, Callable):
                return [fmt(x) for x in thresholds]
            else:
                return fmt

        labels = get_labels(labels)
        short_labels = get_labels(short_labels, labels)
        if not width_label and width is not None:
            width_label = f"{width:g}"
        return super().__new__(
            cls, thresholds, labels, short_labels, width, width_label)

    @property
    def start(self) -> float:
        return self.thresholds[0]

    @property
    def nbins(self) -> int:
        return len(self.thresholds) - 1


def decimal_binnings(
        data, *, min_width=0, min_bins=2, max_bins=50,
        min_unique=5, add_unique=0,
        factors=(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20),
        label_fmt="%g") -> List[BinDefinition]:
    """
    Find a set of nice splits of data into bins

    The function first computes the scaling factor that is, the power of 10
    that brings the interval of values within [0, 1]. For instances, if the
    numbers come from interaval 10004001 and 10007005, the width of the
    interval is 3004, so the scaling factor is 1000.

    The function next considers bin widths that are products of scaling and
    different factors from 20 to 0.01 that make sense in decimal scale
    (see default value for argument `factors`). For each width, it rounds the
    minimal value down to this width and the maximal value up, and it computes
    the number of bins of that width that fit between these two values.
    If the number of bins is between `min_bins` and `max_bins`, and the width
    is at least `min_width`, this is a valid interval.

    If the data has no more than `min_unique` unique values, the function will
    add a set of bins that put each value into its own bin.

    If the data has no more than `add_unique` values, that last bins will put
    each value into its own bin.

    Args:
        data (np.ndarray):
            vector of data points; values may repeat, and nans and infs are
            filtered out.
        min_width (float): minimal bin width
        min_bins (int): minimal number of bins
        max_bins (int):
            maximal number of bins; the number of bins will never exceed the
            number of unique values
        min_unique (int):
            if the number of unique values are less or equal to `min_unique`,
            the function returns a single binning that matches that values in
            the data
        add_unique (int):
            similar to `min_unique` except that such bins are added to the list;
            set to 0 to disable
        factors (list of float):
            The factors with which the scaling is multiplied. Default is
            `(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20)`,
            so if scaling is 1000, considered bin widths are 20000, 10000,
            5000, 2000, 1000, 500, 250, 200, 100, 50, 25, 20 and 10.
        label_fmt (str or Callable):
            A format string (default: "%g") used for threshold labels,
            or a function for formatting thresholds (e.g. var.str_val)

    Returns:
        bin_definition (list of BinDefinition):
            `BinDefinition` is a named tuple containing the beginning of the
            first bin (`start`), number of bins (`nbins`) and their widths
            (`width`). The last value can also be a `nd.array` with `nbins + 1`
            elements, which describes bins of unequal width and is used for
            binnings that match the unique values in the data (see `min_unique`
            and `add_unique`).
    """
    bins = []

    mn, mx, unique = _min_max_unique(data)
    if len(unique) <= max(min_unique, add_unique):
        bins.append(BinDefinition(_unique_thresholds(unique), label_fmt))
        if len(unique) <= min_unique:
            return bins

    diff = mx - mn
    f10 = 10 ** -np.floor(np.log10(diff))
    max_bins = min(max_bins, len(unique))
    for f in factors:
        width = f / f10
        if width < min_width:
            continue
        mn_ = np.floor(mn / width) * width
        mx_ = np.ceil(mx / width) * width
        nbins = np.round((mx_ - mn_) / width)
        if min_bins <= nbins <= max_bins \
                and (not bins or bins[-1].nbins != nbins):
            bins_ = mn_ + width * np.arange(nbins + 1)
            # to prevent values on the edge of the bin fall in the wrong bin
            # due to precision error on decimals that are not precise
            bins_ = np.around(bins_, decimals=np.finfo(bins_.dtype).precision)
            bin_def = BinDefinition(bins_, label_fmt, None, width)
            bins.append(bin_def)
    return bins


def time_binnings(data, *, min_bins=2, max_bins=50, min_unique=5, add_unique=0
                  ) -> List[BinDefinition]:
    """
    Find a set of nice splits of time variable data into bins

    The function considers bin widths of

    - 1, 5, 10, 15, 30 seconds.
    - 1, 5, 10, 15, 30 minutes,
    - 1, 2, 3, 6, 12 hours,
    - 1 day,
    - 1, 2 weeks,
    - 1, 2, 3, 6 months,
    - 1, 2, 5, 10, 25, 50, 100 years,

    and returns those that yield between `min_bins` and `max_bins` intervals.

    Args:
        data (np.ndarray):
            vector of data points; values may repeat, and nans and infs are
            filtered out.
        min_bins (int): minimal number of bins
        max_bins (int):
            maximal number of bins; the number of bins will never exceed the
            number of unique values

    Returns:
        bin_boundaries (list of BinDefinition): a list of possible binning.
            Each element of `bin_boundaries` is a tuple consisting of a label
            describing the bin size (e.g. `2 weeks`) and a list of thresholds.
            Thresholds are given as pairs
            (number_of_seconds_since_epoch, label).
    """
    mn, mx, unique = _min_max_unique(data)
    mn = utc_from_timestamp(mn).timetuple()
    mx = utc_from_timestamp(mx).timetuple()
    bins = []
    if len(unique) <= max(min_unique, add_unique):
        bins.append(_unique_time_bins(unique))
    if len(unique) > min_unique:
        bins += _time_binnings(mn, mx, min_bins + 1, max_bins + 1)
    return bins


def _time_binnings(mn, mx, min_pts, max_pts):
    bins = []
    for place, step, fmt, unit in (
            [(5, x, "%H:%M:%S", "second") for x in (1, 5, 10, 15, 30)] +
            [(4, x, "%b %d %H:%M", "minute") for x in (1, 5, 10, 15, 30)] +
            [(3, x, "%y %b %d %H:%M", "hour") for x in (1, 2, 3, 6, 12)] +
            [(2, 1, "%y %b %d", "day")] +
            [(2, x, "%y %b %d", "week") for x in (7, 14)] +
            [(1, x, "%y %b", "month") for x in (1, 2, 3, 6)] +
            [(0, x, "%Y", "year") for x in (1, 2, 5, 10, 25, 50, 100)]):
        times = _time_range(mn, mx, place, step, min_pts, max_pts)
        if not times:
            continue
        times = [time.struct_time(t + (0, 0, 0)) for t in times]
        thresholds = np.array([calendar.timegm(t) for t in times])
        labels = [time.strftime(fmt, t) for t in times]
        short_labels = _simplified_labels(labels)
        if place == 2 and step >= 7:
            unit_label = f"{step // 7} week{'s' * (step > 7)}"
        else:
            unit_label = f"{step} {unit}{'s' * (step > 1)}"
        new_bins = BinDefinition(
            thresholds, labels, short_labels, None, unit_label)
        if not bins or new_bins.nbins != bins[-1].nbins:
            bins.append(new_bins)
    return bins


# datetime + deltatime is not very useful here because deltatime is
# given a number of days, not years or months, so it doesn't allow
# for specifying a step of 1 month
def _time_range(start, end, place, step, min_pts, max_pts,
                _zeros=(0, 1, 1, 0, 0, 0)):
    if place == 2 and step % 7 == 0:
        startd = datetime.date(*start[:3])
        startd -= datetime.timedelta(days=-startd.weekday())
        start = [startd.year, startd.month, startd.day, 0, 0, 0]
    else:
        start = list(
            start[:place]
            + ((start[place] - _zeros[place]) // step * step + _zeros[place], )
            + _zeros[place + 1:])
    end = list(end[:place + 1] + _zeros[place + 1:])
    s = [tuple(start)]
    for _ in range(max_pts - 1):
        start[place] += step
        if place >= 3:  # hours, minutes, seconds
            for pos, maxval in enumerate((60, 60, 24), start=1):
                if start[-pos] >= maxval:
                    start[-pos - 1] += 1
                    start[-pos] %= maxval
        if place >= 2:
            md = _month_days(*start[:2])
            if start[2] > md:
                start[1] += 1
                start[2] %= md
        if start[1] > 12:
            start[0] += 1
            start[1] %= 12
        s.append(tuple(start))
        if start > end:
            return s if len(s) >= min_pts else None
    return None


def _month_days(year, month,
                _md=(None, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)):
    return _md[month] + (
        month == 2 and (year % 400 == 0 or year % 4 == 0 and year % 100 != 0))


def _simplified_labels(labels):
    labels = labels[:]
    to_remove = "42"
    while True:
        firsts = {f for f, *_ in (lab.split() for lab in labels)}
        if len(firsts) != 1:  # can be 0 if there are no labels
            break
        to_remove = firsts.pop()
        flen = len(to_remove)
        if any(len(lab) == flen for lab in labels):
            break
        labels = [lab[flen+1:] for lab in labels]
    for i in range(len(labels) - 1, 0, -1):
        for k, c, d in zip(count(), labels[i].split(), labels[i - 1].split()):
            if c != d:
                labels[i] = " ".join(labels[i].split()[k:])
                break
    # If the last thing removed were month names and the labels continues with
    # hours, keep month name in the first label; "08 12:29" looks awkward.
    if not to_remove[0].isdigit() and ":" in labels[0]:
        labels[0] = f"{to_remove} {labels[0]}"
    return labels


def _unique_time_bins(unique):
    times = [utc_from_timestamp(x).timetuple() for x in unique]
    fmt = f'%y %b %d'
    fmt += " %H:%M" * (len({t[2:] for t in times}) > 1)
    fmt += ":%S" * bool(np.all(unique % 60 == 0))
    labels = [time.strftime(fmt, x) for x in times]
    short_labels = _simplified_labels(labels)
    return BinDefinition(_unique_thresholds(unique), labels, short_labels)


def _unique_thresholds(unique):
    if len(unique) >= 2:
        # make the last bin the same width as the one before
        last_boundary = 2 * unique[-1] - unique[-2]
    else:
        last_boundary = unique[0] + 1
    return np.hstack((unique, [last_boundary]))


def _min_max_unique(data):
    unique = np.unique(data)
    unique = unique[np.isfinite(unique)]
    if not unique.size:
        raise ValueError("no valid (non-nan) data")
    return unique[0], unique[-1], unique


short_time_units = dict(seconds="sec", minutes="min", hours="hrs",
                        weeks="wks", months="mon", years="yrs",
                        second="sec", minute="min", month="mon")


# noinspection PyPep8Naming
class EntropyMDL(Discretization):
    """
    Discretization into bins inferred by recursively splitting the values to
    minimize the class-entropy. The procedure stops when further splits would
    decrease the entropy for less than the corresponding increase of minimal
    description length (MDL). [FayyadIrani93].

    If there are no suitable cut-off points, the procedure returns a single bin,
    which means that the new feature is constant and can be removed.

    .. attribute:: force

        Induce at least one cut-off point, even when its information
        gain is lower than MDL (default: False).

    """
    def __init__(self, force=False):
        self.force = force

    def __call__(self, data, attribute):
        cont = contingency.get_contingency(data, attribute)
        values, I = cont.values, cont.counts.T
        cut_ind = np.array(self._entropy_discretize_sorted(I, self.force))
        if len(cut_ind) > 0:
            # "the midpoint between each successive pair of examples" (FI p.1)
            points = (values[cut_ind] + values[cut_ind - 1]) / 2.
        else:
            points = []
        return Discretizer.create_discretized_var(
            data.domain[attribute], points)

    @classmethod
    def _normalize(cls,
                   X: Union[List[List[Number]], np.ndarray],
                   axis: Optional[int] = None,
                   out: Optional[np.ndarray] = None) -> np.ndarray:
        """
        Normalize `X` array so it sums to 1.0 over the `axis`.

        Parameters
        ----------
        X : array
            Array to normalize.
        axis : optional int
            Axis over which the resulting array sums to 1.
        out : optional array
            Output array of the same shape as X.
        """
        X = np.asarray(X, dtype=float)
        scale = np.sum(X, axis=axis, keepdims=True)
        scale[scale == 0] = 1
        if out is None:
            return X / scale
        else:
            if out is not X:
                assert out.shape == X.shape
                out[:] = X
            out /= scale
            return out

    @classmethod
    def _entropy_normalized(cls, D, axis=None):
        """
        Compute the entropy of distribution array `D`.

        `D` must be a distribution (i.e. sum to 1.0 over `axis`)

        Parameters
        ----------
        D : array
            Distribution.
        axis : optional int
            Axis of `D` along which to compute the entropy.

        """
        # req: (np.sum(D, axis=axis) >= 0).all()
        # req: (np.sum(D, axis=axis) <= 1).all()
        # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9)

        D = np.asarray(D)
        if np.sum(D) == 0:
            return 0
        Dc = np.clip(D, np.finfo(D.dtype).eps, 1.0)
        return - np.sum(D * np.log2(Dc), axis=axis)

    @classmethod
    def _entropy(cls, D, axis=None):
        """
        Compute the entropy of distribution `D`.

        Parameters
        ----------
        D : array
            Distribution.
        axis : optional int
            Axis of `D` along which to compute the entropy.

        """
        D = cls._normalize(D, axis=axis)
        return cls._entropy_normalized(D, axis=axis)

    @classmethod
    def _entropy1(cls, D):
        """
        Compute the entropy of distributions in `D`
        (one per each row).
        """
        D = cls._normalize(D)
        return _discretize.entropy_normalized1(D)

    @classmethod
    def _entropy2(cls, D):
        """
        Compute the entropy of distributions in `D`
        (one per each row).
        """
        D = cls._normalize(D, axis=1)
        return _discretize.entropy_normalized2(D)

    @classmethod
    def _entropy_cuts_sorted(cls, CS):
        """
        Return the class information entropy induced by partitioning
        the `CS` distribution at all N-1 candidate cut points.

        Parameters
        ----------
        CS : (N, K) array of class distributions.
        """
        CS = np.asarray(CS)
        # |--|-------|--------|
        #  S1    ^       S2
        # S1 contains all points which are <= to cut point
        # Cumulative distributions for S1 and S2 (left right set)
        # i.e. a cut at index i separates the CS into S1Dist[i] and S2Dist[i]
        S1Dist = np.cumsum(CS, axis=0)[:-1]
        S2Dist = np.cumsum(CS[::-1], axis=0)[-2::-1]

        # Entropy of S1[i] and S2[i] sets
        ES1 = cls._entropy2(S1Dist)
        ES2 = cls._entropy2(S2Dist)

        # Number of cases in S1[i] and S2[i] sets
        S1_count = np.sum(S1Dist, axis=1)
        S2_count = np.sum(S2Dist, axis=1)

        # Number of all cases
        S_count = np.sum(CS)

        ES1w = ES1 * S1_count / S_count
        ES2w = ES2 * S2_count / S_count

        # E(A, T; S) Class information entropy of the partition S
        E = ES1w + ES2w

        return E, ES1, ES2

    @classmethod
    def _entropy_discretize_sorted(cls, C, force=False):
        """
        Entropy discretization on a sorted C.

        :param C: (N, K) array of class distributions.

        """
        E, ES1, ES2 = cls._entropy_cuts_sorted(C)
        # TODO: Also get the left right distribution counts from
        # entropy_cuts_sorted,

        # Note the + 1
        if len(E) == 0:
            return []
        cut_index = np.argmin(E) + 1

        # Distribution of classed in S1, S2 and S
        S1_c = np.sum(C[:cut_index], axis=0)
        S2_c = np.sum(C[cut_index:], axis=0)
        S_c = S1_c + S2_c

        ES = cls._entropy1(np.sum(C, axis=0))
        ES1, ES2 = ES1[cut_index - 1], ES2[cut_index - 1]

        # Information gain of the best split
        Gain = ES - E[cut_index - 1]
        # Number of different classes in S, S1 and S2
        k = float(np.sum(S_c > 0))
        k1 = float(np.sum(S1_c > 0))
        k2 = float(np.sum(S2_c > 0))

        assert k > 0
        delta = np.log2(3 ** k - 2) - (k * ES - k1 * ES1 - k2 * ES2)
        N = float(np.sum(S_c))

        if N > 1 and Gain > np.log2(N - 1) / N + delta / N:
            # Accept the cut point and recursively split the subsets.
            left, right = [], []
            if k1 > 1 and cut_index > 1:
                left = cls._entropy_discretize_sorted(C[:cut_index, :])
            if k2 > 1 and cut_index < len(C) - 1:
                right = cls._entropy_discretize_sorted(C[cut_index:, :])
            return left + [cut_index] + [i + cut_index for i in right]
        elif force:
            return [cut_index]
        else:
            return []


class DomainDiscretizer(Reprable):
    """Discretizes all continuous features in the data.

    .. attribute:: method

        Feature discretization method (instance of
        :obj:`Orange.preprocess.Discretization`). If `None` (default),
        :class:`Orange.preprocess.EqualFreq` with 4 intervals is
        used.

    .. attribute:: clean

        If `True`, features discretized into a single interval constant are
        removed. This is useful for discretization methods that infer the
        number of intervals from the data, such as
        :class:`Orange.preprocess.EntropyMDL` (default: `True`).

    .. attribute:: discretize_class

        Determines whether a target is also discretized if it is continuous.
        (default: `False`)
    """
    def __init__(self, discretize_class=False, method=None, clean=True,
                 fixed=None):
        self.discretize_class = discretize_class
        self.method = method
        self.clean = clean
        self.fixed = fixed

    def __call__(self, data, fixed=None):
        """
        Compute and return discretized domain.

        :param data: Data to discretize.
        """

        def transform_list(s, fixed=None):
            new_vars = []
            for var in s:
                if var.is_continuous:
                    if fixed and var.name in fixed.keys():
                        nv = method(data, var, fixed)
                    else:
                        nv = method(data, var)
                    if not self.clean or len(nv.values) > 1:
                        new_vars.append(nv)
                else:
                    new_vars.append(var)
            return new_vars
        if self.method is None:
            method = EqualFreq(n=4)
        else:
            method = self.method
        domain = data.domain
        new_attrs = transform_list(domain.attributes, fixed or self.fixed)
        if self.discretize_class:
            new_classes = transform_list(domain.class_vars)
        else:
            new_classes = domain.class_vars
        return Domain(new_attrs, new_classes)

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user