Returns the data at an index for a certain role
973728
def data(self, index, role = Qt.DisplayRole):
        
        try:
            if role == Qt.DisplayRole:
                return to_string(self._cellValue(index), masked=self._cellMask(index),
                                 decode_bytes=self.encoding, maskFormat=self.maskFormat,
                                 strFormat=self.strFormat, intFormat=self.intFormat,
                                 numFormat=self.numFormat, otherFormat=self.otherFormat)

            elif role == Qt.FontRole:
                #assert self._font, "Font undefined"
                return self._font

            elif role == Qt.TextColorRole:
                masked = self._cellMask(index)
                if not is_an_array(masked) and masked:
                    return self.missingColor
                else:
                    return self.dataColor

            elif role == Qt.TextAlignmentRole:
                if self.horAlignment == ALIGN_SMART:
                    cellContainsNumber = isinstance(self._cellValue(index), numbers.Number)
                    horAlign = Qt.AlignRight if cellContainsNumber else Qt.AlignLeft
                    return horAlign | self.verAlignment
                else:
                    return self.horAlignment | self.verAlignment

            else:
                return None
        except Exception as ex:
            logger.error("Slot is not exception-safe.")
            logger.exception(ex)
            if DEBUGGING:
                raise
815144
def _get_data(self) -> BaseFrameManager:
        

        def iloc(partition, row_internal_indices, col_internal_indices):
            return partition.iloc[row_internal_indices, col_internal_indices]

        masked_data = self.parent_data.apply_func_to_indices_both_axis(
            func=iloc,
            row_indices=self.index_map.values,
            col_indices=self.columns_map.values,
            lazy=False,
            keep_remaining=False,
        )
        return masked_data
1222601
def to_index(self, index_type, index_name, includes=None):
        
        return IndexField(self.name, self.data_type, index_type, index_name, includes)
73150
def lessThan(self, leftIndex, rightIndex):
        
        leftData  = self.sourceModel().data(leftIndex,  RegistryTableModel.SORT_ROLE)
        rightData = self.sourceModel().data(rightIndex, RegistryTableModel.SORT_ROLE)

        return leftData < rightData
1053714
def _getRole(self, matchedVars):
        
        role = matchedVars.get(ROLE)
        if role is not None and role.strip() == '':
            role = NULL
        else:
            valid = Authoriser.isValidRoleName(role)
            if valid:
                role = Authoriser.getRoleFromName(role)
            else:
                self.print("Invalid role. Valid roles are: {}".
                           format(", ".join(map(lambda r: r.name, Roles))),
                           Token.Error)
                return False
        return role
477967
function getRequiredRoleList (resourceType, resourceName, action, rbacIndex) {
  // What roles will allow this?
  const unrestricted = dottie.get(rbacIndex, '*.*.*') || []
  const unrestrictedInADomain = dottie.get(rbacIndex, `${resourceType}.*.*`) || []
  const anyActionOnASpecificResource = dottie.get(rbacIndex, `${resourceType}.${resourceName}.*`) || []
  const anyDomainResourceForASpecificAction = dottie.get(rbacIndex, `${resourceType}.*.${action}`) || []
  const specific = dottie.get(rbacIndex, `${resourceType}.${resourceName}.${action}`) || []

  return unrestricted.concat(
    unrestrictedInADomain,
    anyActionOnASpecificResource,
    anyDomainResourceForASpecificAction,
    specific
  )
}
762581
def get(self, index):
        """"""
        assert index <= self.count
        assert index < self.size
        offset = index * self.chunk_size
        return self.data[offset:offset + self.chunk_size]
838809
def get( index )
      raise "Only positive indexes, #{index}" if index < 0
      if index >= data_length
        return nil unless next_list
        return next_list.get( index - data_length)
      else
        ret = nil
        if(index < get_length)
          ret = get_internal_word(index + self.class.type_length )
        end
        return ret
      end
    end
1046389
def data(self, index, role=Qt.DisplayRole):
        """"""
        if not index.isValid() or not 0 <= index.row() < len(self._rows):
            return to_qvariant()
        row = index.row()
        column = index.column()

        name, state = self.row(row)

        if role == Qt.DisplayRole or role == Qt.EditRole:
            if column == 0:
                return to_qvariant(name)
        elif role == Qt.CheckStateRole:
            if column == 0:
                if state:
                    return Qt.Checked
                else:
                    return Qt.Unchecked
            if column == 1:
                return to_qvariant(state)
        return to_qvariant()
337531
def __item_data(self, model, index):
        """"""
        item = model.items[index]

        data = {
            "name": item.name,
            "data": item.data,
            "doc": getattr(item, "doc", None),
            "path": getattr(item, "path", None),
        }

        return data
1327431
def get_index(self, index, startkey, endkey=None, return_terms=None,
                  max_results=None, continuation=None, timeout=None,
                  term_regex=None):
        
        return self._client.get_index(self, index, startkey, endkey,
                                      return_terms=return_terms,
                                      max_results=max_results,
                                      continuation=continuation,
                                      timeout=timeout, term_regex=term_regex)
383240
def data(self, index, role):
        
        item = self.itemAt(index)
        if not item:
            return None
        d = item.declaration
        if role == Qt.DisplayRole:
            return d.text
        elif role == Qt.ToolTipRole:
            return d.tool_tip
        elif role == Qt.CheckStateRole and d.checkable:
            return d.checked and Qt.Checked or Qt.Unchecked
        elif role == Qt.DecorationRole and d.icon:
            return get_cached_qicon(d.icon)
        elif role == Qt.EditRole and d.editable:
            return d.text
        elif role == Qt.StatusTipRole:
            return d.status_tip
        elif role == Qt.TextAlignmentRole:
            h, v = d.text_alignment
            return TEXT_H_ALIGNMENTS[h] | TEXT_V_ALIGNMENTS[v]
        elif role == Qt.ForegroundRole and d.foreground:
            return get_cached_qcolor(d.foreground)
        elif role == Qt.BackgroundRole and d.background:
            return get_cached_qcolor(d.background)
        #elif role == Qt.SizeHintRole and d.minimum_size:
        #    return d.minimum_size

        return None
294231
def get_roles(self):
        """"""
        work_ids = self.get_works().values_list('id', flat=True)
        return self.works.through.objects.filter(
            creator=self.get_draft(),
            work_id__in=work_ids,
        ).select_related('role')
273246
def get_column_at_index(self, index):
        
        if index is None:
            return None

        url = self.build_url(self._endpoints.get('get_column_index'))
        response = self.session.post(url, data={'index': index})

        if not response:
            return None

        return self.column_constructor(parent=self, **{self._cloud_data_key: response.json()})
1068872
def role(organization = nil)
      # Return cached version if available
      return self.read_attribute(:role) if !organization

      # Find in arrays if organizations have been fetched
      # already. Perform remote query otherwise
      org = begin
        if self.organizations.loaded?
          self.organizations.to_a.find { |e| e.id == organization.id }
        else
          self.organizations.where(id: organization.id).first
        end
      end

      org ? org.role : nil
    end
556523
def indexable_role(principal):
    
    principal = unwrap(principal)

    if hasattr(principal, "is_anonymous") and principal.is_anonymous:
        # transform anonymous user to anonymous role
        principal = Anonymous

    if isinstance(principal, Role):
        return f"role:{principal.name}"
    elif isinstance(principal, User):
        fmt = "user:{:d}"
    elif isinstance(principal, Group):
        fmt = "group:{:d}"
    else:
        raise ValueError(repr(principal))

    return fmt.format(principal.id)
1084158
def list_roles():
    
    click.echo(green('\nListing roles:'))
    click.echo(green('-' * 40))
    with get_app().app_context():
        roles = Role.query.all()
        if not roles:
            click.echo(red('No roles found'))
            return

        for index,role in enumerate(roles):
            click.echo('{}. {}: {}'.format(
                index + 1,
                yellow(role.handle),
                role.title
            ))

    click.echo()