List the model's capabilities.
484166
def get_capabilities(cls):
        """"""
        capabilities = []
        for _cls in cls.mro():
            if issubclass(_cls, Capability) and _cls is not Capability \
              and not issubclass(_cls, Model):
                capabilities.append(_cls)
        return capabilities
337167
def add_capability(base, *classes):
    """"""
    if _debug: add_capability._debug("add_capability %r %r", base, classes)

    # start out with a collector
    if not issubclass(base, Collector):
        raise TypeError("base must be a subclass of Collector")

    # make sure you only add capabilities
    for cls in classes:
        if not issubclass(cls, Capability):
            raise TypeError("%s is not a Capability subclass" % (cls,))

    base.__bases__ += classes
    for cls in classes:
        base.__name__ += '+' + cls.__name__
36867
def check(cls, model, require_extra=False):
        
        class_capable = isinstance(model, cls)

        f_name = model.extra_capability_checks.get(cls, None) \
            if model.extra_capability_checks is not None \
            else False

        if f_name:
            f = getattr(model, f_name)
            instance_capable = f()
        elif not require_extra:
            instance_capable = True
        else:
            instance_capable = False
        return class_capable and instance_capable
634816
public function get_capabilities() {
        global $DB;

        $sort = 'ORDER BY contextlevel,component,name';   // To group them sensibly for display

        $extracaps = array('moodle/grade:viewall');
        list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap');
        $sql = "SELECT *
                  FROM {capabilities}
                 WHERE contextlevel = ".CONTEXT_USER."
                       OR name $extra";

        return $records = $DB->get_records_sql($sql.' '.$sort, $params);
    }
1118555
public static function list_models() {
        cli_heading("List of models");
        echo str_pad(get_string('modelid', 'tool_analytics'), 15, ' ') . ' ' . str_pad(get_string('name'), 50, ' ') .
            ' ' . str_pad(get_string('status'), 15, ' ') . "\n";
        $models = \core_analytics\manager::get_all_models();
        foreach ($models as $model) {
            $modelid = $model->get_id();
            $isenabled = $model->is_enabled() ? get_string('enabled', 'tool_analytics') : get_string('disabled', 'tool_analytics');
            $name = $model->get_name();
            echo str_pad($modelid, 15, ' ') . ' ' . str_pad($name, 50, ' ') . ' ' . str_pad($isenabled, 15, ' ') . "\n";
        }
    }
725051
public function capability()
    {
        $response = $this->requestAndResponse('CAPABILITY');

        if (!$response) {
            return $response;
        }

        $capabilities = array();
        foreach ($response as $line) {
            $capabilities = array_merge($capabilities, $line);
        }
        return $capabilities;
    }
508666
def page_models(self, constructor, paging, constraints=None, *, columns=None, order_by=None):
    """"""
    records, count = self.page(constructor.table_name, paging, constraints, columns=columns,
                               order_by=order_by)
    return ([constructor(r) for r in records], count)
1000443
def records(self):
        """"""
        return ModelList(*[r for sent in self.sentences for r in sent.records])
291763
def to_capabilities(self):
        
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(self._caps)
        opera_options = capabilities[self.KEY]

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
316851
def device_capability_types
      # Capabilities are appended to the bos header
      ptr = pointer + offset_of(:dev_capability)
      bNumDeviceCaps.times.map do
        cap = DeviceCapability.new self, ptr.read_pointer
        ptr += FFI.type_size(:pointer)
        Call::BosTypes.find cap.bDevCapabilityType
      end
    end
1116484
def get_abilities():
    """"""
    page = requests.get('http://bulbapedia.bulbagarden.net/wiki/Ability')
    soup = bs4.BeautifulSoup(page.text)
    table = soup.find("table", {"class": "sortable"})
    tablerows = [tr for tr in table.children if tr != '\n'][1:]
    abilities = {}

    for tr in tablerows:
        cells = tr.find_all('td')
        ability_name = cells[1].get_text().strip().replace(' ', '-').lower()
        ability_desc = unicode(cells[2].get_text().strip())
        abilities[ability_name] = ability_desc

    srcpath = path.dirname(__file__)
    with io.open(path.join(srcpath, 'abilities.json'), 'w', encoding='utf-8') as f:
        f.write(json.dumps(abilities, ensure_ascii=False))
1321652
def _search_capability(self, base):
        """"""
        if _debug: Collector._debug("_search_capability %r", base)

        rslt = []
        for cls in base.__bases__:
            if issubclass(cls, Collector):
                map( rslt.append, self._search_capability(cls))
            elif issubclass(cls, Capability):
                rslt.append(cls)
        if _debug: Collector._debug("    - rslt: %r", rslt)

        return rslt
735017
public function get_capabilities() {
        global $DB;

        $sort = 'ORDER BY contextlevel,component,name';   // To group them sensibly for display

        $params = array();
        $bi = $DB->get_record('block_instances', array('id' => $this->_instanceid));

        $extra = '';
        $extracaps = block_method_result($bi->blockname, 'get_extra_capabilities');
        if ($extracaps) {
            list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap');
            $extra = "OR name $extra";
        }

        $sql = "SELECT *
                  FROM {capabilities}
                 WHERE (contextlevel = ".CONTEXT_BLOCK."
                       AND component = :component)
                       $extra";
        $params['component'] = 'block_' . $bi->blockname;

        return $DB->get_records_sql($sql.' '.$sort, $params);
    }
602660
function (name, callback) {
      capabilities[name] = function() {
        var result = callback();
        capabilities[name] = function() {
          return result;
        };

        return result;
      };
    }
1350152
def capability_info(self, name=None):
        
        for r in self.resources:
            if (r.capability == name):
                return(r)
        return(None)
663920
def list_models(self):
        
        try:
            count = self.es.count(index=self.index_name,
                                  doc_type=self.DOC_TYPE, q='*')['count']
            from_ = 0
            while from_ < count:
                ret = self.es.search(index=self.index_name,
                                     doc_type=self.DOC_TYPE, q='*',
                                     size=self.BATCH_SIZE, from_=from_,
                                     _source=self.PACKAGE_FIELDS)
                for hit in ret.get('hits', {}).get('hits', []):
                    yield hit['_source']['id']
                from_ += self.BATCH_SIZE
        except NotFoundError:
            return
706884
def abilities(api_key=None, add_headers=None):
    """"""
    client = ClientMixin(api_key=api_key)
    result = client.request('GET', endpoint='abilities',
                            add_headers=add_headers,)
    return result['abilities']