{
    "file_diffs": [
        {
            "old_file_content": "\"\"\"Widget Settings and Settings Handlers\n\nSettings are used to declare widget attributes that persist through sessions.\nWhen widget is removed or saved to a schema file, its settings are packed,\nserialized and stored. When a new widget is created, values of attributes\nmarked as settings are read from disk. When schema is loaded, attribute values\nare set to one stored in schema.\n\nEach widget has its own SettingsHandler that takes care of serializing and\nstoring of settings and SettingProvider that is incharge of reading and\nwriting the setting values.\n\nAll widgets extending from OWWidget use SettingsHandler, unless they\ndeclare otherwise. SettingsHandler ensures that setting attributes\nare replaced with default (last used) setting values when the widget is\ninitialized and stored when the widget is removed.\n\nWidgets with settings whose values depend on the widget inputs use\nsettings handlers based on ContextHandler. These handlers have two\nadditional methods, open_context and close_context.\n\nopen_context is called when widgets receives new data. It finds a suitable\ncontext and sets the widget attributes to the values stored in context.\nIf no suitable context exists, a new one is created and values from widget\nare copied to it.\n\nclose_context stores values that were last used on the widget to the context\nso they can be used alter. It should be called before widget starts modifying\n(initializing) the value of the setting attributes.\n\"\"\"\n\nimport copy\nimport itertools\nimport logging\nimport warnings\n\nfrom orangewidget.settings import (\n    Setting, SettingProvider, SettingsHandler, ContextSetting,\n    ContextHandler, Context, IncompatibleContext, SettingsPrinter,\n    rename_setting, widget_settings_dir\n)\nfrom orangewidget.settings import _apply_setting\n\nfrom Orange.data import Domain, Variable\nfrom Orange.util import OrangeDeprecationWarning\nfrom Orange.widgets.utils import vartype\n\nlog = logging.getLogger(__name__)\n\n__all__ = [\n    # re-exported from orangewidget.settings\n    \"Setting\", \"SettingsHandler\", \"SettingProvider\",\n    \"ContextSetting\", \"Context\", \"ContextHandler\", \"IncompatibleContext\",\n    \"rename_setting\", \"widget_settings_dir\",\n    # defined here\n    \"DomainContextHandler\", \"PerfectDomainContextHandler\",\n    \"ClassValuesContextHandler\", \"SettingsPrinter\",\n    \"migrate_str_to_variable\",\n]\n\n\nclass DomainContextHandler(ContextHandler):\n    \"\"\"Context handler for widgets with settings that depend on\n    the input dataset. Suitable settings are selected based on the\n    data domain.\"\"\"\n\n    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)\n\n    def __init__(self, *, match_values=0, first_match=True, **kwargs):\n        super().__init__()\n        self.match_values = match_values\n        self.first_match = first_match\n\n        for name in kwargs:\n            warnings.warn(\n                \"{} is not a valid parameter for DomainContextHandler\"\n                .format(name), OrangeDeprecationWarning\n            )\n\n    def encode_domain(self, domain):\n        \"\"\"\n        domain: Orange.data.domain to encode\n        return: dict mapping attribute name to type or list of values\n                (based on the value of self.match_values attribute)\n        \"\"\"\n\n        match = self.match_values\n        encode = self.encode_variables\n        if match == self.MATCH_VALUES_CLASS:\n            attributes = encode(domain.attributes, False)\n            attributes.update(encode(domain.class_vars, True))\n        else:\n            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)\n\n        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)\n\n        return attributes, metas\n\n    @staticmethod\n    def encode_variables(attributes, encode_values):\n        \"\"\"Encode variables to a list mapping name to variable type\n        or a list of values.\"\"\"\n\n        if not encode_values:\n            return {v.name: vartype(v) for v in attributes}\n\n        return {v.name: v.values if v.is_discrete else vartype(v)\n                for v in attributes}\n\n    def new_context(self, domain, attributes, metas):\n        \"\"\"Create a new context.\"\"\"\n        context = super().new_context()\n        context.attributes = attributes\n        context.metas = metas\n        return context\n\n    def open_context(self, widget, domain):\n        if domain is None:\n            return\n        if not isinstance(domain, Domain):\n            domain = domain.domain\n        super().open_context(widget, domain, *self.encode_domain(domain))\n\n    def filter_value(self, setting, data, domain, attrs, metas):\n        value = data.get(setting.name, None)\n        if isinstance(value, list):\n            new_value = [item for item in value\n                         if self.is_valid_item(setting, item, attrs, metas)]\n            data[setting.name] = new_value\n        elif isinstance(value, dict):\n            new_value = {item: val for item, val in value.items()\n                         if self.is_valid_item(setting, item, attrs, metas)}\n            data[setting.name] = new_value\n        elif value is not None:\n            if (value[1] >= 0 and\n                    not self._var_exists(setting, value, attrs, metas)):\n                del data[setting.name]\n\n    def settings_to_widget(self, widget, domain, *args):\n        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:\n        #  - merged, remove this method.\n        #  - rejected, remove this comment.\n        context = widget.current_context\n        if context is None:\n            return\n\n        widget.retrieveSpecificSettings()\n\n        for setting, data, instance in \\\n                self.provider.traverse_settings(data=context.values, instance=widget):\n            if not isinstance(setting, ContextSetting) or setting.name not in data:\n                continue\n\n            value = self.decode_setting(setting, data[setting.name], domain)\n            _apply_setting(setting, instance, value)\n\n    @staticmethod\n    def encode_variable(var):\n        return var.name, 100 + vartype(var)\n\n    @classmethod\n    def encode_setting(cls, context, setting, value):\n        if isinstance(value, list):\n            if all(e is None or isinstance(e, Variable) for e in value) \\\n                    and any(e is not None for e in value):\n                return ([None if e is None else cls.encode_variable(e)\n                         for e in value],\n                        -3)\n            else:\n                return copy.copy(value)\n\n        elif isinstance(value, dict) \\\n                and all(isinstance(e, Variable) for e in value):\n            return ({cls.encode_variable(e): val for e, val in value.items()},\n                    -4)\n\n        if isinstance(value, Variable):\n            if isinstance(setting, ContextSetting):\n                return cls.encode_variable(value)\n            else:\n                raise ValueError(\"Variables must be stored as ContextSettings; \"\n                                 f\"change {setting.name} to ContextSetting.\")\n\n        return copy.copy(value), -2\n\n    def decode_setting(self, setting, value, domain=None, *args):\n        def get_var(name):\n            if domain is None:\n                raise ValueError(\"Cannot decode variable without domain\")\n            return domain[name]\n\n        if isinstance(value, tuple):\n            data, dtype = value\n            if dtype == -3:\n                return[None if name_type is None else get_var(name_type[0])\n                       for name_type in data]\n            if dtype == -4:\n                return {get_var(name): val for (name, _), val in data.items()}\n            if dtype >= 100:\n                return get_var(data)\n            return value[0]\n        else:\n            return value\n\n    @classmethod\n    def _var_exists(cls, setting, value, attributes, metas):\n        if not isinstance(value, tuple) or len(value) != 2:\n            return False\n\n        attr_name, attr_type = value\n        # attr_type used to be either 1-4 for variables stored as string\n        # settings, and 101-104 for variables stored as variables. The former is\n        # no longer supported, but we play it safe and still handle both here.\n        attr_type %= 100\n        return (not setting.exclude_attributes and\n                attributes.get(attr_name, -1) == attr_type or\n                not setting.exclude_metas and\n                metas.get(attr_name, -1) == attr_type)\n\n    def match(self, context, domain, attrs, metas):\n        matches = []\n        try:\n            for setting, data, _ in \\\n                    self.provider.traverse_settings(data=context.values):\n                if not isinstance(setting, ContextSetting):\n                    continue\n                value = data.get(setting.name, None)\n\n                if isinstance(value, list):\n                    matches.append(\n                        self.match_list(setting, value, context, attrs, metas))\n                # type check is a (not foolproof) check in case of a pair that\n                # would, by conincidence, have -3 or -4 as the second element\n                elif isinstance(value, tuple) and len(value) == 2 \\\n                       and (value[1] == -3 and isinstance(value[0], list)\n                            or (value[1] == -4 and isinstance(value[0], dict))):\n                    matches.append(self.match_list(setting, value[0], context,\n                                                   attrs, metas))\n                elif value is not None:\n                    matches.append(\n                        self.match_value(setting, value, attrs, metas))\n        except IncompatibleContext:\n            return self.NO_MATCH\n\n        if self.first_match:\n            return self.MATCH\n\n        matches.append((0, 0))\n        matched, available = [sum(m) for m in zip(*matches)]\n        return matched / available if available else 0.1\n\n    def match_list(self, setting, value, context, attrs, metas):\n        \"\"\"Match a list of values with the given context.\n        returns a tuple containing number of matched and all values.\n        \"\"\"\n        matched = 0\n        for item in value:\n            if self.is_valid_item(setting, item, attrs, metas):\n                matched += 1\n            elif setting.required == ContextSetting.REQUIRED:\n                raise IncompatibleContext()\n        return matched, len(value)\n\n    def match_value(self, setting, value, attrs, metas):\n        \"\"\"Match a single value \"\"\"\n        if value[1] < 0:\n            return 0, 0\n\n        if self._var_exists(setting, value, attrs, metas):\n            return 1, 1\n        elif setting.required == setting.OPTIONAL:\n            return 0, 1\n        else:\n            raise IncompatibleContext()\n\n    def is_valid_item(self, setting, item, attrs, metas):\n        \"\"\"Return True if given item can be used with attrs and metas\n\n        Subclasses can override this method to checks data in alternative\n        representations.\n        \"\"\"\n        if not isinstance(item, tuple):\n            return True\n        return self._var_exists(setting, item, attrs, metas)\n\n\nclass ClassValuesContextHandler(ContextHandler):\n    \"\"\"Context handler used for widgets that work with\n    a single discrete variable\"\"\"\n\n    def open_context(self, widget, classes):\n        if isinstance(classes, Variable):\n            if classes.is_discrete:\n                classes = classes.values\n            else:\n                classes = None\n\n        super().open_context(widget, classes)\n\n    def new_context(self, classes):\n        context = super().new_context()\n        context.classes = classes\n        return context\n\n    def match(self, context, classes):\n        if isinstance(classes, Variable) and classes.is_continuous:\n            return (self.PERFECT_MATCH if context.classes is None\n                    else self.NO_MATCH)\n        else:\n            # variable.values used to be a list, and so were context.classes\n            # cast to tuple for compatibility with past contexts\n            if context.classes is not None and tuple(context.classes) == classes:\n                return self.PERFECT_MATCH\n            else:\n                return self.NO_MATCH\n\n\nclass PerfectDomainContextHandler(DomainContextHandler):\n    \"\"\"Context handler that matches a context only when\n    the same domain is available.\n\n    It uses a different encoding than the DomainContextHandler.\n    \"\"\"\n\n    def new_context(self, domain, attributes, class_vars, metas):\n        \"\"\"Same as DomainContextHandler, but also store class_vars\"\"\"\n        context = super().new_context(domain, attributes, metas)\n        context.class_vars = class_vars\n        return context\n\n    def clone_context(self, old_context, *args):\n        \"\"\"Copy of context is always valid, since widgets are using\n        the same domain.\"\"\"\n        context = self.new_context(*args)\n        context.values = copy.deepcopy(old_context.values)\n        return context\n\n    def encode_domain(self, domain):\n        \"\"\"Encode domain into tuples (name, type)\n        A tuple is returned for each of attributes, class_vars and metas.\n        \"\"\"\n\n        if self.match_values == self.MATCH_VALUES_ALL:\n            def _encode(attrs):\n                return tuple((v.name, list(v.values) if v.is_discrete else vartype(v))\n                             for v in attrs)\n        else:\n            def _encode(attrs):\n                return tuple((v.name, vartype(v)) for v in attrs)\n        return (_encode(domain.attributes),\n                _encode(domain.class_vars),\n                _encode(domain.metas))\n\n    def match(self, context, domain, attributes, class_vars, metas):\n        \"\"\"Context only matches when domains are the same\"\"\"\n\n        return (self.PERFECT_MATCH\n                if (context.attributes == attributes and\n                    context.class_vars == class_vars and\n                    context.metas == metas)\n                else self.NO_MATCH)\n\n    def encode_setting(self, context, setting, value):\n        \"\"\"Same as is domain context handler, but handles separately stored\n        class_vars.\"\"\"\n\n        if isinstance(setting, ContextSetting) and isinstance(value, str):\n\n            def _candidate_variables():\n                if not setting.exclude_attributes:\n                    yield from itertools.chain(context.attributes,\n                                               context.class_vars)\n                if not setting.exclude_metas:\n                    yield from context.metas\n\n            for aname, atype in _candidate_variables():\n                if aname == value:\n                    return value, atype\n\n            return value, -1\n        else:\n            return super().encode_setting(context, setting, value)\n\n\ndef migrate_str_to_variable(settings, names=None, none_placeholder=None):\n    \"\"\"\n    Change variables stored as `(str, int)` to `(Variable, int)`.\n\n    Args:\n        settings (Context): context that is being migrated\n        names (sequence): names of settings to be migrated. If omitted,\n            all settings with values `(str, int)` are migrated.\n    \"\"\"\n    def _fix(name):\n        var, vartype = settings.values[name]\n        if 0 <= vartype <= 100:\n            settings.values[name] = (var, 100 + vartype)\n        elif var == none_placeholder and vartype == -2:\n            settings.values[name] = None\n\n    if names is None:\n        for name, setting in settings.values.items():\n            if isinstance(setting, tuple) and len(setting) == 2 and \\\n                    isinstance(setting[0], str) and isinstance(setting[1], int):\n                _fix(name)\n    elif isinstance(names, str):\n        _fix(names)\n    else:\n        for name in names:\n            _fix(name)\n",
            "new_file_content": "\"\"\"Widget Settings and Settings Handlers\n\nSettings are used to declare widget attributes that persist through sessions.\nWhen widget is removed or saved to a schema file, its settings are packed,\nserialized and stored. When a new widget is created, values of attributes\nmarked as settings are read from disk. When schema is loaded, attribute values\nare set to one stored in schema.\n\nEach widget has its own SettingsHandler that takes care of serializing and\nstoring of settings and SettingProvider that is incharge of reading and\nwriting the setting values.\n\nAll widgets extending from OWWidget use SettingsHandler, unless they\ndeclare otherwise. SettingsHandler ensures that setting attributes\nare replaced with default (last used) setting values when the widget is\ninitialized and stored when the widget is removed.\n\nWidgets with settings whose values depend on the widget inputs use\nsettings handlers based on ContextHandler. These handlers have two\nadditional methods, open_context and close_context.\n\nopen_context is called when widgets receives new data. It finds a suitable\ncontext and sets the widget attributes to the values stored in context.\nIf no suitable context exists, a new one is created and values from widget\nare copied to it.\n\nclose_context stores values that were last used on the widget to the context\nso they can be used alter. It should be called before widget starts modifying\n(initializing) the value of the setting attributes.\n\"\"\"\n\nimport copy\nimport itertools\nimport logging\nimport warnings\n\nfrom orangewidget.settings import (\n    Setting, SettingProvider, SettingsHandler, ContextSetting,\n    ContextHandler, Context, IncompatibleContext, SettingsPrinter,\n    rename_setting, widget_settings_dir\n)\nfrom orangewidget.settings import _apply_setting\n\nfrom Orange.data import Domain, Variable\nfrom Orange.util import OrangeDeprecationWarning\nfrom Orange.widgets.utils import vartype\n\nlog = logging.getLogger(__name__)\n\n__all__ = [\n    # re-exported from orangewidget.settings\n    \"Setting\", \"SettingsHandler\", \"SettingProvider\",\n    \"ContextSetting\", \"Context\", \"ContextHandler\", \"IncompatibleContext\",\n    \"rename_setting\", \"widget_settings_dir\",\n    # defined here\n    \"DomainContextHandler\", \"PerfectDomainContextHandler\",\n    \"ClassValuesContextHandler\", \"SettingsPrinter\",\n    \"migrate_str_to_variable\",\n]\n\n\nclass DomainContextHandler(ContextHandler):\n    \"\"\"Context handler for widgets with settings that depend on\n    the input dataset. Suitable settings are selected based on the\n    data domain.\"\"\"\n\n    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)\n\n    def __init__(self, *, match_values=0, first_match=True, **kwargs):\n        super().__init__()\n        self.match_values = match_values\n        self.first_match = first_match\n\n        for name in kwargs:\n            warnings.warn(\n                \"{} is not a valid parameter for DomainContextHandler\"\n                .format(name), OrangeDeprecationWarning\n            )\n\n    def encode_domain(self, domain):\n        \"\"\"\n        domain: Orange.data.domain to encode\n        return: dict mapping attribute name to type or list of values\n                (based on the value of self.match_values attribute)\n        \"\"\"\n\n        match = self.match_values\n        encode = self.encode_variables\n        if match == self.MATCH_VALUES_CLASS:\n            attributes = encode(domain.attributes, False)\n            attributes.update(encode(domain.class_vars, True))\n        else:\n            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)\n\n        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)\n\n        return attributes, metas\n\n    @staticmethod\n    def encode_variables(attributes, encode_values):\n        \"\"\"Encode variables to a list mapping name to variable type\n        or a list of values.\"\"\"\n\n        if not encode_values:\n            return {v.name: vartype(v) for v in attributes}\n\n        return {v.name: v.values if v.is_discrete else vartype(v)\n                for v in attributes}\n\n    def new_context(self, domain, attributes, metas):\n        \"\"\"Create a new context.\"\"\"\n        context = super().new_context()\n        context.attributes = attributes\n        context.metas = metas\n        return context\n\n    def open_context(self, widget, domain):\n        if domain is None:\n            return\n        if not isinstance(domain, Domain):\n            domain = domain.domain\n        super().open_context(widget, domain, *self.encode_domain(domain))\n\n    def filter_value(self, setting, data, domain, attrs, metas):\n        value = data.get(setting.name, None)\n        if isinstance(value, list):\n            new_value = [item for item in value\n                         if self.is_valid_item(setting, item, attrs, metas)]\n            data[setting.name] = new_value\n        elif isinstance(value, dict):\n            new_value = {item: val for item, val in value.items()\n                         if self.is_valid_item(setting, item, attrs, metas)}\n            data[setting.name] = new_value\n        elif value is not None:\n            if (value[1] >= 0 and\n                    not self._var_exists(setting, value, attrs, metas)):\n                del data[setting.name]\n\n    def settings_to_widget(self, widget, domain, *args):\n        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:\n        #  - merged, remove this method.\n        #  - rejected, remove this comment.\n        context = widget.current_context\n        if context is None:\n            return\n\n        widget.retrieveSpecificSettings()\n\n        for setting, data, instance in \\\n                self.provider.traverse_settings(data=context.values, instance=widget):\n            if not isinstance(setting, ContextSetting) or setting.name not in data:\n                continue\n\n            value = self.decode_setting(setting, data[setting.name], domain)\n            _apply_setting(setting, instance, value)\n\n    @staticmethod\n    def encode_variable(var):\n        return var.name, 100 + vartype(var)\n\n    @classmethod\n    def encode_setting(cls, context, setting, value):\n        if isinstance(value, list):\n            if all(e is None or isinstance(e, Variable) for e in value) \\\n                    and any(e is not None for e in value):\n                return ([None if e is None else cls.encode_variable(e)\n                         for e in value],\n                        -3)\n            else:\n                return copy.copy(value)\n\n        elif isinstance(value, dict) \\\n                and all(isinstance(e, Variable) for e in value):\n            return ({cls.encode_variable(e): val for e, val in value.items()},\n                    -4)\n\n        if isinstance(value, Variable):\n            if isinstance(setting, ContextSetting):\n                return cls.encode_variable(value)\n            else:\n                raise ValueError(\"Variables must be stored as ContextSettings; \"\n                                 f\"change {setting.name} to ContextSetting.\")\n\n        return copy.copy(value), -2\n\n    def decode_setting(self, setting, value, domain=None, *args):\n        def get_var(name):\n            if domain is None:\n                raise ValueError(\"Cannot decode variable without domain\")\n            return domain[name]\n\n        if isinstance(value, tuple):\n            data, dtype = value\n            if dtype == -3:\n                return[None if name_type is None else get_var(name_type[0])\n                       for name_type in data]\n            if dtype == -4:\n                return {get_var(name): val for (name, _), val in data.items()}\n            if dtype >= 100:\n                return get_var(data)\n            return value[0]\n        else:\n            return value\n\n    @classmethod\n    def _var_exists(cls, setting, value, attributes, metas):\n        if not isinstance(value, tuple) or len(value) != 2:\n            return False\n\n        attr_name, attr_type = value\n        # attr_type used to be either 1-4 for variables stored as string\n        # settings, and 101-104 for variables stored as variables. The former is\n        # no longer supported, but we play it safe and still handle both here.\n        attr_type %= 100\n        return (not setting.exclude_attributes and\n                attributes.get(attr_name, -1) == attr_type or\n                not setting.exclude_metas and\n                metas.get(attr_name, -1) == attr_type)\n\n    def match(self, context, domain, attrs, metas):\n        matches = []\n        try:\n            for setting, data, _ in \\\n                    self.provider.traverse_settings(data=context.values):\n                if not isinstance(setting, ContextSetting):\n                    continue\n                value = data.get(setting.name, None)\n\n                if isinstance(value, list):\n                    matches.append(\n                        self.match_list(setting, value, context, attrs, metas))\n                # type check is a (not foolproof) check in case of a pair that\n                # would, by conincidence, have -3 or -4 as the second element\n                elif isinstance(value, tuple) and len(value) == 2 \\\n                       and (value[1] == -3 and isinstance(value[0], list)\n                            or (value[1] == -4 and isinstance(value[0], dict))):\n                    matches.append(self.match_list(setting, value[0], context,\n                                                   attrs, metas))\n                elif value is not None:\n                    matches.append(\n                        self.match_value(setting, value, attrs, metas))\n        except IncompatibleContext:\n            return self.NO_MATCH\n\n        if self.first_match and matches and sum(m[0] for m in matches):\n            return self.MATCH\n\n        matches.append((0, 0))\n        matched, available = [sum(m) for m in zip(*matches)]\n        return matched / available if available else 0.1\n\n    def match_list(self, setting, value, context, attrs, metas):\n        \"\"\"Match a list of values with the given context.\n        returns a tuple containing number of matched and all values.\n        \"\"\"\n        matched = 0\n        for item in value:\n            if self.is_valid_item(setting, item, attrs, metas):\n                matched += 1\n            elif setting.required == ContextSetting.REQUIRED:\n                raise IncompatibleContext()\n        return matched, len(value)\n\n    def match_value(self, setting, value, attrs, metas):\n        \"\"\"Match a single value \"\"\"\n        if value[1] < 0:\n            return 0, 0\n\n        if self._var_exists(setting, value, attrs, metas):\n            return 1, 1\n        elif setting.required == setting.OPTIONAL:\n            return 0, 1\n        else:\n            raise IncompatibleContext()\n\n    def is_valid_item(self, setting, item, attrs, metas):\n        \"\"\"Return True if given item can be used with attrs and metas\n\n        Subclasses can override this method to checks data in alternative\n        representations.\n        \"\"\"\n        if not isinstance(item, tuple):\n            return True\n        return self._var_exists(setting, item, attrs, metas)\n\n\nclass ClassValuesContextHandler(ContextHandler):\n    \"\"\"Context handler used for widgets that work with\n    a single discrete variable\"\"\"\n\n    def open_context(self, widget, classes):\n        if isinstance(classes, Variable):\n            if classes.is_discrete:\n                classes = classes.values\n            else:\n                classes = None\n\n        super().open_context(widget, classes)\n\n    def new_context(self, classes):\n        context = super().new_context()\n        context.classes = classes\n        return context\n\n    def match(self, context, classes):\n        if isinstance(classes, Variable) and classes.is_continuous:\n            return (self.PERFECT_MATCH if context.classes is None\n                    else self.NO_MATCH)\n        else:\n            # variable.values used to be a list, and so were context.classes\n            # cast to tuple for compatibility with past contexts\n            if context.classes is not None and tuple(context.classes) == classes:\n                return self.PERFECT_MATCH\n            else:\n                return self.NO_MATCH\n\n\nclass PerfectDomainContextHandler(DomainContextHandler):\n    \"\"\"Context handler that matches a context only when\n    the same domain is available.\n\n    It uses a different encoding than the DomainContextHandler.\n    \"\"\"\n\n    def new_context(self, domain, attributes, class_vars, metas):\n        \"\"\"Same as DomainContextHandler, but also store class_vars\"\"\"\n        context = super().new_context(domain, attributes, metas)\n        context.class_vars = class_vars\n        return context\n\n    def clone_context(self, old_context, *args):\n        \"\"\"Copy of context is always valid, since widgets are using\n        the same domain.\"\"\"\n        context = self.new_context(*args)\n        context.values = copy.deepcopy(old_context.values)\n        return context\n\n    def encode_domain(self, domain):\n        \"\"\"Encode domain into tuples (name, type)\n        A tuple is returned for each of attributes, class_vars and metas.\n        \"\"\"\n\n        if self.match_values == self.MATCH_VALUES_ALL:\n            def _encode(attrs):\n                return tuple((v.name, list(v.values) if v.is_discrete else vartype(v))\n                             for v in attrs)\n        else:\n            def _encode(attrs):\n                return tuple((v.name, vartype(v)) for v in attrs)\n        return (_encode(domain.attributes),\n                _encode(domain.class_vars),\n                _encode(domain.metas))\n\n    def match(self, context, domain, attributes, class_vars, metas):\n        \"\"\"Context only matches when domains are the same\"\"\"\n\n        return (self.PERFECT_MATCH\n                if (context.attributes == attributes and\n                    context.class_vars == class_vars and\n                    context.metas == metas)\n                else self.NO_MATCH)\n\n    def encode_setting(self, context, setting, value):\n        \"\"\"Same as is domain context handler, but handles separately stored\n        class_vars.\"\"\"\n\n        if isinstance(setting, ContextSetting) and isinstance(value, str):\n\n            def _candidate_variables():\n                if not setting.exclude_attributes:\n                    yield from itertools.chain(context.attributes,\n                                               context.class_vars)\n                if not setting.exclude_metas:\n                    yield from context.metas\n\n            for aname, atype in _candidate_variables():\n                if aname == value:\n                    return value, atype\n\n            return value, -1\n        else:\n            return super().encode_setting(context, setting, value)\n\n\ndef migrate_str_to_variable(settings, names=None, none_placeholder=None):\n    \"\"\"\n    Change variables stored as `(str, int)` to `(Variable, int)`.\n\n    Args:\n        settings (Context): context that is being migrated\n        names (sequence): names of settings to be migrated. If omitted,\n            all settings with values `(str, int)` are migrated.\n    \"\"\"\n    def _fix(name):\n        var, vartype = settings.values[name]\n        if 0 <= vartype <= 100:\n            settings.values[name] = (var, 100 + vartype)\n        elif var == none_placeholder and vartype == -2:\n            settings.values[name] = None\n\n    if names is None:\n        for name, setting in settings.values.items():\n            if isinstance(setting, tuple) and len(setting) == 2 and \\\n                    isinstance(setting[0], str) and isinstance(setting[1], int):\n                _fix(name)\n    elif isinstance(names, str):\n        _fix(names)\n    else:\n        for name in names:\n            _fix(name)\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/settings.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "03f361517",
                "new_commit_hash": "24dfb5f01",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/settings.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/settings.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 242,
                            "length": 7
                        },
                        "new_range": {
                            "start": 242,
                            "length": 7
                        },
                        "section": "class DomainContextHandler(ContextHandler):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        except IncompatibleContext:",
                                "type": "context"
                            },
                            {
                                "content": "            return self.NO_MATCH",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        if self.first_match:",
                                "type": "deleted"
                            },
                            {
                                "content": "        if self.first_match and matches and sum(m[0] for m in matches):",
                                "type": "added"
                            },
                            {
                                "content": "            return self.MATCH",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        matches.append((0, 0))",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/settings.py",
                            "type": "method",
                            "name": "DomainContextHandler.match",
                            "content": "class DomainContextHandler(ContextHandler):\n    \"\"\"Context handler for widgets with settings that depend on\n    the input dataset. Suitable settings are selected based on the\n    data domain.\"\"\"\n\n    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)\n\n    def __init__(self, *, match_values=0, first_match=True, **kwargs):\n        super().__init__()\n        self.match_values = match_values\n        self.first_match = first_match\n\n        for name in kwargs:\n            warnings.warn(\n                \"{} is not a valid parameter for DomainContextHandler\"\n                .format(name), OrangeDeprecationWarning\n            )\n\n    def encode_domain(self, domain):\n        \"\"\"\n        domain: Orange.data.domain to encode\n        return: dict mapping attribute name to type or list of values\n                (based on the value of self.match_values attribute)\n        \"\"\"\n\n        match = self.match_values\n        encode = self.encode_variables\n        if match == self.MATCH_VALUES_CLASS:\n            attributes = encode(domain.attributes, False)\n            attributes.update(encode(domain.class_vars, True))\n        else:\n            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)\n\n        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)\n\n        return attributes, metas\n\n    @staticmethod\n    def encode_variables(attributes, encode_values):\n        \"\"\"Encode variables to a list mapping name to variable type\n        or a list of values.\"\"\"\n\n        if not encode_values:\n            return {v.name: vartype(v) for v in attributes}\n\n        return {v.name: v.values if v.is_discrete else vartype(v)\n                for v in attributes}\n\n    def new_context(self, domain, attributes, metas):\n        \"\"\"Create a new context.\"\"\"\n        context = super().new_context()\n        context.attributes = attributes\n        context.metas = metas\n        return context\n\n    def open_context(self, widget, domain):\n        if domain is None:\n            return\n        if not isinstance(domain, Domain):\n            domain = domain.domain\n        super().open_context(widget, domain, *self.encode_domain(domain))\n\n    def filter_value(self, setting, data, domain, attrs, metas):\n        value = data.get(setting.name, None)\n        if isinstance(value, list):\n            new_value = [item for item in value\n                         if self.is_valid_item(setting, item, attrs, metas)]\n            data[setting.name] = new_value\n        elif isinstance(value, dict):\n            new_value = {item: val for item, val in value.items()\n                         if self.is_valid_item(setting, item, attrs, metas)}\n            data[setting.name] = new_value\n        elif value is not None:\n            if (value[1] >= 0 and\n                    not self._var_exists(setting, value, attrs, metas)):\n                del data[setting.name]\n\n    def settings_to_widget(self, widget, domain, *args):\n        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:\n        #  - merged, remove this method.\n        #  - rejected, remove this comment.\n        context = widget.current_context\n        if context is None:\n            return\n\n        widget.retrieveSpecificSettings()\n\n        for setting, data, instance in \\\n                self.provider.traverse_settings(data=context.values, instance=widget):\n            if not isinstance(setting, ContextSetting) or setting.name not in data:\n                continue\n\n            value = self.decode_setting(setting, data[setting.name], domain)\n            _apply_setting(setting, instance, value)\n\n    @staticmethod\n    def encode_variable(var):\n        return var.name, 100 + vartype(var)\n\n    @classmethod\n    def encode_setting(cls, context, setting, value):\n        if isinstance(value, list):\n            if all(e is None or isinstance(e, Variable) for e in value) \\\n                    and any(e is not None for e in value):\n                return ([None if e is None else cls.encode_variable(e)\n                         for e in value],\n                        -3)\n            else:\n                return copy.copy(value)\n\n        elif isinstance(value, dict) \\\n                and all(isinstance(e, Variable) for e in value):\n            return ({cls.encode_variable(e): val for e, val in value.items()},\n                    -4)\n\n        if isinstance(value, Variable):\n            if isinstance(setting, ContextSetting):\n                return cls.encode_variable(value)\n            else:\n                raise ValueError(\"Variables must be stored as ContextSettings; \"\n                                 f\"change {setting.name} to ContextSetting.\")\n\n        return copy.copy(value), -2\n\n    def decode_setting(self, setting, value, domain=None, *args):\n        def get_var(name):\n            if domain is None:\n                raise ValueError(\"Cannot decode variable without domain\")\n            return domain[name]\n\n        if isinstance(value, tuple):\n            data, dtype = value\n            if dtype == -3:\n                return[None if name_type is None else get_var(name_type[0])\n                       for name_type in data]\n            if dtype == -4:\n                return {get_var(name): val for (name, _), val in data.items()}\n            if dtype >= 100:\n                return get_var(data)\n            return value[0]\n        else:\n            return value\n\n    @classmethod\n    def _var_exists(cls, setting, value, attributes, metas):\n        if not isinstance(value, tuple) or len(value) != 2:\n            return False\n\n        attr_name, attr_type = value\n        # attr_type used to be either 1-4 for variables stored as string\n        # settings, and 101-104 for variables stored as variables. The former is\n        # no longer supported, but we play it safe and still handle both here.\n        attr_type %= 100\n        return (not setting.exclude_attributes and\n                attributes.get(attr_name, -1) == attr_type or\n                not setting.exclude_metas and\n                metas.get(attr_name, -1) == attr_type)\n\n    def match(self, context, domain, attrs, metas):\n        matches = []\n        try:\n            for setting, data, _ in \\\n                    self.provider.traverse_settings(data=context.values):\n                if not isinstance(setting, ContextSetting):\n                    continue\n                value = data.get(setting.name, None)\n\n                if isinstance(value, list):\n                    matches.append(\n                        self.match_list(setting, value, context, attrs, metas))\n                # type check is a (not foolproof) check in case of a pair that\n                # would, by conincidence, have -3 or -4 as the second element\n                elif isinstance(value, tuple) and len(value) == 2 \\\n                       and (value[1] == -3 and isinstance(value[0], list)\n                            or (value[1] == -4 and isinstance(value[0], dict))):\n                    matches.append(self.match_list(setting, value[0], context,\n                                                   attrs, metas))\n                elif value is not None:\n                    matches.append(\n                        self.match_value(setting, value, attrs, metas))\n        except IncompatibleContext:\n            return self.NO_MATCH\n\n        if self.first_match:\n            return self.MATCH\n\n        matches.append((0, 0))\n        matched, available = [sum(m) for m in zip(*matches)]\n        return matched / available if available else 0.1\n\n    def match_list(self, setting, value, context, attrs, metas):\n        \"\"\"Match a list of values with the given context.\n        returns a tuple containing number of matched and all values.\n        \"\"\"\n        matched = 0\n        for item in value:\n            if self.is_valid_item(setting, item, attrs, metas):\n                matched += 1\n            elif setting.required == ContextSetting.REQUIRED:\n                raise IncompatibleContext()\n        return matched, len(value)\n\n    def match_value(self, setting, value, attrs, metas):\n        \"\"\"Match a single value \"\"\"\n        if value[1] < 0:\n            return 0, 0\n\n        if self._var_exists(setting, value, attrs, metas):\n            return 1, 1\n        elif setting.required == setting.OPTIONAL:\n            return 0, 1\n        else:\n            raise IncompatibleContext()\n\n    def is_valid_item(self, setting, item, attrs, metas):\n        \"\"\"Return True if given item can be used with attrs and metas\n\n        Subclasses can override this method to checks data in alternative\n        representations.\n        \"\"\"\n        if not isinstance(item, tuple):\n            return True\n        return self._var_exists(setting, item, attrs, metas)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 220,
                            "end_lineno": 250,
                            "parent": {
                                "file_name": "Orange/widgets/settings.py",
                                "type": "class",
                                "name": "DomainContextHandler",
                                "content": "class DomainContextHandler(ContextHandler):\n    \"\"\"Context handler for widgets with settings that depend on\n    the input dataset. Suitable settings are selected based on the\n    data domain.\"\"\"\n\n    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)\n\n    def __init__(self, *, match_values=0, first_match=True, **kwargs):\n        super().__init__()\n        self.match_values = match_values\n        self.first_match = first_match\n\n        for name in kwargs:\n            warnings.warn(\n                \"{} is not a valid parameter for DomainContextHandler\"\n                .format(name), OrangeDeprecationWarning\n            )\n\n    def encode_domain(self, domain):\n        \"\"\"\n        domain: Orange.data.domain to encode\n        return: dict mapping attribute name to type or list of values\n                (based on the value of self.match_values attribute)\n        \"\"\"\n\n        match = self.match_values\n        encode = self.encode_variables\n        if match == self.MATCH_VALUES_CLASS:\n            attributes = encode(domain.attributes, False)\n            attributes.update(encode(domain.class_vars, True))\n        else:\n            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)\n\n        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)\n\n        return attributes, metas\n\n    @staticmethod\n    def encode_variables(attributes, encode_values):\n        \"\"\"Encode variables to a list mapping name to variable type\n        or a list of values.\"\"\"\n\n        if not encode_values:\n            return {v.name: vartype(v) for v in attributes}\n\n        return {v.name: v.values if v.is_discrete else vartype(v)\n                for v in attributes}\n\n    def new_context(self, domain, attributes, metas):\n        \"\"\"Create a new context.\"\"\"\n        context = super().new_context()\n        context.attributes = attributes\n        context.metas = metas\n        return context\n\n    def open_context(self, widget, domain):\n        if domain is None:\n            return\n        if not isinstance(domain, Domain):\n            domain = domain.domain\n        super().open_context(widget, domain, *self.encode_domain(domain))\n\n    def filter_value(self, setting, data, domain, attrs, metas):\n        value = data.get(setting.name, None)\n        if isinstance(value, list):\n            new_value = [item for item in value\n                         if self.is_valid_item(setting, item, attrs, metas)]\n            data[setting.name] = new_value\n        elif isinstance(value, dict):\n            new_value = {item: val for item, val in value.items()\n                         if self.is_valid_item(setting, item, attrs, metas)}\n            data[setting.name] = new_value\n        elif value is not None:\n            if (value[1] >= 0 and\n                    not self._var_exists(setting, value, attrs, metas)):\n                del data[setting.name]\n\n    def settings_to_widget(self, widget, domain, *args):\n        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:\n        #  - merged, remove this method.\n        #  - rejected, remove this comment.\n        context = widget.current_context\n        if context is None:\n            return\n\n        widget.retrieveSpecificSettings()\n\n        for setting, data, instance in \\\n                self.provider.traverse_settings(data=context.values, instance=widget):\n            if not isinstance(setting, ContextSetting) or setting.name not in data:\n                continue\n\n            value = self.decode_setting(setting, data[setting.name], domain)\n            _apply_setting(setting, instance, value)\n\n    @staticmethod\n    def encode_variable(var):\n        return var.name, 100 + vartype(var)\n\n    @classmethod\n    def encode_setting(cls, context, setting, value):\n        if isinstance(value, list):\n            if all(e is None or isinstance(e, Variable) for e in value) \\\n                    and any(e is not None for e in value):\n                return ([None if e is None else cls.encode_variable(e)\n                         for e in value],\n                        -3)\n            else:\n                return copy.copy(value)\n\n        elif isinstance(value, dict) \\\n                and all(isinstance(e, Variable) for e in value):\n            return ({cls.encode_variable(e): val for e, val in value.items()},\n                    -4)\n\n        if isinstance(value, Variable):\n            if isinstance(setting, ContextSetting):\n                return cls.encode_variable(value)\n            else:\n                raise ValueError(\"Variables must be stored as ContextSettings; \"\n                                 f\"change {setting.name} to ContextSetting.\")\n\n        return copy.copy(value), -2\n\n    def decode_setting(self, setting, value, domain=None, *args):\n        def get_var(name):\n            if domain is None:\n                raise ValueError(\"Cannot decode variable without domain\")\n            return domain[name]\n\n        if isinstance(value, tuple):\n            data, dtype = value\n            if dtype == -3:\n                return[None if name_type is None else get_var(name_type[0])\n                       for name_type in data]\n            if dtype == -4:\n                return {get_var(name): val for (name, _), val in data.items()}\n            if dtype >= 100:\n                return get_var(data)\n            return value[0]\n        else:\n            return value\n\n    @classmethod\n    def _var_exists(cls, setting, value, attributes, metas):\n        if not isinstance(value, tuple) or len(value) != 2:\n            return False\n\n        attr_name, attr_type = value\n        # attr_type used to be either 1-4 for variables stored as string\n        # settings, and 101-104 for variables stored as variables. The former is\n        # no longer supported, but we play it safe and still handle both here.\n        attr_type %= 100\n        return (not setting.exclude_attributes and\n                attributes.get(attr_name, -1) == attr_type or\n                not setting.exclude_metas and\n                metas.get(attr_name, -1) == attr_type)\n\n    def match(self, context, domain, attrs, metas):\n        matches = []\n        try:\n            for setting, data, _ in \\\n                    self.provider.traverse_settings(data=context.values):\n                if not isinstance(setting, ContextSetting):\n                    continue\n                value = data.get(setting.name, None)\n\n                if isinstance(value, list):\n                    matches.append(\n                        self.match_list(setting, value, context, attrs, metas))\n                # type check is a (not foolproof) check in case of a pair that\n                # would, by conincidence, have -3 or -4 as the second element\n                elif isinstance(value, tuple) and len(value) == 2 \\\n                       and (value[1] == -3 and isinstance(value[0], list)\n                            or (value[1] == -4 and isinstance(value[0], dict))):\n                    matches.append(self.match_list(setting, value[0], context,\n                                                   attrs, metas))\n                elif value is not None:\n                    matches.append(\n                        self.match_value(setting, value, attrs, metas))\n        except IncompatibleContext:\n            return self.NO_MATCH\n\n        if self.first_match:\n            return self.MATCH\n\n        matches.append((0, 0))\n        matched, available = [sum(m) for m in zip(*matches)]\n        return matched / available if available else 0.1\n\n    def match_list(self, setting, value, context, attrs, metas):\n        \"\"\"Match a list of values with the given context.\n        returns a tuple containing number of matched and all values.\n        \"\"\"\n        matched = 0\n        for item in value:\n            if self.is_valid_item(setting, item, attrs, metas):\n                matched += 1\n            elif setting.required == ContextSetting.REQUIRED:\n                raise IncompatibleContext()\n        return matched, len(value)\n\n    def match_value(self, setting, value, attrs, metas):\n        \"\"\"Match a single value \"\"\"\n        if value[1] < 0:\n            return 0, 0\n\n        if self._var_exists(setting, value, attrs, metas):\n            return 1, 1\n        elif setting.required == setting.OPTIONAL:\n            return 0, 1\n        else:\n            raise IncompatibleContext()\n\n    def is_valid_item(self, setting, item, attrs, metas):\n        \"\"\"Return True if given item can be used with attrs and metas\n\n        Subclasses can override this method to checks data in alternative\n        representations.\n        \"\"\"\n        if not isinstance(item, tuple):\n            return True\n        return self._var_exists(setting, item, attrs, metas)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 62,
                                "end_lineno": 284,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/settings.py",
                            "type": "class",
                            "name": "DomainContextHandler",
                            "content": "class DomainContextHandler(ContextHandler):\n    \"\"\"Context handler for widgets with settings that depend on\n    the input dataset. Suitable settings are selected based on the\n    data domain.\"\"\"\n\n    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)\n\n    def __init__(self, *, match_values=0, first_match=True, **kwargs):\n        super().__init__()\n        self.match_values = match_values\n        self.first_match = first_match\n\n        for name in kwargs:\n            warnings.warn(\n                \"{} is not a valid parameter for DomainContextHandler\"\n                .format(name), OrangeDeprecationWarning\n            )\n\n    def encode_domain(self, domain):\n        \"\"\"\n        domain: Orange.data.domain to encode\n        return: dict mapping attribute name to type or list of values\n                (based on the value of self.match_values attribute)\n        \"\"\"\n\n        match = self.match_values\n        encode = self.encode_variables\n        if match == self.MATCH_VALUES_CLASS:\n            attributes = encode(domain.attributes, False)\n            attributes.update(encode(domain.class_vars, True))\n        else:\n            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)\n\n        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)\n\n        return attributes, metas\n\n    @staticmethod\n    def encode_variables(attributes, encode_values):\n        \"\"\"Encode variables to a list mapping name to variable type\n        or a list of values.\"\"\"\n\n        if not encode_values:\n            return {v.name: vartype(v) for v in attributes}\n\n        return {v.name: v.values if v.is_discrete else vartype(v)\n                for v in attributes}\n\n    def new_context(self, domain, attributes, metas):\n        \"\"\"Create a new context.\"\"\"\n        context = super().new_context()\n        context.attributes = attributes\n        context.metas = metas\n        return context\n\n    def open_context(self, widget, domain):\n        if domain is None:\n            return\n        if not isinstance(domain, Domain):\n            domain = domain.domain\n        super().open_context(widget, domain, *self.encode_domain(domain))\n\n    def filter_value(self, setting, data, domain, attrs, metas):\n        value = data.get(setting.name, None)\n        if isinstance(value, list):\n            new_value = [item for item in value\n                         if self.is_valid_item(setting, item, attrs, metas)]\n            data[setting.name] = new_value\n        elif isinstance(value, dict):\n            new_value = {item: val for item, val in value.items()\n                         if self.is_valid_item(setting, item, attrs, metas)}\n            data[setting.name] = new_value\n        elif value is not None:\n            if (value[1] >= 0 and\n                    not self._var_exists(setting, value, attrs, metas)):\n                del data[setting.name]\n\n    def settings_to_widget(self, widget, domain, *args):\n        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:\n        #  - merged, remove this method.\n        #  - rejected, remove this comment.\n        context = widget.current_context\n        if context is None:\n            return\n\n        widget.retrieveSpecificSettings()\n\n        for setting, data, instance in \\\n                self.provider.traverse_settings(data=context.values, instance=widget):\n            if not isinstance(setting, ContextSetting) or setting.name not in data:\n                continue\n\n            value = self.decode_setting(setting, data[setting.name], domain)\n            _apply_setting(setting, instance, value)\n\n    @staticmethod\n    def encode_variable(var):\n        return var.name, 100 + vartype(var)\n\n    @classmethod\n    def encode_setting(cls, context, setting, value):\n        if isinstance(value, list):\n            if all(e is None or isinstance(e, Variable) for e in value) \\\n                    and any(e is not None for e in value):\n                return ([None if e is None else cls.encode_variable(e)\n                         for e in value],\n                        -3)\n            else:\n                return copy.copy(value)\n\n        elif isinstance(value, dict) \\\n                and all(isinstance(e, Variable) for e in value):\n            return ({cls.encode_variable(e): val for e, val in value.items()},\n                    -4)\n\n        if isinstance(value, Variable):\n            if isinstance(setting, ContextSetting):\n                return cls.encode_variable(value)\n            else:\n                raise ValueError(\"Variables must be stored as ContextSettings; \"\n                                 f\"change {setting.name} to ContextSetting.\")\n\n        return copy.copy(value), -2\n\n    def decode_setting(self, setting, value, domain=None, *args):\n        def get_var(name):\n            if domain is None:\n                raise ValueError(\"Cannot decode variable without domain\")\n            return domain[name]\n\n        if isinstance(value, tuple):\n            data, dtype = value\n            if dtype == -3:\n                return[None if name_type is None else get_var(name_type[0])\n                       for name_type in data]\n            if dtype == -4:\n                return {get_var(name): val for (name, _), val in data.items()}\n            if dtype >= 100:\n                return get_var(data)\n            return value[0]\n        else:\n            return value\n\n    @classmethod\n    def _var_exists(cls, setting, value, attributes, metas):\n        if not isinstance(value, tuple) or len(value) != 2:\n            return False\n\n        attr_name, attr_type = value\n        # attr_type used to be either 1-4 for variables stored as string\n        # settings, and 101-104 for variables stored as variables. The former is\n        # no longer supported, but we play it safe and still handle both here.\n        attr_type %= 100\n        return (not setting.exclude_attributes and\n                attributes.get(attr_name, -1) == attr_type or\n                not setting.exclude_metas and\n                metas.get(attr_name, -1) == attr_type)\n\n    def match(self, context, domain, attrs, metas):\n        matches = []\n        try:\n            for setting, data, _ in \\\n                    self.provider.traverse_settings(data=context.values):\n                if not isinstance(setting, ContextSetting):\n                    continue\n                value = data.get(setting.name, None)\n\n                if isinstance(value, list):\n                    matches.append(\n                        self.match_list(setting, value, context, attrs, metas))\n                # type check is a (not foolproof) check in case of a pair that\n                # would, by conincidence, have -3 or -4 as the second element\n                elif isinstance(value, tuple) and len(value) == 2 \\\n                       and (value[1] == -3 and isinstance(value[0], list)\n                            or (value[1] == -4 and isinstance(value[0], dict))):\n                    matches.append(self.match_list(setting, value[0], context,\n                                                   attrs, metas))\n                elif value is not None:\n                    matches.append(\n                        self.match_value(setting, value, attrs, metas))\n        except IncompatibleContext:\n            return self.NO_MATCH\n\n        if self.first_match:\n            return self.MATCH\n\n        matches.append((0, 0))\n        matched, available = [sum(m) for m in zip(*matches)]\n        return matched / available if available else 0.1\n\n    def match_list(self, setting, value, context, attrs, metas):\n        \"\"\"Match a list of values with the given context.\n        returns a tuple containing number of matched and all values.\n        \"\"\"\n        matched = 0\n        for item in value:\n            if self.is_valid_item(setting, item, attrs, metas):\n                matched += 1\n            elif setting.required == ContextSetting.REQUIRED:\n                raise IncompatibleContext()\n        return matched, len(value)\n\n    def match_value(self, setting, value, attrs, metas):\n        \"\"\"Match a single value \"\"\"\n        if value[1] < 0:\n            return 0, 0\n\n        if self._var_exists(setting, value, attrs, metas):\n            return 1, 1\n        elif setting.required == setting.OPTIONAL:\n            return 0, 1\n        else:\n            raise IncompatibleContext()\n\n    def is_valid_item(self, setting, item, attrs, metas):\n        \"\"\"Return True if given item can be used with attrs and metas\n\n        Subclasses can override this method to checks data in alternative\n        representations.\n        \"\"\"\n        if not isinstance(item, tuple):\n            return True\n        return self._var_exists(setting, item, attrs, metas)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 62,
                            "end_lineno": 284,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import warnings\nfrom unittest import TestCase\nfrom unittest.mock import Mock\n\nfrom Orange.data import Domain, DiscreteVariable\nfrom Orange.data import ContinuousVariable\nfrom Orange.util import OrangeDeprecationWarning\nfrom Orange.widgets.settings import DomainContextHandler, ContextSetting\nfrom Orange.widgets.utils import vartype\n\nContinuous = 100 + vartype(ContinuousVariable(\"x\"))\nDiscrete = 100 + vartype(DiscreteVariable(\"x\"))\n\n\nclass TestDomainContextHandler(TestCase):\n    def setUp(self):\n        self.domain = Domain(\n            attributes=[ContinuousVariable('c1'),\n                        DiscreteVariable('d1', values='abc'),\n                        DiscreteVariable('d2', values='def')],\n            class_vars=[DiscreteVariable('d3', values='ghi')],\n            metas=[ContinuousVariable('c2'),\n                   DiscreteVariable('d4', values='jkl')]\n        )\n        self.args = (self.domain,\n                     {'c1': Continuous - 100, 'd1': Discrete - 100,\n                      'd2': Discrete - 100, 'd3': Discrete - 100},\n                     {'c2': Continuous - 100, 'd4': Discrete - 100, })\n        self.handler = DomainContextHandler()\n        self.handler.read_defaults = lambda: None\n\n    def test_encode_domain_with_match_none(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_NONE)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100, 'd3': Discrete - 100})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100, })\n\n    def test_encode_domain_with_match_class(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_CLASS)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100,\n                          'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100})\n\n    def test_encode_domain_with_match_all(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_ALL)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': tuple('abc'),\n                          'd2': tuple('def'), 'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': tuple('jkl')})\n\n    def test_match_returns_1_if_everything_matches(self):\n        self.handler.bind(SimpleWidget)\n\n        # Attributes in values\n        context = Mock(values=dict(\n            with_metas=('d1', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in values\n        context = Mock(values=dict(\n            with_metas=('d4', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Attributes in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d1\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d4\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n\n        context = Mock(values={})\n        self.assertEqual(1, self.handler.match(context, *self.args))\n\n    def test_match_returns_zero_on_incompatible_context(self):\n        self.handler.bind(SimpleWidget)\n\n        # required\n        context = Mock(values=dict(required=('u', Discrete),\n                                   with_metas=('d1', Discrete)))\n        self.assertEqual(0, self.handler.match(context, *self.args))\n\n    def test_clone_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)],\n            required=('u', Continuous)\n        ))\n\n        new_values = self.handler.clone_context(context, *self.args).values\n\n        self.assertEqual(new_values['text'], ('u', -2))\n        self.assertEqual([('d1', Discrete), ('c1', Continuous)],\n                         new_values['with_metas'])\n        self.assertNotIn('required', new_values)\n\n    def test_open_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d2', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        old_metas_list = widget.with_metas\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertIs(old_metas_list, widget.with_metas)\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('d2', Discrete)])\n\n    def test_open_context_with_imperfect_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_not_first_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [Mock(values={}), context, Mock(values={})]\n        self.handler.first_match = False\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_with_no_match(self):\n        self.handler.bind(SimpleWidget)\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        widget.text = 'u'\n\n        self.handler.open_context(widget, self.args[0])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [])\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertEqual(context.values['text'], ('u', -2))\n\n    def test_filter_value(self):\n        setting = ContextSetting([])\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter([], [])\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter([(\"d1\", Discrete), (\"d1\", Continuous),\n                     (\"c1\", Continuous), (\"c1\", Discrete)],\n                    [(\"d1\", Discrete), (\"c1\", Continuous)])\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_filter_value_dict(self):\n        setting = ContextSetting({})\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter({}, {})\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter({(\"d1\", Discrete): 1, (\"d1\", Continuous): 2,\n                     (\"c1\", Continuous): 3, (\"c1\", Discrete): 4},\n                    {(\"d1\", Discrete): 1, (\"c1\", Continuous): 3})\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_encode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n        # Should not crash on anonymous variables\n        with self.assertWarns(OrangeDeprecationWarning):\n            var = ContinuousVariable()\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n    def test_encode_list_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, [None, var1, var2])\n        self.assertEqual(\n            val,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3))\n\n        a_list = [1, 2, 3]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [1, 2, 3])\n        self.assertIsNot(val, a_list)\n\n        a_list = []\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [])\n        self.assertIsNot(val, a_list)\n\n        a_list = [None, None]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [None, None])\n        self.assertIsNot(val, a_list)\n\n    def test_encode_dict_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, {var1: 1, var2: 2})\n        self.assertEqual(\n            val,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        a_dict = {1: 2, 2: 3, 3: 4}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertIsNot(val, a_dict)\n\n        a_dict = {}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({}, -4))\n        self.assertIsNot(val, a_dict)\n\n    def test_decode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          self.domain)\n        self.assertIs(val, var)\n\n        all_metas_domain = Domain([], metas=[var])\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          all_metas_domain)\n        self.assertIs(val, var)\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting, (var.name, 100 + vartype(var)))\n        self.handler.decode_setting(setting, None, None)\n\n    def test_decode_list_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3),\n            self.domain)\n        self.assertEqual(val, [None, var1, var2])\n\n        val = self.handler.decode_setting(setting, [1, 2, 3], self.domain)\n        self.assertEqual(val, [1, 2, 3])\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ([None,\n                            (var1.name, 100 + vartype(var1)),\n                            (var2.name, 100 + vartype(var2))], -3)\n                          )\n        val = self.handler.decode_setting(setting, ([None, None], -3), None)\n        self.assertEqual(val, [None, None])\n\n\n    def test_decode_dict_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4),\n            self.domain)\n        self.assertEqual(val, {var1: 1, var2: 2})\n\n        val = self.handler.decode_setting(\n            setting, ({1: 2, 2: 3, 3: 4}, -2), self.domain)\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ({(var1.name, 100 + vartype(var1)): 1,\n                            (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        val = self.handler.decode_setting(setting, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n\n    def test_backward_compatible_params(self):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter(\"always\")\n            DomainContextHandler(metas_in_res=True)\n            self.assertIn(OrangeDeprecationWarning,\n                          [x.category for x in w])\n\n    def create_context(self, domain, values):\n        if domain is None:\n            domain = Domain([])\n\n        context = self.handler.new_context(domain,\n                                           *self.handler.encode_domain(domain))\n        context.values = values\n        return context\n\n\nclass SimpleWidget:\n    text = ContextSetting(\"\")\n    with_metas = ContextSetting([], required=ContextSetting.OPTIONAL)\n    required = ContextSetting(\"\", required=ContextSetting.REQUIRED)\n\n    def retrieveSpecificSettings(self):\n        pass\n\n    def storeSpecificSettings(self):\n        pass\n",
            "new_file_content": "import warnings\nfrom unittest import TestCase\nfrom unittest.mock import Mock\n\nfrom Orange.data import Domain, DiscreteVariable\nfrom Orange.data import ContinuousVariable\nfrom Orange.util import OrangeDeprecationWarning\nfrom Orange.widgets.settings import DomainContextHandler, ContextSetting\nfrom Orange.widgets.utils import vartype\n\nContinuous = 100 + vartype(ContinuousVariable(\"x\"))\nDiscrete = 100 + vartype(DiscreteVariable(\"x\"))\n\n\nclass TestDomainContextHandler(TestCase):\n    def setUp(self):\n        self.domain = Domain(\n            attributes=[ContinuousVariable('c1'),\n                        DiscreteVariable('d1', values='abc'),\n                        DiscreteVariable('d2', values='def')],\n            class_vars=[DiscreteVariable('d3', values='ghi')],\n            metas=[ContinuousVariable('c2'),\n                   DiscreteVariable('d4', values='jkl')]\n        )\n        self.args = (self.domain,\n                     {'c1': Continuous - 100, 'd1': Discrete - 100,\n                      'd2': Discrete - 100, 'd3': Discrete - 100},\n                     {'c2': Continuous - 100, 'd4': Discrete - 100, })\n        self.handler = DomainContextHandler()\n        self.handler.read_defaults = lambda: None\n\n    def test_encode_domain_with_match_none(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_NONE)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100, 'd3': Discrete - 100})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100, })\n\n    def test_encode_domain_with_match_class(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_CLASS)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100,\n                          'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100})\n\n    def test_encode_domain_with_match_all(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_ALL)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': tuple('abc'),\n                          'd2': tuple('def'), 'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': tuple('jkl')})\n\n    def test_match_returns_1_if_everything_matches(self):\n        self.handler.bind(SimpleWidget)\n\n        # Attributes in values\n        context = Mock(values=dict(\n            with_metas=('d1', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in values\n        context = Mock(values=dict(\n            with_metas=('d4', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Attributes in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d1\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d4\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n\n        context = Mock(values={})\n        self.assertEqual(0.1, self.handler.match(context, *self.args))\n\n    def test_match_returns_zero_on_incompatible_context(self):\n        self.handler.bind(SimpleWidget)\n\n        # required\n        context = Mock(values=dict(required=('u', Discrete),\n                                   with_metas=('d1', Discrete)))\n        self.assertEqual(0, self.handler.match(context, *self.args))\n\n    def test_clone_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)],\n            required=('u', Continuous)\n        ))\n\n        new_values = self.handler.clone_context(context, *self.args).values\n\n        self.assertEqual(new_values['text'], ('u', -2))\n        self.assertEqual([('d1', Discrete), ('c1', Continuous)],\n                         new_values['with_metas'])\n        self.assertNotIn('required', new_values)\n\n    def test_open_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d2', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        old_metas_list = widget.with_metas\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertIs(old_metas_list, widget.with_metas)\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('d2', Discrete)])\n\n    def test_open_context_with_imperfect_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_not_first_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [Mock(values={}), context, Mock(values={})]\n        self.handler.first_match = False\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_with_no_match(self):\n        self.handler.bind(SimpleWidget)\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        widget.text = 'u'\n\n        self.handler.open_context(widget, self.args[0])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [])\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertEqual(context.values['text'], ('u', -2))\n\n    def test_filter_value(self):\n        setting = ContextSetting([])\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter([], [])\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter([(\"d1\", Discrete), (\"d1\", Continuous),\n                     (\"c1\", Continuous), (\"c1\", Discrete)],\n                    [(\"d1\", Discrete), (\"c1\", Continuous)])\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_filter_value_dict(self):\n        setting = ContextSetting({})\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter({}, {})\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter({(\"d1\", Discrete): 1, (\"d1\", Continuous): 2,\n                     (\"c1\", Continuous): 3, (\"c1\", Discrete): 4},\n                    {(\"d1\", Discrete): 1, (\"c1\", Continuous): 3})\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_encode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n        # Should not crash on anonymous variables\n        with self.assertWarns(OrangeDeprecationWarning):\n            var = ContinuousVariable()\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n    def test_encode_list_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, [None, var1, var2])\n        self.assertEqual(\n            val,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3))\n\n        a_list = [1, 2, 3]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [1, 2, 3])\n        self.assertIsNot(val, a_list)\n\n        a_list = []\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [])\n        self.assertIsNot(val, a_list)\n\n        a_list = [None, None]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [None, None])\n        self.assertIsNot(val, a_list)\n\n    def test_encode_dict_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, {var1: 1, var2: 2})\n        self.assertEqual(\n            val,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        a_dict = {1: 2, 2: 3, 3: 4}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertIsNot(val, a_dict)\n\n        a_dict = {}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({}, -4))\n        self.assertIsNot(val, a_dict)\n\n    def test_decode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          self.domain)\n        self.assertIs(val, var)\n\n        all_metas_domain = Domain([], metas=[var])\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          all_metas_domain)\n        self.assertIs(val, var)\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting, (var.name, 100 + vartype(var)))\n        self.handler.decode_setting(setting, None, None)\n\n    def test_decode_list_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3),\n            self.domain)\n        self.assertEqual(val, [None, var1, var2])\n\n        val = self.handler.decode_setting(setting, [1, 2, 3], self.domain)\n        self.assertEqual(val, [1, 2, 3])\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ([None,\n                            (var1.name, 100 + vartype(var1)),\n                            (var2.name, 100 + vartype(var2))], -3)\n                          )\n        val = self.handler.decode_setting(setting, ([None, None], -3), None)\n        self.assertEqual(val, [None, None])\n\n\n    def test_decode_dict_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4),\n            self.domain)\n        self.assertEqual(val, {var1: 1, var2: 2})\n\n        val = self.handler.decode_setting(\n            setting, ({1: 2, 2: 3, 3: 4}, -2), self.domain)\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ({(var1.name, 100 + vartype(var1)): 1,\n                            (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        val = self.handler.decode_setting(setting, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n\n    def test_backward_compatible_params(self):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter(\"always\")\n            DomainContextHandler(metas_in_res=True)\n            self.assertIn(OrangeDeprecationWarning,\n                          [x.category for x in w])\n\n    def create_context(self, domain, values):\n        if domain is None:\n            domain = Domain([])\n\n        context = self.handler.new_context(domain,\n                                           *self.handler.encode_domain(domain))\n        context.values = values\n        return context\n\n\nclass SimpleWidget:\n    text = ContextSetting(\"\")\n    with_metas = ContextSetting([], required=ContextSetting.OPTIONAL)\n    required = ContextSetting(\"\", required=ContextSetting.REQUIRED)\n\n    def retrieveSpecificSettings(self):\n        pass\n\n    def storeSpecificSettings(self):\n        pass\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/tests/test_domain_context_handler.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "e81f7e42c",
                "new_commit_hash": "c4a6e70df",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/tests/test_domain_context_handler.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/tests/test_domain_context_handler.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 97,
                            "length": 7
                        },
                        "new_range": {
                            "start": 97,
                            "length": 7
                        },
                        "section": "class TestDomainContextHandler(TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.handler.bind(SimpleWidget)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        context = Mock(values={})",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(1, self.handler.match(context, *self.args))",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(0.1, self.handler.match(context, *self.args))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_match_returns_zero_on_incompatible_context(self):",
                                "type": "context"
                            },
                            {
                                "content": "        self.handler.bind(SimpleWidget)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/tests/test_domain_context_handler.py",
                            "type": "method",
                            "name": "TestDomainContextHandler.test_match_when_nothing_to_match",
                            "content": "class TestDomainContextHandler(TestCase):\n    def setUp(self):\n        self.domain = Domain(\n            attributes=[ContinuousVariable('c1'),\n                        DiscreteVariable('d1', values='abc'),\n                        DiscreteVariable('d2', values='def')],\n            class_vars=[DiscreteVariable('d3', values='ghi')],\n            metas=[ContinuousVariable('c2'),\n                   DiscreteVariable('d4', values='jkl')]\n        )\n        self.args = (self.domain,\n                     {'c1': Continuous - 100, 'd1': Discrete - 100,\n                      'd2': Discrete - 100, 'd3': Discrete - 100},\n                     {'c2': Continuous - 100, 'd4': Discrete - 100, })\n        self.handler = DomainContextHandler()\n        self.handler.read_defaults = lambda: None\n\n    def test_encode_domain_with_match_none(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_NONE)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100, 'd3': Discrete - 100})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100, })\n\n    def test_encode_domain_with_match_class(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_CLASS)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100,\n                          'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100})\n\n    def test_encode_domain_with_match_all(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_ALL)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': tuple('abc'),\n                          'd2': tuple('def'), 'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': tuple('jkl')})\n\n    def test_match_returns_1_if_everything_matches(self):\n        self.handler.bind(SimpleWidget)\n\n        # Attributes in values\n        context = Mock(values=dict(\n            with_metas=('d1', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in values\n        context = Mock(values=dict(\n            with_metas=('d4', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Attributes in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d1\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d4\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n\n        context = Mock(values={})\n        self.assertEqual(1, self.handler.match(context, *self.args))\n\n    def test_match_returns_zero_on_incompatible_context(self):\n        self.handler.bind(SimpleWidget)\n\n        # required\n        context = Mock(values=dict(required=('u', Discrete),\n                                   with_metas=('d1', Discrete)))\n        self.assertEqual(0, self.handler.match(context, *self.args))\n\n    def test_clone_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)],\n            required=('u', Continuous)\n        ))\n\n        new_values = self.handler.clone_context(context, *self.args).values\n\n        self.assertEqual(new_values['text'], ('u', -2))\n        self.assertEqual([('d1', Discrete), ('c1', Continuous)],\n                         new_values['with_metas'])\n        self.assertNotIn('required', new_values)\n\n    def test_open_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d2', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        old_metas_list = widget.with_metas\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertIs(old_metas_list, widget.with_metas)\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('d2', Discrete)])\n\n    def test_open_context_with_imperfect_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_not_first_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [Mock(values={}), context, Mock(values={})]\n        self.handler.first_match = False\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_with_no_match(self):\n        self.handler.bind(SimpleWidget)\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        widget.text = 'u'\n\n        self.handler.open_context(widget, self.args[0])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [])\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertEqual(context.values['text'], ('u', -2))\n\n    def test_filter_value(self):\n        setting = ContextSetting([])\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter([], [])\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter([(\"d1\", Discrete), (\"d1\", Continuous),\n                     (\"c1\", Continuous), (\"c1\", Discrete)],\n                    [(\"d1\", Discrete), (\"c1\", Continuous)])\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_filter_value_dict(self):\n        setting = ContextSetting({})\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter({}, {})\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter({(\"d1\", Discrete): 1, (\"d1\", Continuous): 2,\n                     (\"c1\", Continuous): 3, (\"c1\", Discrete): 4},\n                    {(\"d1\", Discrete): 1, (\"c1\", Continuous): 3})\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_encode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n        # Should not crash on anonymous variables\n        with self.assertWarns(OrangeDeprecationWarning):\n            var = ContinuousVariable()\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n    def test_encode_list_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, [None, var1, var2])\n        self.assertEqual(\n            val,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3))\n\n        a_list = [1, 2, 3]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [1, 2, 3])\n        self.assertIsNot(val, a_list)\n\n        a_list = []\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [])\n        self.assertIsNot(val, a_list)\n\n        a_list = [None, None]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [None, None])\n        self.assertIsNot(val, a_list)\n\n    def test_encode_dict_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, {var1: 1, var2: 2})\n        self.assertEqual(\n            val,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        a_dict = {1: 2, 2: 3, 3: 4}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertIsNot(val, a_dict)\n\n        a_dict = {}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({}, -4))\n        self.assertIsNot(val, a_dict)\n\n    def test_decode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          self.domain)\n        self.assertIs(val, var)\n\n        all_metas_domain = Domain([], metas=[var])\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          all_metas_domain)\n        self.assertIs(val, var)\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting, (var.name, 100 + vartype(var)))\n        self.handler.decode_setting(setting, None, None)\n\n    def test_decode_list_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3),\n            self.domain)\n        self.assertEqual(val, [None, var1, var2])\n\n        val = self.handler.decode_setting(setting, [1, 2, 3], self.domain)\n        self.assertEqual(val, [1, 2, 3])\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ([None,\n                            (var1.name, 100 + vartype(var1)),\n                            (var2.name, 100 + vartype(var2))], -3)\n                          )\n        val = self.handler.decode_setting(setting, ([None, None], -3), None)\n        self.assertEqual(val, [None, None])\n\n\n    def test_decode_dict_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4),\n            self.domain)\n        self.assertEqual(val, {var1: 1, var2: 2})\n\n        val = self.handler.decode_setting(\n            setting, ({1: 2, 2: 3, 3: 4}, -2), self.domain)\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ({(var1.name, 100 + vartype(var1)): 1,\n                            (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        val = self.handler.decode_setting(setting, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n\n    def test_backward_compatible_params(self):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter(\"always\")\n            DomainContextHandler(metas_in_res=True)\n            self.assertIn(OrangeDeprecationWarning,\n                          [x.category for x in w])\n\n    def create_context(self, domain, values):\n        if domain is None:\n            domain = Domain([])\n\n        context = self.handler.new_context(domain,\n                                           *self.handler.encode_domain(domain))\n        context.values = values\n        return context",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 96,
                            "end_lineno": 100,
                            "parent": {
                                "file_name": "Orange/widgets/tests/test_domain_context_handler.py",
                                "type": "class",
                                "name": "TestDomainContextHandler",
                                "content": "class TestDomainContextHandler(TestCase):\n    def setUp(self):\n        self.domain = Domain(\n            attributes=[ContinuousVariable('c1'),\n                        DiscreteVariable('d1', values='abc'),\n                        DiscreteVariable('d2', values='def')],\n            class_vars=[DiscreteVariable('d3', values='ghi')],\n            metas=[ContinuousVariable('c2'),\n                   DiscreteVariable('d4', values='jkl')]\n        )\n        self.args = (self.domain,\n                     {'c1': Continuous - 100, 'd1': Discrete - 100,\n                      'd2': Discrete - 100, 'd3': Discrete - 100},\n                     {'c2': Continuous - 100, 'd4': Discrete - 100, })\n        self.handler = DomainContextHandler()\n        self.handler.read_defaults = lambda: None\n\n    def test_encode_domain_with_match_none(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_NONE)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100, 'd3': Discrete - 100})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100, })\n\n    def test_encode_domain_with_match_class(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_CLASS)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100,\n                          'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100})\n\n    def test_encode_domain_with_match_all(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_ALL)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': tuple('abc'),\n                          'd2': tuple('def'), 'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': tuple('jkl')})\n\n    def test_match_returns_1_if_everything_matches(self):\n        self.handler.bind(SimpleWidget)\n\n        # Attributes in values\n        context = Mock(values=dict(\n            with_metas=('d1', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in values\n        context = Mock(values=dict(\n            with_metas=('d4', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Attributes in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d1\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d4\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n\n        context = Mock(values={})\n        self.assertEqual(1, self.handler.match(context, *self.args))\n\n    def test_match_returns_zero_on_incompatible_context(self):\n        self.handler.bind(SimpleWidget)\n\n        # required\n        context = Mock(values=dict(required=('u', Discrete),\n                                   with_metas=('d1', Discrete)))\n        self.assertEqual(0, self.handler.match(context, *self.args))\n\n    def test_clone_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)],\n            required=('u', Continuous)\n        ))\n\n        new_values = self.handler.clone_context(context, *self.args).values\n\n        self.assertEqual(new_values['text'], ('u', -2))\n        self.assertEqual([('d1', Discrete), ('c1', Continuous)],\n                         new_values['with_metas'])\n        self.assertNotIn('required', new_values)\n\n    def test_open_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d2', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        old_metas_list = widget.with_metas\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertIs(old_metas_list, widget.with_metas)\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('d2', Discrete)])\n\n    def test_open_context_with_imperfect_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_not_first_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [Mock(values={}), context, Mock(values={})]\n        self.handler.first_match = False\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_with_no_match(self):\n        self.handler.bind(SimpleWidget)\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        widget.text = 'u'\n\n        self.handler.open_context(widget, self.args[0])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [])\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertEqual(context.values['text'], ('u', -2))\n\n    def test_filter_value(self):\n        setting = ContextSetting([])\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter([], [])\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter([(\"d1\", Discrete), (\"d1\", Continuous),\n                     (\"c1\", Continuous), (\"c1\", Discrete)],\n                    [(\"d1\", Discrete), (\"c1\", Continuous)])\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_filter_value_dict(self):\n        setting = ContextSetting({})\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter({}, {})\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter({(\"d1\", Discrete): 1, (\"d1\", Continuous): 2,\n                     (\"c1\", Continuous): 3, (\"c1\", Discrete): 4},\n                    {(\"d1\", Discrete): 1, (\"c1\", Continuous): 3})\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_encode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n        # Should not crash on anonymous variables\n        with self.assertWarns(OrangeDeprecationWarning):\n            var = ContinuousVariable()\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n    def test_encode_list_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, [None, var1, var2])\n        self.assertEqual(\n            val,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3))\n\n        a_list = [1, 2, 3]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [1, 2, 3])\n        self.assertIsNot(val, a_list)\n\n        a_list = []\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [])\n        self.assertIsNot(val, a_list)\n\n        a_list = [None, None]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [None, None])\n        self.assertIsNot(val, a_list)\n\n    def test_encode_dict_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, {var1: 1, var2: 2})\n        self.assertEqual(\n            val,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        a_dict = {1: 2, 2: 3, 3: 4}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertIsNot(val, a_dict)\n\n        a_dict = {}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({}, -4))\n        self.assertIsNot(val, a_dict)\n\n    def test_decode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          self.domain)\n        self.assertIs(val, var)\n\n        all_metas_domain = Domain([], metas=[var])\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          all_metas_domain)\n        self.assertIs(val, var)\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting, (var.name, 100 + vartype(var)))\n        self.handler.decode_setting(setting, None, None)\n\n    def test_decode_list_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3),\n            self.domain)\n        self.assertEqual(val, [None, var1, var2])\n\n        val = self.handler.decode_setting(setting, [1, 2, 3], self.domain)\n        self.assertEqual(val, [1, 2, 3])\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ([None,\n                            (var1.name, 100 + vartype(var1)),\n                            (var2.name, 100 + vartype(var2))], -3)\n                          )\n        val = self.handler.decode_setting(setting, ([None, None], -3), None)\n        self.assertEqual(val, [None, None])\n\n\n    def test_decode_dict_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4),\n            self.domain)\n        self.assertEqual(val, {var1: 1, var2: 2})\n\n        val = self.handler.decode_setting(\n            setting, ({1: 2, 2: 3, 3: 4}, -2), self.domain)\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ({(var1.name, 100 + vartype(var1)): 1,\n                            (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        val = self.handler.decode_setting(setting, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n\n    def test_backward_compatible_params(self):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter(\"always\")\n            DomainContextHandler(metas_in_res=True)\n            self.assertIn(OrangeDeprecationWarning,\n                          [x.category for x in w])\n\n    def create_context(self, domain, values):\n        if domain is None:\n            domain = Domain([])\n\n        context = self.handler.new_context(domain,\n                                           *self.handler.encode_domain(domain))\n        context.values = values\n        return context",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 15,
                                "end_lineno": 389,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/tests/test_domain_context_handler.py",
                            "type": "class",
                            "name": "TestDomainContextHandler",
                            "content": "class TestDomainContextHandler(TestCase):\n    def setUp(self):\n        self.domain = Domain(\n            attributes=[ContinuousVariable('c1'),\n                        DiscreteVariable('d1', values='abc'),\n                        DiscreteVariable('d2', values='def')],\n            class_vars=[DiscreteVariable('d3', values='ghi')],\n            metas=[ContinuousVariable('c2'),\n                   DiscreteVariable('d4', values='jkl')]\n        )\n        self.args = (self.domain,\n                     {'c1': Continuous - 100, 'd1': Discrete - 100,\n                      'd2': Discrete - 100, 'd3': Discrete - 100},\n                     {'c2': Continuous - 100, 'd4': Discrete - 100, })\n        self.handler = DomainContextHandler()\n        self.handler.read_defaults = lambda: None\n\n    def test_encode_domain_with_match_none(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_NONE)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100, 'd3': Discrete - 100})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100, })\n\n    def test_encode_domain_with_match_class(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_CLASS)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100,\n                          'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100})\n\n    def test_encode_domain_with_match_all(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_ALL)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': tuple('abc'),\n                          'd2': tuple('def'), 'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': tuple('jkl')})\n\n    def test_match_returns_1_if_everything_matches(self):\n        self.handler.bind(SimpleWidget)\n\n        # Attributes in values\n        context = Mock(values=dict(\n            with_metas=('d1', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in values\n        context = Mock(values=dict(\n            with_metas=('d4', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Attributes in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d1\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d4\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n\n        context = Mock(values={})\n        self.assertEqual(1, self.handler.match(context, *self.args))\n\n    def test_match_returns_zero_on_incompatible_context(self):\n        self.handler.bind(SimpleWidget)\n\n        # required\n        context = Mock(values=dict(required=('u', Discrete),\n                                   with_metas=('d1', Discrete)))\n        self.assertEqual(0, self.handler.match(context, *self.args))\n\n    def test_clone_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)],\n            required=('u', Continuous)\n        ))\n\n        new_values = self.handler.clone_context(context, *self.args).values\n\n        self.assertEqual(new_values['text'], ('u', -2))\n        self.assertEqual([('d1', Discrete), ('c1', Continuous)],\n                         new_values['with_metas'])\n        self.assertNotIn('required', new_values)\n\n    def test_open_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d2', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        old_metas_list = widget.with_metas\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertIs(old_metas_list, widget.with_metas)\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('d2', Discrete)])\n\n    def test_open_context_with_imperfect_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_not_first_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [Mock(values={}), context, Mock(values={})]\n        self.handler.first_match = False\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_with_no_match(self):\n        self.handler.bind(SimpleWidget)\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        widget.text = 'u'\n\n        self.handler.open_context(widget, self.args[0])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [])\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertEqual(context.values['text'], ('u', -2))\n\n    def test_filter_value(self):\n        setting = ContextSetting([])\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter([], [])\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter([(\"d1\", Discrete), (\"d1\", Continuous),\n                     (\"c1\", Continuous), (\"c1\", Discrete)],\n                    [(\"d1\", Discrete), (\"c1\", Continuous)])\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_filter_value_dict(self):\n        setting = ContextSetting({})\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter({}, {})\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter({(\"d1\", Discrete): 1, (\"d1\", Continuous): 2,\n                     (\"c1\", Continuous): 3, (\"c1\", Discrete): 4},\n                    {(\"d1\", Discrete): 1, (\"c1\", Continuous): 3})\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_encode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n        # Should not crash on anonymous variables\n        with self.assertWarns(OrangeDeprecationWarning):\n            var = ContinuousVariable()\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n    def test_encode_list_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, [None, var1, var2])\n        self.assertEqual(\n            val,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3))\n\n        a_list = [1, 2, 3]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [1, 2, 3])\n        self.assertIsNot(val, a_list)\n\n        a_list = []\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [])\n        self.assertIsNot(val, a_list)\n\n        a_list = [None, None]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [None, None])\n        self.assertIsNot(val, a_list)\n\n    def test_encode_dict_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, {var1: 1, var2: 2})\n        self.assertEqual(\n            val,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        a_dict = {1: 2, 2: 3, 3: 4}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertIsNot(val, a_dict)\n\n        a_dict = {}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({}, -4))\n        self.assertIsNot(val, a_dict)\n\n    def test_decode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          self.domain)\n        self.assertIs(val, var)\n\n        all_metas_domain = Domain([], metas=[var])\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          all_metas_domain)\n        self.assertIs(val, var)\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting, (var.name, 100 + vartype(var)))\n        self.handler.decode_setting(setting, None, None)\n\n    def test_decode_list_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3),\n            self.domain)\n        self.assertEqual(val, [None, var1, var2])\n\n        val = self.handler.decode_setting(setting, [1, 2, 3], self.domain)\n        self.assertEqual(val, [1, 2, 3])\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ([None,\n                            (var1.name, 100 + vartype(var1)),\n                            (var2.name, 100 + vartype(var2))], -3)\n                          )\n        val = self.handler.decode_setting(setting, ([None, None], -3), None)\n        self.assertEqual(val, [None, None])\n\n\n    def test_decode_dict_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4),\n            self.domain)\n        self.assertEqual(val, {var1: 1, var2: 2})\n\n        val = self.handler.decode_setting(\n            setting, ({1: 2, 2: 3, 3: 4}, -2), self.domain)\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ({(var1.name, 100 + vartype(var1)): 1,\n                            (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        val = self.handler.decode_setting(setting, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n\n    def test_backward_compatible_params(self):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter(\"always\")\n            DomainContextHandler(metas_in_res=True)\n            self.assertIn(OrangeDeprecationWarning,\n                          [x.category for x in w])\n\n    def create_context(self, domain, values):\n        if domain is None:\n            domain = Domain([])\n\n        context = self.handler.new_context(domain,\n                                           *self.handler.encode_domain(domain))\n        context.values = values\n        return context",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 15,
                            "end_lineno": 389,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "9ce8530ddbd5ceda61839ff79846dc3ad0955ca0^",
    "new_commit_hash": "9ce8530ddbd5ceda61839ff79846dc3ad0955ca0",
    "commit_message": "DomainContextHandler: Don't promote empty matches as a full match",
    "commit_date": "2020-04-20T21:51:18+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "9ce8530ddbd5ceda61839ff79846dc3ad0955ca0",
    "test_file_codes": [
        "import warnings\nfrom unittest import TestCase\nfrom unittest.mock import Mock\n\nfrom Orange.data import Domain, DiscreteVariable\nfrom Orange.data import ContinuousVariable\nfrom Orange.util import OrangeDeprecationWarning\nfrom Orange.widgets.settings import DomainContextHandler, ContextSetting\nfrom Orange.widgets.utils import vartype\n\nContinuous = 100 + vartype(ContinuousVariable(\"x\"))\nDiscrete = 100 + vartype(DiscreteVariable(\"x\"))\n\n\nclass TestDomainContextHandler(TestCase):\n    def setUp(self):\n        self.domain = Domain(\n            attributes=[ContinuousVariable('c1'),\n                        DiscreteVariable('d1', values='abc'),\n                        DiscreteVariable('d2', values='def')],\n            class_vars=[DiscreteVariable('d3', values='ghi')],\n            metas=[ContinuousVariable('c2'),\n                   DiscreteVariable('d4', values='jkl')]\n        )\n        self.args = (self.domain,\n                     {'c1': Continuous - 100, 'd1': Discrete - 100,\n                      'd2': Discrete - 100, 'd3': Discrete - 100},\n                     {'c2': Continuous - 100, 'd4': Discrete - 100, })\n        self.handler = DomainContextHandler()\n        self.handler.read_defaults = lambda: None\n\n    def test_encode_domain_with_match_none(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_NONE)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100, 'd3': Discrete - 100})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100, })\n\n    def test_encode_domain_with_match_class(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_CLASS)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': Discrete - 100,\n                          'd2': Discrete - 100,\n                          'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': Discrete - 100})\n\n    def test_encode_domain_with_match_all(self):\n        handler = DomainContextHandler(\n            match_values=DomainContextHandler.MATCH_VALUES_ALL)\n\n        encoded_attributes, encoded_metas = handler.encode_domain(self.domain)\n\n        self.assertEqual(encoded_attributes,\n                         {'c1': Continuous - 100, 'd1': tuple('abc'),\n                          'd2': tuple('def'), 'd3': tuple('ghi')})\n        self.assertEqual(encoded_metas,\n                         {'c2': Continuous - 100, 'd4': tuple('jkl')})\n\n    def test_match_returns_1_if_everything_matches(self):\n        self.handler.bind(SimpleWidget)\n\n        # Attributes in values\n        context = Mock(values=dict(\n            with_metas=('d1', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in values\n        context = Mock(values=dict(\n            with_metas=('d4', Discrete),\n            required=('d1', Discrete)))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Attributes in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d1\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n        # Metas in lists\n        context = Mock(values=dict(\n            with_metas=[(\"d4\", Discrete)]\n        ))\n        self.assertEqual(1., self.handler.match(context, *self.args))\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n\n        context = Mock(values={})\n        self.assertEqual(0.1, self.handler.match(context, *self.args))\n\n    def test_match_returns_zero_on_incompatible_context(self):\n        self.handler.bind(SimpleWidget)\n\n        # required\n        context = Mock(values=dict(required=('u', Discrete),\n                                   with_metas=('d1', Discrete)))\n        self.assertEqual(0, self.handler.match(context, *self.args))\n\n    def test_clone_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)],\n            required=('u', Continuous)\n        ))\n\n        new_values = self.handler.clone_context(context, *self.args).values\n\n        self.assertEqual(new_values['text'], ('u', -2))\n        self.assertEqual([('d1', Discrete), ('c1', Continuous)],\n                         new_values['with_metas'])\n        self.assertNotIn('required', new_values)\n\n    def test_open_context(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(self.domain, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d2', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        old_metas_list = widget.with_metas\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertIs(old_metas_list, widget.with_metas)\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('d2', Discrete)])\n\n    def test_open_context_with_imperfect_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [context, Mock(values={})]\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_not_first_match(self):\n        self.handler.bind(SimpleWidget)\n        context = self.create_context(None, dict(\n            text=('u', -2),\n            with_metas=[('d1', Discrete), ('d1', Continuous),\n                        ('c1', Continuous), ('c1', Discrete)]\n        ))\n        self.handler.global_contexts = \\\n            [Mock(values={}), context, Mock(values={})]\n        self.handler.first_match = False\n\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        self.handler.open_context(widget, self.args[0])\n\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [('d1', Discrete),\n                                             ('c1', Continuous)])\n\n    def test_open_context_with_no_match(self):\n        self.handler.bind(SimpleWidget)\n        widget = SimpleWidget()\n        self.handler.initialize(widget)\n        widget.text = 'u'\n\n        self.handler.open_context(widget, self.args[0])\n\n        self.assertEqual(widget.text, 'u')\n        self.assertEqual(widget.with_metas, [])\n        context = widget.current_context\n        self.assertEqual(context.attributes, self.args[1])\n        self.assertEqual(context.metas, self.args[2])\n        self.assertEqual(context.values['text'], ('u', -2))\n\n    def test_filter_value(self):\n        setting = ContextSetting([])\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter([], [])\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter([(\"d1\", Discrete), (\"d1\", Continuous),\n                     (\"c1\", Continuous), (\"c1\", Discrete)],\n                    [(\"d1\", Discrete), (\"c1\", Continuous)])\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_filter_value_dict(self):\n        setting = ContextSetting({})\n        setting.name = \"value\"\n\n        def test_filter(before_value, after_value):\n            data = dict(value=before_value)\n            self.handler.filter_value(setting, data, *self.args)\n            self.assertEqual(data.get(\"value\", None), after_value)\n\n        # filter list values\n        test_filter({}, {})\n        # When list contains attributes asa tuple of (name, type),\n        # Attributes not present in domain should be filtered out\n        test_filter({(\"d1\", Discrete): 1, (\"d1\", Continuous): 2,\n                     (\"c1\", Continuous): 3, (\"c1\", Discrete): 4},\n                    {(\"d1\", Discrete): 1, (\"c1\", Continuous): 3})\n        # All other values in list should remain\n        test_filter([0, [1, 2, 3], \"abcd\", 5.4], [0, [1, 2, 3], \"abcd\", 5.4])\n\n    def test_encode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n        # Should not crash on anonymous variables\n        with self.assertWarns(OrangeDeprecationWarning):\n            var = ContinuousVariable()\n        val = self.handler.encode_setting(None, setting, var)\n        self.assertEqual(val, (var.name, 100 + vartype(var)))\n\n    def test_encode_list_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, [None, var1, var2])\n        self.assertEqual(\n            val,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3))\n\n        a_list = [1, 2, 3]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [1, 2, 3])\n        self.assertIsNot(val, a_list)\n\n        a_list = []\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [])\n        self.assertIsNot(val, a_list)\n\n        a_list = [None, None]\n        val = self.handler.encode_setting(None, setting, a_list)\n        self.assertEqual(val, [None, None])\n        self.assertIsNot(val, a_list)\n\n    def test_encode_dict_settings(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.encode_setting(None, setting, {var1: 1, var2: 2})\n        self.assertEqual(\n            val,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        a_dict = {1: 2, 2: 3, 3: 4}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertIsNot(val, a_dict)\n\n        a_dict = {}\n        val = self.handler.encode_setting(None, setting, a_dict)\n        self.assertEqual(val, ({}, -4))\n        self.assertIsNot(val, a_dict)\n\n    def test_decode_setting(self):\n        setting = ContextSetting(None)\n\n        var = self.domain[0]\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          self.domain)\n        self.assertIs(val, var)\n\n        all_metas_domain = Domain([], metas=[var])\n        val = self.handler.decode_setting(setting, (var.name, 100 + vartype(var)),\n                                          all_metas_domain)\n        self.assertIs(val, var)\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting, (var.name, 100 + vartype(var)))\n        self.handler.decode_setting(setting, None, None)\n\n    def test_decode_list_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ([None,\n              (var1.name, 100 + vartype(var1)),\n              (var2.name, 100 + vartype(var2))], -3),\n            self.domain)\n        self.assertEqual(val, [None, var1, var2])\n\n        val = self.handler.decode_setting(setting, [1, 2, 3], self.domain)\n        self.assertEqual(val, [1, 2, 3])\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ([None,\n                            (var1.name, 100 + vartype(var1)),\n                            (var2.name, 100 + vartype(var2))], -3)\n                          )\n        val = self.handler.decode_setting(setting, ([None, None], -3), None)\n        self.assertEqual(val, [None, None])\n\n\n    def test_decode_dict_setting(self):\n        setting = ContextSetting(None)\n\n        var1, var2 = self.domain[:2]\n        val = self.handler.decode_setting(\n            setting,\n            ({(var1.name, 100 + vartype(var1)): 1,\n              (var2.name, 100 + vartype(var2)): 2}, -4),\n            self.domain)\n        self.assertEqual(val, {var1: 1, var2: 2})\n\n        val = self.handler.decode_setting(\n            setting, ({1: 2, 2: 3, 3: 4}, -2), self.domain)\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n        self.assertRaises(ValueError,\n                          self.handler.decode_setting,\n                          setting,\n                          ({(var1.name, 100 + vartype(var1)): 1,\n                            (var2.name, 100 + vartype(var2)): 2}, -4))\n\n        val = self.handler.decode_setting(setting, ({1: 2, 2: 3, 3: 4}, -2))\n        self.assertEqual(val, {1: 2, 2: 3, 3: 4})\n\n\n    def test_backward_compatible_params(self):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter(\"always\")\n            DomainContextHandler(metas_in_res=True)\n            self.assertIn(OrangeDeprecationWarning,\n                          [x.category for x in w])\n\n    def create_context(self, domain, values):\n        if domain is None:\n            domain = Domain([])\n\n        context = self.handler.new_context(domain,\n                                           *self.handler.encode_domain(domain))\n        context.values = values\n        return context\n\n\nclass SimpleWidget:\n    text = ContextSetting(\"\")\n    with_metas = ContextSetting([], required=ContextSetting.OPTIONAL)\n    required = ContextSetting(\"\", required=ContextSetting.REQUIRED)\n\n    def retrieveSpecificSettings(self):\n        pass\n\n    def storeSpecificSettings(self):\n        pass\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpki7pqi_u/tmp\ncreating /tmp/tmpki7pqi_u/tmp/tmpki7pqi_u\ncompile options: '-MMD -MF /tmp/tmpki7pqi_u/file.c.d -c'\ncc: /tmp/tmpki7pqi_u/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp6sz26qn0/tmp\ncreating /tmp/tmp6sz26qn0/tmp/tmp6sz26qn0\ncompile options: '-MMD -MF /tmp/tmp6sz26qn0/file.c.d -c'\ncc: /tmp/tmp6sz26qn0/file.c\ncustomize UnixCCompiler using build_ext\nbuilding 'Orange.classification._simple_tree' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_simple_tree.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._tree_scorers' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_tree_scorers.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_valuecount.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_contingency.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_io.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_variable.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/distance/_distance.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/preprocess/_discretize.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/preprocess/_relieff.cpp\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/projection/_som.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/widgets/utils/_grid_density.cpp\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\nrunning develop\nrunning build_scripts\nrunning egg_info\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\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'\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\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 '*.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 'COPYING'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpvjq7bga8/tmp\ncreating /tmp/tmpvjq7bga8/tmp/tmpvjq7bga8\ncompile options: '-MMD -MF /tmp/tmpvjq7bga8/file.c.d -c'\ncc: /tmp/tmpvjq7bga8/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpsmv0ophj/tmp\ncreating /tmp/tmpsmv0ophj/tmp/tmpsmv0ophj\ncompile options: '-MMD -MF /tmp/tmpsmv0ophj/file.c.d -c'\ncc: /tmp/tmpsmv0ophj/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.26.0.dev0+9ce8530 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0\nProcessing dependencies for Orange3==3.26.0.dev0+9ce8530\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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for httpx==0.24.1\nBest match: httpx 0.24.1\nAdding httpx 0.24.1 to easy-install.pth file\nInstalling httpx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.17.3\nBest match: httpcore 0.17.3\nAdding httpcore 0.17.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for anyio==3.7.1\nBest match: anyio 3.7.1\nAdding anyio 3.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.26.0.dev0+9ce8530\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 70ms\nPrepared 18 packages in 30ms\nInstalled 18 packages in 110ms\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\nResolved 54 packages in 357ms\nInstalled 47 packages in 857ms\n + anyio==3.7.1\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.14.0\n + httpcore==0.17.3\n + httpx==0.24.1\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 34 packages in 97ms\nInstalled 13 packages in 99ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 12ms\nInstalled 2 packages in 37ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 16ms\nAudited 2 packages in 18ms\nOrange/classification/_simple_tree.c: In function ‘gain_ratio_c’:\nOrange/classification/_simple_tree.c:63:9: warning: implicit declaration of function ‘qsort_r’; did you mean ‘qsort’? [-Wimplicit-function-declaration]\n   63 |         qsort_r(base, nel, size, compar, thunk)\n      |         ^~~~~~~\nOrange/classification/_simple_tree.c:147:9: note: in expansion of macro ‘QSORT_R_FUNC’\n  147 |         QSORT_R_FUNC(examples, size, sizeof(struct Example), (void*) &compar_attr, compar_examples);\n      |         ^~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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:3115:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3115 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4619:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4619 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5396:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5396 |           for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5517:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5517 |           __pyx_t_27 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5523:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5523 |           __pyx_t_27 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7051:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7051 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7741:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7741 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7801:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7801 |               __pyx_t_17 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_18 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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:3881:24: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3881 |           __pyx_v_decs = (__pyx_v_decs / 10.0);\n      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:4070:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4070 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:480:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  480 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1301:7: note: ‘__pyx_v_attr_index’ was declared here\n 1301 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:2935:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2935 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:581:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/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:3655:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3655 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3654:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3654 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:4547:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4547 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4114:7: note: ‘__pyx_v_win_y’ was declared here\n 4114 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4536:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4536 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4113:7: note: ‘__pyx_v_win_x’ was declared here\n 4113 |   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:4746:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4746 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4745:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4745 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3141:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3141 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:2964:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2964 |           *__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:2665:7: note: ‘__pyx_v_win_y’ was declared here\n 2665 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:2953:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2953 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2664:7: note: ‘__pyx_v_win_x’ was declared here\n 2664 |   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:5515:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5515 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5514:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5514 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.\n  EasyInstallDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0/.venv/lib/python3.7/site-packages/setuptools/command/egg_info.py:628: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.\nPlease extend command classes from setuptools instead of distutils.\n  SetuptoolsDeprecationWarning\n",
    "new_commit_res_code": 0,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0\nplugins: anyio-3.7.1\ncollected 20 items\n\nr2e_tests/test_1.py ....................                                 [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_backward_compatible_params\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_clone_context\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_decode_dict_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_decode_list_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_decode_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_dict_settings\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_domain_with_match_all\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_domain_with_match_class\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_domain_with_match_none\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_list_settings\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_filter_value\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_filter_value_dict\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_match_returns_1_if_everything_matches\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_match_returns_zero_on_incompatible_context\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_match_when_nothing_to_match\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context_not_first_match\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context_with_imperfect_match\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context_with_no_match\n============================== 20 passed in 2.19s ==============================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9ce8530ddbd5ceda61839ff79846dc3ad0955ca0\nplugins: anyio-3.7.1\ncollected 20 items\n\nr2e_tests/test_1.py ...............F....                                 [100%]\n\n=================================== FAILURES ===================================\n__________ TestDomainContextHandler.test_match_when_nothing_to_match ___________\n\nself = <r2e_tests.test_1.TestDomainContextHandler testMethod=test_match_when_nothing_to_match>\n\n    def test_match_when_nothing_to_match(self):\n        self.handler.bind(SimpleWidget)\n    \n        context = Mock(values={})\n>       self.assertEqual(0.1, self.handler.match(context, *self.args))\nE       AssertionError: 0.1 != 1\n\nr2e_tests/test_1.py:100: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_backward_compatible_params\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_clone_context\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_decode_dict_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_decode_list_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_decode_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_dict_settings\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_domain_with_match_all\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_domain_with_match_class\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_domain_with_match_none\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_list_settings\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_encode_setting\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_filter_value\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_filter_value_dict\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_match_returns_1_if_everything_matches\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_match_returns_zero_on_incompatible_context\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context_not_first_match\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context_with_imperfect_match\nPASSED r2e_tests/test_1.py::TestDomainContextHandler::test_open_context_with_no_match\nFAILED r2e_tests/test_1.py::TestDomainContextHandler::test_match_when_nothing_to_match\n========================= 1 failed, 19 passed in 1.74s =========================\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/settings.py Orange/widgets/tests/test_domain_context_handler.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** DomainContextHandler.match Returns Full Match When No Matches Are Present

**Description:**
When there are no matches in the context, the `match` method of `DomainContextHandler` incorrectly returns a full match score. This behavior is unintended and leads to inaccurate match evaluations.

**Example Code:**
```python
handler = DomainContextHandler()
context = Mock(values={})
score = handler.match(context, domain, attributes, metas)
print(score)  # Outputs: 1
```

**Expected Behavior:**
The `match` method should return a low score (e.g., 0.1) when there are no matches, indicating that the context does not sufficiently match.

**Actual Behavior:**
The `match` method returns a full match score of `1` even when the context has no matches, which misrepresents the matching accuracy.

[/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/widgets/settings.py
"""Widget Settings and Settings Handlers

Settings are used to declare widget attributes that persist through sessions.
When widget is removed or saved to a schema file, its settings are packed,
serialized and stored. When a new widget is created, values of attributes
marked as settings are read from disk. When schema is loaded, attribute values
are set to one stored in schema.

Each widget has its own SettingsHandler that takes care of serializing and
storing of settings and SettingProvider that is incharge of reading and
writing the setting values.

All widgets extending from OWWidget use SettingsHandler, unless they
declare otherwise. SettingsHandler ensures that setting attributes
are replaced with default (last used) setting values when the widget is
initialized and stored when the widget is removed.

Widgets with settings whose values depend on the widget inputs use
settings handlers based on ContextHandler. These handlers have two
additional methods, open_context and close_context.

open_context is called when widgets receives new data. It finds a suitable
context and sets the widget attributes to the values stored in context.
If no suitable context exists, a new one is created and values from widget
are copied to it.

close_context stores values that were last used on the widget to the context
so they can be used alter. It should be called before widget starts modifying
(initializing) the value of the setting attributes.
"""

import copy
import itertools
import logging
import warnings

from orangewidget.settings import (
    Setting, SettingProvider, SettingsHandler, ContextSetting,
    ContextHandler, Context, IncompatibleContext, SettingsPrinter,
    rename_setting, widget_settings_dir
)
from orangewidget.settings import _apply_setting

from Orange.data import Domain, Variable
from Orange.util import OrangeDeprecationWarning
from Orange.widgets.utils import vartype

log = logging.getLogger(__name__)

__all__ = [
    # re-exported from orangewidget.settings
    "Setting", "SettingsHandler", "SettingProvider",
    "ContextSetting", "Context", "ContextHandler", "IncompatibleContext",
    "rename_setting", "widget_settings_dir",
    # defined here
    "DomainContextHandler", "PerfectDomainContextHandler",
    "ClassValuesContextHandler", "SettingsPrinter",
    "migrate_str_to_variable",
]


class DomainContextHandler(ContextHandler):
    """Context handler for widgets with settings that depend on
    the input dataset. Suitable settings are selected based on the
    data domain."""

    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)

    def __init__(self, *, match_values=0, first_match=True, **kwargs):
        super().__init__()
        self.match_values = match_values
        self.first_match = first_match

        for name in kwargs:
            warnings.warn(
                "{} is not a valid parameter for DomainContextHandler"
                .format(name), OrangeDeprecationWarning
            )

    def encode_domain(self, domain):
        """
        domain: Orange.data.domain to encode
        return: dict mapping attribute name to type or list of values
                (based on the value of self.match_values attribute)
        """

        match = self.match_values
        encode = self.encode_variables
        if match == self.MATCH_VALUES_CLASS:
            attributes = encode(domain.attributes, False)
            attributes.update(encode(domain.class_vars, True))
        else:
            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)

        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)

        return attributes, metas

    @staticmethod
    def encode_variables(attributes, encode_values):
        """Encode variables to a list mapping name to variable type
        or a list of values."""

        if not encode_values:
            return {v.name: vartype(v) for v in attributes}

        return {v.name: v.values if v.is_discrete else vartype(v)
                for v in attributes}

    def new_context(self, domain, attributes, metas):
        """Create a new context."""
        context = super().new_context()
        context.attributes = attributes
        context.metas = metas
        return context

    def open_context(self, widget, domain):
        if domain is None:
            return
        if not isinstance(domain, Domain):
            domain = domain.domain
        super().open_context(widget, domain, *self.encode_domain(domain))

    def filter_value(self, setting, data, domain, attrs, metas):
        value = data.get(setting.name, None)
        if isinstance(value, list):
            new_value = [item for item in value
                         if self.is_valid_item(setting, item, attrs, metas)]
            data[setting.name] = new_value
        elif isinstance(value, dict):
            new_value = {item: val for item, val in value.items()
                         if self.is_valid_item(setting, item, attrs, metas)}
            data[setting.name] = new_value
        elif value is not None:
            if (value[1] >= 0 and
                    not self._var_exists(setting, value, attrs, metas)):
                del data[setting.name]

    def settings_to_widget(self, widget, domain, *args):
        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:
        #  - merged, remove this method.
        #  - rejected, remove this comment.
        context = widget.current_context
        if context is None:
            return

        widget.retrieveSpecificSettings()

        for setting, data, instance in \
                self.provider.traverse_settings(data=context.values, instance=widget):
            if not isinstance(setting, ContextSetting) or setting.name not in data:
                continue

            value = self.decode_setting(setting, data[setting.name], domain)
            _apply_setting(setting, instance, value)

    @staticmethod
    def encode_variable(var):
        return var.name, 100 + vartype(var)

    @classmethod
    def encode_setting(cls, context, setting, value):
        if isinstance(value, list):
            if all(e is None or isinstance(e, Variable) for e in value) \
                    and any(e is not None for e in value):
                return ([None if e is None else cls.encode_variable(e)
                         for e in value],
                        -3)
            else:
                return copy.copy(value)

        elif isinstance(value, dict) \
                and all(isinstance(e, Variable) for e in value):
            return ({cls.encode_variable(e): val for e, val in value.items()},
                    -4)

        if isinstance(value, Variable):
            if isinstance(setting, ContextSetting):
                return cls.encode_variable(value)
            else:
                raise ValueError("Variables must be stored as ContextSettings; "
                                 f"change {setting.name} to ContextSetting.")

        return copy.copy(value), -2

    def decode_setting(self, setting, value, domain=None, *args):
        def get_var(name):
            if domain is None:
                raise ValueError("Cannot decode variable without domain")
            return domain[name]

        if isinstance(value, tuple):
            data, dtype = value
            if dtype == -3:
                return[None if name_type is None else get_var(name_type[0])
                       for name_type in data]
            if dtype == -4:
                return {get_var(name): val for (name, _), val in data.items()}
            if dtype >= 100:
                return get_var(data)
            return value[0]
        else:
            return value

    @classmethod
    def _var_exists(cls, setting, value, attributes, metas):
        if not isinstance(value, tuple) or len(value) != 2:
            return False

        attr_name, attr_type = value
        # attr_type used to be either 1-4 for variables stored as string
        # settings, and 101-104 for variables stored as variables. The former is
        # no longer supported, but we play it safe and still handle both here.
        attr_type %= 100
        return (not setting.exclude_attributes and
                attributes.get(attr_name, -1) == attr_type or
                not setting.exclude_metas and
                metas.get(attr_name, -1) == attr_type)

    def match(self, context, domain, attrs, metas):
        matches = []
        try:
            for setting, data, _ in \
                    self.provider.traverse_settings(data=context.values):
                if not isinstance(setting, ContextSetting):
                    continue
                value = data.get(setting.name, None)

                if isinstance(value, list):
                    matches.append(
                        self.match_list(setting, value, context, attrs, metas))
                # type check is a (not foolproof) check in case of a pair that
                # would, by conincidence, have -3 or -4 as the second element
                elif isinstance(value, tuple) and len(value) == 2 \
                       and (value[1] == -3 and isinstance(value[0], list)
                            or (value[1] == -4 and isinstance(value[0], dict))):
                    matches.append(self.match_list(setting, value[0], context,
                                                   attrs, metas))
                elif value is not None:
                    matches.append(
                        self.match_value(setting, value, attrs, metas))
        except IncompatibleContext:
            return self.NO_MATCH

        if self.first_match:
            return self.MATCH

        matches.append((0, 0))
        matched, available = [sum(m) for m in zip(*matches)]
        return matched / available if available else 0.1

    def match_list(self, setting, value, context, attrs, metas):
        """Match a list of values with the given context.
        returns a tuple containing number of matched and all values.
        """
        matched = 0
        for item in value:
            if self.is_valid_item(setting, item, attrs, metas):
                matched += 1
            elif setting.required == ContextSetting.REQUIRED:
                raise IncompatibleContext()
        return matched, len(value)

    def match_value(self, setting, value, attrs, metas):
        """Match a single value """
        if value[1] < 0:
            return 0, 0

        if self._var_exists(setting, value, attrs, metas):
            return 1, 1
        elif setting.required == setting.OPTIONAL:
            return 0, 1
        else:
            raise IncompatibleContext()

    def is_valid_item(self, setting, item, attrs, metas):
        """Return True if given item can be used with attrs and metas

        Subclasses can override this method to checks data in alternative
        representations.
        """
        if not isinstance(item, tuple):
            return True
        return self._var_exists(setting, item, attrs, metas)


class ClassValuesContextHandler(ContextHandler):
    """Context handler used for widgets that work with
    a single discrete variable"""

    def open_context(self, widget, classes):
        if isinstance(classes, Variable):
            if classes.is_discrete:
                classes = classes.values
            else:
                classes = None

        super().open_context(widget, classes)

    def new_context(self, classes):
        context = super().new_context()
        context.classes = classes
        return context

    def match(self, context, classes):
        if isinstance(classes, Variable) and classes.is_continuous:
            return (self.PERFECT_MATCH if context.classes is None
                    else self.NO_MATCH)
        else:
            # variable.values used to be a list, and so were context.classes
            # cast to tuple for compatibility with past contexts
            if context.classes is not None and tuple(context.classes) == classes:
                return self.PERFECT_MATCH
            else:
                return self.NO_MATCH


class PerfectDomainContextHandler(DomainContextHandler):
    """Context handler that matches a context only when
    the same domain is available.

    It uses a different encoding than the DomainContextHandler.
    """

    def new_context(self, domain, attributes, class_vars, metas):
        """Same as DomainContextHandler, but also store class_vars"""
        context = super().new_context(domain, attributes, metas)
        context.class_vars = class_vars
        return context

    def clone_context(self, old_context, *args):
        """Copy of context is always valid, since widgets are using
        the same domain."""
        context = self.new_context(*args)
        context.values = copy.deepcopy(old_context.values)
        return context

    def encode_domain(self, domain):
        """Encode domain into tuples (name, type)
        A tuple is returned for each of attributes, class_vars and metas.
        """

        if self.match_values == self.MATCH_VALUES_ALL:
            def _encode(attrs):
                return tuple((v.name, list(v.values) if v.is_discrete else vartype(v))
                             for v in attrs)
        else:
            def _encode(attrs):
                return tuple((v.name, vartype(v)) for v in attrs)
        return (_encode(domain.attributes),
                _encode(domain.class_vars),
                _encode(domain.metas))

    def match(self, context, domain, attributes, class_vars, metas):
        """Context only matches when domains are the same"""

        return (self.PERFECT_MATCH
                if (context.attributes == attributes and
                    context.class_vars == class_vars and
                    context.metas == metas)
                else self.NO_MATCH)

    def encode_setting(self, context, setting, value):
        """Same as is domain context handler, but handles separately stored
        class_vars."""

        if isinstance(setting, ContextSetting) and isinstance(value, str):

            def _candidate_variables():
                if not setting.exclude_attributes:
                    yield from itertools.chain(context.attributes,
                                               context.class_vars)
                if not setting.exclude_metas:
                    yield from context.metas

            for aname, atype in _candidate_variables():
                if aname == value:
                    return value, atype

            return value, -1
        else:
            return super().encode_setting(context, setting, value)


def migrate_str_to_variable(settings, names=None, none_placeholder=None):
    """
    Change variables stored as `(str, int)` to `(Variable, int)`.

    Args:
        settings (Context): context that is being migrated
        names (sequence): names of settings to be migrated. If omitted,
            all settings with values `(str, int)` are migrated.
    """
    def _fix(name):
        var, vartype = settings.values[name]
        if 0 <= vartype <= 100:
            settings.values[name] = (var, 100 + vartype)
        elif var == none_placeholder and vartype == -2:
            settings.values[name] = None

    if names is None:
        for name, setting in settings.values.items():
            if isinstance(setting, tuple) and len(setting) == 2 and \
                    isinstance(setting[0], str) and isinstance(setting[1], int):
                _fix(name)
    elif isinstance(names, str):
        _fix(names)
    else:
        for name in names:
            _fix(name)

```
--- 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:** DomainContextHandler.match Returns Full Match When No Matches Are Present

**Description:**
When there are no matches in the context, the `match` method of `DomainContextHandler` incorrectly returns a full match score. This behavior is unintended and leads to inaccurate match evaluations.

**Example Code:**
```python
handler = DomainContextHandler()
context = Mock(values={})
score = handler.match(context, domain, attributes, metas)
print(score)  # Outputs: 1
```

**Expected Behavior:**
The `match` method should return a low score (e.g., 0.1) when there are no matches, indicating that the context does not sufficiently match.

**Actual Behavior:**
The `match` method returns a full match score of `1` even when the context has no matches, which misrepresents the matching accuracy.

[/ISSUE]
{
    "TestDomainContextHandler.test_backward_compatible_params": "PASSED",
    "TestDomainContextHandler.test_clone_context": "PASSED",
    "TestDomainContextHandler.test_decode_dict_setting": "PASSED",
    "TestDomainContextHandler.test_decode_list_setting": "PASSED",
    "TestDomainContextHandler.test_decode_setting": "PASSED",
    "TestDomainContextHandler.test_encode_dict_settings": "PASSED",
    "TestDomainContextHandler.test_encode_domain_with_match_all": "PASSED",
    "TestDomainContextHandler.test_encode_domain_with_match_class": "PASSED",
    "TestDomainContextHandler.test_encode_domain_with_match_none": "PASSED",
    "TestDomainContextHandler.test_encode_list_settings": "PASSED",
    "TestDomainContextHandler.test_encode_setting": "PASSED",
    "TestDomainContextHandler.test_filter_value": "PASSED",
    "TestDomainContextHandler.test_filter_value_dict": "PASSED",
    "TestDomainContextHandler.test_match_returns_1_if_everything_matches": "PASSED",
    "TestDomainContextHandler.test_match_returns_zero_on_incompatible_context": "PASSED",
    "TestDomainContextHandler.test_match_when_nothing_to_match": "PASSED",
    "TestDomainContextHandler.test_open_context": "PASSED",
    "TestDomainContextHandler.test_open_context_not_first_match": "PASSED",
    "TestDomainContextHandler.test_open_context_with_imperfect_match": "PASSED",
    "TestDomainContextHandler.test_open_context_with_no_match": "PASSED"
}
diff --git a/Orange/widgets/settings.py b/Orange/widgets/settings.py
index 03f361517..24dfb5f01 100644
--- a/Orange/widgets/settings.py
+++ b/Orange/widgets/settings.py
@@ -242,7 +242,7 @@ class DomainContextHandler(ContextHandler):
         except IncompatibleContext:
             return self.NO_MATCH
 
-        if self.first_match:
+        if self.first_match and matches and sum(m[0] for m in matches):
             return self.MATCH
 
         matches.append((0, 0))

{"Orange/widgets/settings.py": "\"\"\"Widget Settings and Settings Handlers\n\nSettings are used to declare widget attributes that persist through sessions.\nWhen widget is removed or saved to a schema file, its settings are packed,\nserialized and stored. When a new widget is created, values of attributes\nmarked as settings are read from disk. When schema is loaded, attribute values\nare set to one stored in schema.\n\nEach widget has its own SettingsHandler that takes care of serializing and\nstoring of settings and SettingProvider that is incharge of reading and\nwriting the setting values.\n\nAll widgets extending from OWWidget use SettingsHandler, unless they\ndeclare otherwise. SettingsHandler ensures that setting attributes\nare replaced with default (last used) setting values when the widget is\ninitialized and stored when the widget is removed.\n\nWidgets with settings whose values depend on the widget inputs use\nsettings handlers based on ContextHandler. These handlers have two\nadditional methods, open_context and close_context.\n\nopen_context is called when widgets receives new data. It finds a suitable\ncontext and sets the widget attributes to the values stored in context.\nIf no suitable context exists, a new one is created and values from widget\nare copied to it.\n\nclose_context stores values that were last used on the widget to the context\nso they can be used alter. It should be called before widget starts modifying\n(initializing) the value of the setting attributes.\n\"\"\"\n\nimport copy\nimport itertools\nimport logging\nimport warnings\n\nfrom orangewidget.settings import (\n    Setting, SettingProvider, SettingsHandler, ContextSetting,\n    ContextHandler, Context, IncompatibleContext, SettingsPrinter,\n    rename_setting, widget_settings_dir\n)\nfrom orangewidget.settings import _apply_setting\n\nfrom Orange.data import Domain, Variable\nfrom Orange.util import OrangeDeprecationWarning\nfrom Orange.widgets.utils import vartype\n\nlog = logging.getLogger(__name__)\n\n__all__ = [\n    # re-exported from orangewidget.settings\n    \"Setting\", \"SettingsHandler\", \"SettingProvider\",\n    \"ContextSetting\", \"Context\", \"ContextHandler\", \"IncompatibleContext\",\n    \"rename_setting\", \"widget_settings_dir\",\n    # defined here\n    \"DomainContextHandler\", \"PerfectDomainContextHandler\",\n    \"ClassValuesContextHandler\", \"SettingsPrinter\",\n    \"migrate_str_to_variable\",\n]\n\n\nclass DomainContextHandler(ContextHandler):\n    \"\"\"Context handler for widgets with settings that depend on\n    the input dataset. Suitable settings are selected based on the\n    data domain.\"\"\"\n\n    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)\n\n    def __init__(self, *, match_values=0, first_match=True, **kwargs):\n        super().__init__()\n        self.match_values = match_values\n        self.first_match = first_match\n\n        for name in kwargs:\n            warnings.warn(\n                \"{} is not a valid parameter for DomainContextHandler\"\n                .format(name), OrangeDeprecationWarning\n            )\n\n    def encode_domain(self, domain):\n        \"\"\"\n        domain: Orange.data.domain to encode\n        return: dict mapping attribute name to type or list of values\n                (based on the value of self.match_values attribute)\n        \"\"\"\n\n        match = self.match_values\n        encode = self.encode_variables\n        if match == self.MATCH_VALUES_CLASS:\n            attributes = encode(domain.attributes, False)\n            attributes.update(encode(domain.class_vars, True))\n        else:\n            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)\n\n        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)\n\n        return attributes, metas\n\n    @staticmethod\n    def encode_variables(attributes, encode_values):\n        \"\"\"Encode variables to a list mapping name to variable type\n        or a list of values.\"\"\"\n\n        if not encode_values:\n            return {v.name: vartype(v) for v in attributes}\n\n        return {v.name: v.values if v.is_discrete else vartype(v)\n                for v in attributes}\n\n    def new_context(self, domain, attributes, metas):\n        \"\"\"Create a new context.\"\"\"\n        context = super().new_context()\n        context.attributes = attributes\n        context.metas = metas\n        return context\n\n    def open_context(self, widget, domain):\n        if domain is None:\n            return\n        if not isinstance(domain, Domain):\n            domain = domain.domain\n        super().open_context(widget, domain, *self.encode_domain(domain))\n\n    def filter_value(self, setting, data, domain, attrs, metas):\n        value = data.get(setting.name, None)\n        if isinstance(value, list):\n            new_value = [item for item in value\n                         if self.is_valid_item(setting, item, attrs, metas)]\n            data[setting.name] = new_value\n        elif isinstance(value, dict):\n            new_value = {item: val for item, val in value.items()\n                         if self.is_valid_item(setting, item, attrs, metas)}\n            data[setting.name] = new_value\n        elif value is not None:\n            if (value[1] >= 0 and\n                    not self._var_exists(setting, value, attrs, metas)):\n                del data[setting.name]\n\n    def settings_to_widget(self, widget, domain, *args):\n        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:\n        #  - merged, remove this method.\n        #  - rejected, remove this comment.\n        context = widget.current_context\n        if context is None:\n            return\n\n        widget.retrieveSpecificSettings()\n\n        for setting, data, instance in \\\n                self.provider.traverse_settings(data=context.values, instance=widget):\n            if not isinstance(setting, ContextSetting) or setting.name not in data:\n                continue\n\n            value = self.decode_setting(setting, data[setting.name], domain)\n            _apply_setting(setting, instance, value)\n\n    @staticmethod\n    def encode_variable(var):\n        return var.name, 100 + vartype(var)\n\n    @classmethod\n    def encode_setting(cls, context, setting, value):\n        if isinstance(value, list):\n            if all(e is None or isinstance(e, Variable) for e in value) \\\n                    and any(e is not None for e in value):\n                return ([None if e is None else cls.encode_variable(e)\n                         for e in value],\n                        -3)\n            else:\n                return copy.copy(value)\n\n        elif isinstance(value, dict) \\\n                and all(isinstance(e, Variable) for e in value):\n            return ({cls.encode_variable(e): val for e, val in value.items()},\n                    -4)\n\n        if isinstance(value, Variable):\n            if isinstance(setting, ContextSetting):\n                return cls.encode_variable(value)\n            else:\n                raise ValueError(\"Variables must be stored as ContextSettings; \"\n                                 f\"change {setting.name} to ContextSetting.\")\n\n        return copy.copy(value), -2\n\n    def decode_setting(self, setting, value, domain=None, *args):\n        def get_var(name):\n            if domain is None:\n                raise ValueError(\"Cannot decode variable without domain\")\n            return domain[name]\n\n        if isinstance(value, tuple):\n            data, dtype = value\n            if dtype == -3:\n                return[None if name_type is None else get_var(name_type[0])\n                       for name_type in data]\n            if dtype == -4:\n                return {get_var(name): val for (name, _), val in data.items()}\n            if dtype >= 100:\n                return get_var(data)\n            return value[0]\n        else:\n            return value\n\n    @classmethod\n    def _var_exists(cls, setting, value, attributes, metas):\n        if not isinstance(value, tuple) or len(value) != 2:\n            return False\n\n        attr_name, attr_type = value\n        # attr_type used to be either 1-4 for variables stored as string\n        # settings, and 101-104 for variables stored as variables. The former is\n        # no longer supported, but we play it safe and still handle both here.\n        attr_type %= 100\n        return (not setting.exclude_attributes and\n                attributes.get(attr_name, -1) == attr_type or\n                not setting.exclude_metas and\n                metas.get(attr_name, -1) == attr_type)\n\n    def match(self, context, domain, attrs, metas):\n        matches = []\n        try:\n            for setting, data, _ in \\\n                    self.provider.traverse_settings(data=context.values):\n                if not isinstance(setting, ContextSetting):\n                    continue\n                value = data.get(setting.name, None)\n\n                if isinstance(value, list):\n                    matches.append(\n                        self.match_list(setting, value, context, attrs, metas))\n                # type check is a (not foolproof) check in case of a pair that\n                # would, by conincidence, have -3 or -4 as the second element\n                elif isinstance(value, tuple) and len(value) == 2 \\\n                       and (value[1] == -3 and isinstance(value[0], list)\n                            or (value[1] == -4 and isinstance(value[0], dict))):\n                    matches.append(self.match_list(setting, value[0], context,\n                                                   attrs, metas))\n                elif value is not None:\n                    matches.append(\n                        self.match_value(setting, value, attrs, metas))\n        except IncompatibleContext:\n            return self.NO_MATCH\n\n        if self.first_match:\n            return self.MATCH\n\n        matches.append((0, 0))\n        matched, available = [sum(m) for m in zip(*matches)]\n        return matched / available if available else 0.1\n\n    def match_list(self, setting, value, context, attrs, metas):\n        \"\"\"Match a list of values with the given context.\n        returns a tuple containing number of matched and all values.\n        \"\"\"\n        matched = 0\n        for item in value:\n            if self.is_valid_item(setting, item, attrs, metas):\n                matched += 1\n            elif setting.required == ContextSetting.REQUIRED:\n                raise IncompatibleContext()\n        return matched, len(value)\n\n    def match_value(self, setting, value, attrs, metas):\n        \"\"\"Match a single value \"\"\"\n        if value[1] < 0:\n            return 0, 0\n\n        if self._var_exists(setting, value, attrs, metas):\n            return 1, 1\n        elif setting.required == setting.OPTIONAL:\n            return 0, 1\n        else:\n            raise IncompatibleContext()\n\n    def is_valid_item(self, setting, item, attrs, metas):\n        \"\"\"Return True if given item can be used with attrs and metas\n\n        Subclasses can override this method to checks data in alternative\n        representations.\n        \"\"\"\n        if not isinstance(item, tuple):\n            return True\n        return self._var_exists(setting, item, attrs, metas)\n\n\nclass ClassValuesContextHandler(ContextHandler):\n    \"\"\"Context handler used for widgets that work with\n    a single discrete variable\"\"\"\n\n    def open_context(self, widget, classes):\n        if isinstance(classes, Variable):\n            if classes.is_discrete:\n                classes = classes.values\n            else:\n                classes = None\n\n        super().open_context(widget, classes)\n\n    def new_context(self, classes):\n        context = super().new_context()\n        context.classes = classes\n        return context\n\n    def match(self, context, classes):\n        if isinstance(classes, Variable) and classes.is_continuous:\n            return (self.PERFECT_MATCH if context.classes is None\n                    else self.NO_MATCH)\n        else:\n            # variable.values used to be a list, and so were context.classes\n            # cast to tuple for compatibility with past contexts\n            if context.classes is not None and tuple(context.classes) == classes:\n                return self.PERFECT_MATCH\n            else:\n                return self.NO_MATCH\n\n\nclass PerfectDomainContextHandler(DomainContextHandler):\n    \"\"\"Context handler that matches a context only when\n    the same domain is available.\n\n    It uses a different encoding than the DomainContextHandler.\n    \"\"\"\n\n    def new_context(self, domain, attributes, class_vars, metas):\n        \"\"\"Same as DomainContextHandler, but also store class_vars\"\"\"\n        context = super().new_context(domain, attributes, metas)\n        context.class_vars = class_vars\n        return context\n\n    def clone_context(self, old_context, *args):\n        \"\"\"Copy of context is always valid, since widgets are using\n        the same domain.\"\"\"\n        context = self.new_context(*args)\n        context.values = copy.deepcopy(old_context.values)\n        return context\n\n    def encode_domain(self, domain):\n        \"\"\"Encode domain into tuples (name, type)\n        A tuple is returned for each of attributes, class_vars and metas.\n        \"\"\"\n\n        if self.match_values == self.MATCH_VALUES_ALL:\n            def _encode(attrs):\n                return tuple((v.name, list(v.values) if v.is_discrete else vartype(v))\n                             for v in attrs)\n        else:\n            def _encode(attrs):\n                return tuple((v.name, vartype(v)) for v in attrs)\n        return (_encode(domain.attributes),\n                _encode(domain.class_vars),\n                _encode(domain.metas))\n\n    def match(self, context, domain, attributes, class_vars, metas):\n        \"\"\"Context only matches when domains are the same\"\"\"\n\n        return (self.PERFECT_MATCH\n                if (context.attributes == attributes and\n                    context.class_vars == class_vars and\n                    context.metas == metas)\n                else self.NO_MATCH)\n\n    def encode_setting(self, context, setting, value):\n        \"\"\"Same as is domain context handler, but handles separately stored\n        class_vars.\"\"\"\n\n        if isinstance(setting, ContextSetting) and isinstance(value, str):\n\n            def _candidate_variables():\n                if not setting.exclude_attributes:\n                    yield from itertools.chain(context.attributes,\n                                               context.class_vars)\n                if not setting.exclude_metas:\n                    yield from context.metas\n\n            for aname, atype in _candidate_variables():\n                if aname == value:\n                    return value, atype\n\n            return value, -1\n        else:\n            return super().encode_setting(context, setting, value)\n\n\ndef migrate_str_to_variable(settings, names=None, none_placeholder=None):\n    \"\"\"\n    Change variables stored as `(str, int)` to `(Variable, int)`.\n\n    Args:\n        settings (Context): context that is being migrated\n        names (sequence): names of settings to be migrated. If omitted,\n            all settings with values `(str, int)` are migrated.\n    \"\"\"\n    def _fix(name):\n        var, vartype = settings.values[name]\n        if 0 <= vartype <= 100:\n            settings.values[name] = (var, 100 + vartype)\n        elif var == none_placeholder and vartype == -2:\n            settings.values[name] = None\n\n    if names is None:\n        for name, setting in settings.values.items():\n            if isinstance(setting, tuple) and len(setting) == 2 and \\\n                    isinstance(setting[0], str) and isinstance(setting[1], int):\n                _fix(name)\n    elif isinstance(names, str):\n        _fix(names)\n    else:\n        for name in names:\n            _fix(name)\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:** DomainContextHandler.match Returns Full Match When No Matches Are Present

**Description:**
When there are no matches in the context, the `match` method of `DomainContextHandler` incorrectly returns a full match score. This behavior is unintended and leads to inaccurate match evaluations.

**Example Code:**
```python
handler = DomainContextHandler()
context = Mock(values={})
score = handler.match(context, domain, attributes, metas)
print(score)  # Outputs: 1
```

**Expected Behavior:**
The `match` method should return a low score (e.g., 0.1) when there are no matches, indicating that the context does not sufficiently match.

**Actual Behavior:**
The `match` method returns a full match score of `1` even when the context has no matches, which misrepresents the matching accuracy.

[/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/widgets/settings.py
"""Widget Settings and Settings Handlers

Settings are used to declare widget attributes that persist through sessions.
When widget is removed or saved to a schema file, its settings are packed,
serialized and stored. When a new widget is created, values of attributes
marked as settings are read from disk. When schema is loaded, attribute values
are set to one stored in schema.

Each widget has its own SettingsHandler that takes care of serializing and
storing of settings and SettingProvider that is incharge of reading and
writing the setting values.

All widgets extending from OWWidget use SettingsHandler, unless they
declare otherwise. SettingsHandler ensures that setting attributes
are replaced with default (last used) setting values when the widget is
initialized and stored when the widget is removed.

Widgets with settings whose values depend on the widget inputs use
settings handlers based on ContextHandler. These handlers have two
additional methods, open_context and close_context.

open_context is called when widgets receives new data. It finds a suitable
context and sets the widget attributes to the values stored in context.
If no suitable context exists, a new one is created and values from widget
are copied to it.

close_context stores values that were last used on the widget to the context
so they can be used alter. It should be called before widget starts modifying
(initializing) the value of the setting attributes.
"""

import copy
import itertools
import logging
import warnings

from orangewidget.settings import (
    Setting, SettingProvider, SettingsHandler, ContextSetting,
    ContextHandler, Context, IncompatibleContext, SettingsPrinter,
    rename_setting, widget_settings_dir
)
from orangewidget.settings import _apply_setting

from Orange.data import Domain, Variable
from Orange.util import OrangeDeprecationWarning
from Orange.widgets.utils import vartype

log = logging.getLogger(__name__)

__all__ = [
    # re-exported from orangewidget.settings
    "Setting", "SettingsHandler", "SettingProvider",
    "ContextSetting", "Context", "ContextHandler", "IncompatibleContext",
    "rename_setting", "widget_settings_dir",
    # defined here
    "DomainContextHandler", "PerfectDomainContextHandler",
    "ClassValuesContextHandler", "SettingsPrinter",
    "migrate_str_to_variable",
]


class DomainContextHandler(ContextHandler):
    """Context handler for widgets with settings that depend on
    the input dataset. Suitable settings are selected based on the
    data domain."""

    MATCH_VALUES_NONE, MATCH_VALUES_CLASS, MATCH_VALUES_ALL = range(3)

    def __init__(self, *, match_values=0, first_match=True, **kwargs):
        super().__init__()
        self.match_values = match_values
        self.first_match = first_match

        for name in kwargs:
            warnings.warn(
                "{} is not a valid parameter for DomainContextHandler"
                .format(name), OrangeDeprecationWarning
            )

    def encode_domain(self, domain):
        """
        domain: Orange.data.domain to encode
        return: dict mapping attribute name to type or list of values
                (based on the value of self.match_values attribute)
        """

        match = self.match_values
        encode = self.encode_variables
        if match == self.MATCH_VALUES_CLASS:
            attributes = encode(domain.attributes, False)
            attributes.update(encode(domain.class_vars, True))
        else:
            attributes = encode(domain.variables, match == self.MATCH_VALUES_ALL)

        metas = encode(domain.metas, match == self.MATCH_VALUES_ALL)

        return attributes, metas

    @staticmethod
    def encode_variables(attributes, encode_values):
        """Encode variables to a list mapping name to variable type
        or a list of values."""

        if not encode_values:
            return {v.name: vartype(v) for v in attributes}

        return {v.name: v.values if v.is_discrete else vartype(v)
                for v in attributes}

    def new_context(self, domain, attributes, metas):
        """Create a new context."""
        context = super().new_context()
        context.attributes = attributes
        context.metas = metas
        return context

    def open_context(self, widget, domain):
        if domain is None:
            return
        if not isinstance(domain, Domain):
            domain = domain.domain
        super().open_context(widget, domain, *self.encode_domain(domain))

    def filter_value(self, setting, data, domain, attrs, metas):
        value = data.get(setting.name, None)
        if isinstance(value, list):
            new_value = [item for item in value
                         if self.is_valid_item(setting, item, attrs, metas)]
            data[setting.name] = new_value
        elif isinstance(value, dict):
            new_value = {item: val for item, val in value.items()
                         if self.is_valid_item(setting, item, attrs, metas)}
            data[setting.name] = new_value
        elif value is not None:
            if (value[1] >= 0 and
                    not self._var_exists(setting, value, attrs, metas)):
                del data[setting.name]

    def settings_to_widget(self, widget, domain, *args):
        # TODO: If https://github.com/biolab/orange-widget-base/pull/56 is:
        #  - merged, remove this method.
        #  - rejected, remove this comment.
        context = widget.current_context
        if context is None:
            return

        widget.retrieveSpecificSettings()

        for setting, data, instance in \
                self.provider.traverse_settings(data=context.values, instance=widget):
            if not isinstance(setting, ContextSetting) or setting.name not in data:
                continue

            value = self.decode_setting(setting, data[setting.name], domain)
            _apply_setting(setting, instance, value)

    @staticmethod
    def encode_variable(var):
        return var.name, 100 + vartype(var)

    @classmethod
    def encode_setting(cls, context, setting, value):
        if isinstance(value, list):
            if all(e is None or isinstance(e, Variable) for e in value) \
                    and any(e is not None for e in value):
                return ([None if e is None else cls.encode_variable(e)
                         for e in value],
                        -3)
            else:
                return copy.copy(value)

        elif isinstance(value, dict) \
                and all(isinstance(e, Variable) for e in value):
            return ({cls.encode_variable(e): val for e, val in value.items()},
                    -4)

        if isinstance(value, Variable):
            if isinstance(setting, ContextSetting):
                return cls.encode_variable(value)
            else:
                raise ValueError("Variables must be stored as ContextSettings; "
                                 f"change {setting.name} to ContextSetting.")

        return copy.copy(value), -2

    def decode_setting(self, setting, value, domain=None, *args):
        def get_var(name):
            if domain is None:
                raise ValueError("Cannot decode variable without domain")
            return domain[name]

        if isinstance(value, tuple):
            data, dtype = value
            if dtype == -3:
                return[None if name_type is None else get_var(name_type[0])
                       for name_type in data]
            if dtype == -4:
                return {get_var(name): val for (name, _), val in data.items()}
            if dtype >= 100:
                return get_var(data)
            return value[0]
        else:
            return value

    @classmethod
    def _var_exists(cls, setting, value, attributes, metas):
        if not isinstance(value, tuple) or len(value) != 2:
            return False

        attr_name, attr_type = value
        # attr_type used to be either 1-4 for variables stored as string
        # settings, and 101-104 for variables stored as variables. The former is
        # no longer supported, but we play it safe and still handle both here.
        attr_type %= 100
        return (not setting.exclude_attributes and
                attributes.get(attr_name, -1) == attr_type or
                not setting.exclude_metas and
                metas.get(attr_name, -1) == attr_type)

    def match(self, context, domain, attrs, metas):
        matches = []
        try:
            for setting, data, _ in \
                    self.provider.traverse_settings(data=context.values):
                if not isinstance(setting, ContextSetting):
                    continue
                value = data.get(setting.name, None)

                if isinstance(value, list):
                    matches.append(
                        self.match_list(setting, value, context, attrs, metas))
                # type check is a (not foolproof) check in case of a pair that
                # would, by conincidence, have -3 or -4 as the second element
                elif isinstance(value, tuple) and len(value) == 2 \
                       and (value[1] == -3 and isinstance(value[0], list)
                            or (value[1] == -4 and isinstance(value[0], dict))):
                    matches.append(self.match_list(setting, value[0], context,
                                                   attrs, metas))
                elif value is not None:
                    matches.append(
                        self.match_value(setting, value, attrs, metas))
        except IncompatibleContext:
            return self.NO_MATCH

        if self.first_match:
            return self.MATCH

        matches.append((0, 0))
        matched, available = [sum(m) for m in zip(*matches)]
        return matched / available if available else 0.1

    def match_list(self, setting, value, context, attrs, metas):
        """Match a list of values with the given context.
        returns a tuple containing number of matched and all values.
        """
        matched = 0
        for item in value:
            if self.is_valid_item(setting, item, attrs, metas):
                matched += 1
            elif setting.required == ContextSetting.REQUIRED:
                raise IncompatibleContext()
        return matched, len(value)

    def match_value(self, setting, value, attrs, metas):
        """Match a single value """
        if value[1] < 0:
            return 0, 0

        if self._var_exists(setting, value, attrs, metas):
            return 1, 1
        elif setting.required == setting.OPTIONAL:
            return 0, 1
        else:
            raise IncompatibleContext()

    def is_valid_item(self, setting, item, attrs, metas):
        """Return True if given item can be used with attrs and metas

        Subclasses can override this method to checks data in alternative
        representations.
        """
        if not isinstance(item, tuple):
            return True
        return self._var_exists(setting, item, attrs, metas)


class ClassValuesContextHandler(ContextHandler):
    """Context handler used for widgets that work with
    a single discrete variable"""

    def open_context(self, widget, classes):
        if isinstance(classes, Variable):
            if classes.is_discrete:
                classes = classes.values
            else:
                classes = None

        super().open_context(widget, classes)

    def new_context(self, classes):
        context = super().new_context()
        context.classes = classes
        return context

    def match(self, context, classes):
        if isinstance(classes, Variable) and classes.is_continuous:
            return (self.PERFECT_MATCH if context.classes is None
                    else self.NO_MATCH)
        else:
            # variable.values used to be a list, and so were context.classes
            # cast to tuple for compatibility with past contexts
            if context.classes is not None and tuple(context.classes) == classes:
                return self.PERFECT_MATCH
            else:
                return self.NO_MATCH


class PerfectDomainContextHandler(DomainContextHandler):
    """Context handler that matches a context only when
    the same domain is available.

    It uses a different encoding than the DomainContextHandler.
    """

    def new_context(self, domain, attributes, class_vars, metas):
        """Same as DomainContextHandler, but also store class_vars"""
        context = super().new_context(domain, attributes, metas)
        context.class_vars = class_vars
        return context

    def clone_context(self, old_context, *args):
        """Copy of context is always valid, since widgets are using
        the same domain."""
        context = self.new_context(*args)
        context.values = copy.deepcopy(old_context.values)
        return context

    def encode_domain(self, domain):
        """Encode domain into tuples (name, type)
        A tuple is returned for each of attributes, class_vars and metas.
        """

        if self.match_values == self.MATCH_VALUES_ALL:
            def _encode(attrs):
                return tuple((v.name, list(v.values) if v.is_discrete else vartype(v))
                             for v in attrs)
        else:
            def _encode(attrs):
                return tuple((v.name, vartype(v)) for v in attrs)
        return (_encode(domain.attributes),
                _encode(domain.class_vars),
                _encode(domain.metas))

    def match(self, context, domain, attributes, class_vars, metas):
        """Context only matches when domains are the same"""

        return (self.PERFECT_MATCH
                if (context.attributes == attributes and
                    context.class_vars == class_vars and
                    context.metas == metas)
                else self.NO_MATCH)

    def encode_setting(self, context, setting, value):
        """Same as is domain context handler, but handles separately stored
        class_vars."""

        if isinstance(setting, ContextSetting) and isinstance(value, str):

            def _candidate_variables():
                if not setting.exclude_attributes:
                    yield from itertools.chain(context.attributes,
                                               context.class_vars)
                if not setting.exclude_metas:
                    yield from context.metas

            for aname, atype in _candidate_variables():
                if aname == value:
                    return value, atype

            return value, -1
        else:
            return super().encode_setting(context, setting, value)


def migrate_str_to_variable(settings, names=None, none_placeholder=None):
    """
    Change variables stored as `(str, int)` to `(Variable, int)`.

    Args:
        settings (Context): context that is being migrated
        names (sequence): names of settings to be migrated. If omitted,
            all settings with values `(str, int)` are migrated.
    """
    def _fix(name):
        var, vartype = settings.values[name]
        if 0 <= vartype <= 100:
            settings.values[name] = (var, 100 + vartype)
        elif var == none_placeholder and vartype == -2:
            settings.values[name] = None

    if names is None:
        for name, setting in settings.values.items():
            if isinstance(setting, tuple) and len(setting) == 2 and \
                    isinstance(setting[0], str) and isinstance(setting[1], int):
                _fix(name)
    elif isinstance(names, str):
        _fix(names)
    else:
        for name in names:
            _fix(name)

```
--- 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