def __init__(self, **kwargs):
        # A bit of a hack to copy all our class attributes
        for class_attr in dir(self):
            if class_attr in kwargs:
                continue
            att = getattr(self, class_attr)
            # We want to copy all the nodes as well as the list, this is a
            # succinct way to do it
            if class_attr in ['_node_list', '_validation_list', '_event_lists']:
                setattr(self, class_attr, copy.deepcopy(att))
            # Private attributes are internal stuff..
            elif not class_attr.startswith('__'):
                # don't try to copy functions, it doesn't go well
                if not callable(att):
                    setattr(self, class_attr, copy.copy(att))
                    self.context[class_attr] = att

        # Set a default name for our Form
        if self.name is None:
            self.name = self.__class__.__name__

        # pass some attributes to start/close nodes
        self.context['name'] = self.name
        self.context['title'] = self.title

        # run our safety checks, set identifiers, and set local attributes
        for node in self._node_list:
            self._setup_node(node)

        # passes everything to our rendering context and updates params.
        self.context.update(kwargs)
        self.__dict__.update(kwargs)

        # Add our open and close form defaults
        if hasattr(self, 'start'):
            self._node_list.insert(0, self.start)
        else:
            if self.auto_start_close:
                self.insert(0, LeaderNode(template=self.start_template,
                                        _attr_name='start',
                                        **self.context))
        if hasattr(self, 'close'):
            self._node_list.append(self.close)
        else:
            if self.auto_start_close:
                self.insert(-1, LeaderNode(template=self.close_template,
                                           _attr_name='close',
                                           **self.context))

        # Add some useful global variables for templates
        default_globals = {'form_id': self.name}
        # Let our globals be overridden
        default_globals.update(self.g_context)
        self.g_context = default_globals

        # Initialize some general state variable
        self._last_valid = None
        self._last_raw_json = None
dataset/ETHPy150Open icook/yota/src/yota/__init__.py/Form.__init__/original