(self, index, role,
             # For optimizing out LOAD_GLOBAL byte code instructions in
             # the item role tests.
             _str=str,
             _Qt_DisplayRole=Qt.DisplayRole,
             _Qt_EditRole=Qt.EditRole,
             _Qt_BackgroundRole=Qt.BackgroundRole,
             _ValueRole=ValueRole,
             _ClassValueRole=ClassValueRole,
             _VariableRole=VariableRole,
             _DomainRole=DomainRole,
             _VariableStatsRole=VariableStatsRole,
             # Some cached local precomputed values.
             # All of the above roles we respond to
             _recognizedRoles=frozenset([Qt.DisplayRole,
                                         Qt.EditRole,
                                         Qt.BackgroundRole,
                                         ValueRole,
                                         ClassValueRole,
                                         VariableRole,
                                         DomainRole,
                                         VariableStatsRole]))
Reimplemented from `QAbstractItemModel.data`
Reimplemented from `QAbstractItemModel.data`
Reimplemented from QAbstractItemModel . data
def data(self, index, role,
             # For optimizing out LOAD_GLOBAL byte code instructions in
             # the item role tests.
             _str=str,
             _Qt_DisplayRole=Qt.DisplayRole,
             _Qt_EditRole=Qt.EditRole,
             _Qt_BackgroundRole=Qt.BackgroundRole,
             _ValueRole=ValueRole,
             _ClassValueRole=ClassValueRole,
             _VariableRole=VariableRole,
             _DomainRole=DomainRole,
             _VariableStatsRole=VariableStatsRole,
             # Some cached local precomputed values.
             # All of the above roles we respond to
             _recognizedRoles=frozenset([Qt.DisplayRole,
                                         Qt.EditRole,
                                         Qt.BackgroundRole,
                                         ValueRole,
                                         ClassValueRole,
                                         VariableRole,
                                         DomainRole,
                                         VariableStatsRole])):
        """
        Reimplemented from `QAbstractItemModel.data`
        """
        if role not in _recognizedRoles:
            return None

        row, col = index.row(), index.column()
        if  not 0 <= row <= self.__rowCount:
            return None

        row = self.mapToSourceRows(row)

        try:
            instance = self._row_instance(row)
        except IndexError:
            self.layoutAboutToBeChanged.emit()
            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))
            self.__rowCount = min(row, self.__rowCount)
            self.endRemoveRows()
            self.layoutChanged.emit()
            return None
        coldesc = self.columns[col]

        if role == _Qt_DisplayRole:
            return coldesc.format(instance)
        elif role == _Qt_EditRole and isinstance(coldesc, TableModel.Column):
            return instance[coldesc.var]
        elif role == _Qt_BackgroundRole:
            return coldesc.background
        elif role == _ValueRole and isinstance(coldesc, TableModel.Column):
            return instance[coldesc.var]
        elif role == _ClassValueRole:
            try:
                return instance.get_class()
            except TypeError:
                return None
        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):
            return coldesc.var
        elif role == _DomainRole:
            return coldesc.role
        elif role == _VariableStatsRole:
            return self._stats_for_column(col)
        else:
            return None
def data ( self , index , role , # For optimizing out LOAD_GLOBAL byte code instructions in # the item role tests. _str = str , _Qt_DisplayRole = Qt . DisplayRole , _Qt_EditRole = Qt . EditRole , _Qt_BackgroundRole = Qt . BackgroundRole , _ValueRole = ValueRole , _ClassValueRole = ClassValueRole , _VariableRole = VariableRole , _DomainRole = DomainRole , _VariableStatsRole = VariableStatsRole , # Some cached local precomputed values. # All of the above roles we respond to _recognizedRoles = frozenset ( [ Qt . DisplayRole , Qt . EditRole , Qt . BackgroundRole , ValueRole , ClassValueRole , VariableRole , DomainRole , VariableStatsRole ] ) ) : if role not in _recognizedRoles : return None row , col = index . row ( ) , index . column ( ) if not 0 <= row <= self . __rowCount : return None row = self . mapToSourceRows ( row ) try : instance = self . _row_instance ( row ) except IndexError : self . layoutAboutToBeChanged . emit ( ) self . beginRemoveRows ( self . parent ( ) , row , max ( self . rowCount ( ) , row ) ) self . __rowCount = min ( row , self . __rowCount ) self . endRemoveRows ( ) self . layoutChanged . emit ( ) return None coldesc = self . columns [ col ] if role == _Qt_DisplayRole : return coldesc . format ( instance ) elif role == _Qt_EditRole and isinstance ( coldesc , TableModel . Column ) : return instance [ coldesc . var ] elif role == _Qt_BackgroundRole : return coldesc . background elif role == _ValueRole and isinstance ( coldesc , TableModel . Column ) : return instance [ coldesc . var ] elif role == _ClassValueRole : try : return instance . get_class ( ) except TypeError : return None elif role == _VariableRole and isinstance ( coldesc , TableModel . Column ) : return coldesc . var elif role == _DomainRole : return coldesc . role elif role == _VariableStatsRole : return self . _stats_for_column ( col ) else : return None