示例#1
0
    def add_attr(self, logging=True, **kwargs):
        """
        Similar as config, but add a new attribute.
        """

        self._attrs_registered.extend(kwargs.keys())
        pyclass.set_object_attributes(self,
                                      append=True,
                                      logging=logging,
                                      **kwargs)
示例#2
0
    def config(self, logging=True, **kwargs):
        """
        Configure the variable attributes. If the attribute is not the default attributes, return error.

        :param logging: If True, show logging.
        :param kwargs: A dictionary of the attributes.
        :return: None
        """
        pyclass.set_object_attributes(self,
                                      append=False,
                                      logging=logging,
                                      **kwargs)
示例#3
0
    def config(self, logging: bool = True, **kwargs) -> None:
        """
        Configure the attributes of the dataset.

        :param logging: Show logging if True.
        :param kwargs:
        :return:
        """
        pyclass.set_object_attributes(self,
                                      append=False,
                                      logging=logging,
                                      **kwargs)
示例#4
0
    def visual(self, value):

        if value == 'new':
            self._visual = Visual(variable=self)
        elif value == 'on':
            if not isinstance(self._visual, Visual):
                self.visual = 'new'
        elif isinstance(value, Visual):
            self._visual = value
        elif type(value) is dict:
            if not isinstance(self._visual, Visual):
                self.visual = 'new'
            pyclass.set_object_attributes(self.visual,
                                          append=False,
                                          logging=True,
                                          **value)
        elif value == 'off':
            self._visual = None
        else:
            raise ValueError
示例#5
0
 def config(self, logging=True, **kwargs):
     pyclass.set_object_attributes(self,
                                   append=False,
                                   logging=logging,
                                   **kwargs)
示例#6
0
 def add_attr(self, logging=True, **kwargs):
     pyclass.set_object_attributes(self,
                                   append=True,
                                   logging=logging,
                                   **kwargs)