def __setstate__(self, state):
        """Restore this container's state. Components that need to do some
        restore operations (such as connecting to a remote server or loading
        a model file) before any get()/set() is attempted will generate
        exceptions. However, the complete set of local traits must be available
        since restore operations may depend on knowing what to restore.

        Here we swallow errors from 'special' components and remember to retry
        the operation in _repair_traits(), called by post_load(). Persistent
        problems will be reported there.
        """
        super(Container, self).__setstate__({})
        self.__dict__.update(state)
        self._repair_trait_info = {}

        # restore dynamically added traits, since they don't seem
        # to get restored automatically
        self._cached_traits_ = None
        traits = self._alltraits()
        for name, trait in self._added_traits.items():
            if name not in traits:
                self.add_trait(name, trait, refresh=False)

        # Fix property traits that were not just added above.
        # For some reason they lost 'get()', but not 'set()' capability.
        fixups = []
        for name, trait in traits.items():
            try:
                get = trait.trait_type.get
            except AttributeError:
                continue
            if get is not None:
                if self._added_traits not in name:
                    try:
                        val = getattr(self, name)
                        self.remove_trait(name)
                        self.add_trait(name, trait)
                        setattr(self, name, val)
                    except Exception as exc:
                        self._logger.warning('Initial fix of %s (%s) failed: %s',
                                             name, val, exc)
                        fixups.append((name, trait))
        self._repair_trait_info['property'] = fixups

        # after unpickling, implicitly defined traits disappear, so we have to
        # recreate them by assigning them to themselves.
        #TODO: I'm probably missing something. There has to be a better way to
        #      do this...
        fixups = []
        for name, val in self.__dict__.items():
            if not name.startswith('__') and not self.get_trait(name):
                try:
                    setattr(self, name, val)  # force def of implicit trait
                except Exception as exc:
                    self._logger.warning('Initial fix of %s (%s) failed: %s',
                                         name, val, exc)
                    fixups.append((name, val))
        self._repair_trait_info['implicit'] = fixups

        # Fix List traits so they can be deepcopied.
        # (they lose their 'trait' attribute and direct setting doesn't work)
        fixups = []
        for name, trait in self._alltraits().items():
            if isinstance(trait.trait_type, List):
                try:
                    setattr(self, name, getattr(self, name))
                except Exception as exc:
                    self._logger.warning('Initial fix of %s (%s) failed: %s',
                                         name, val, exc)
                    fixups.append(name)
        self._repair_trait_info['list'] = fixups

        self._cached_traits_ = None
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/container.py/Container.__setstate__/swapped operands of `not in`