Capabilities checker
162513
protected function hasCapability($name)
    {
        if (empty($this->capability) || $name == '') {
            return false;
        }

        if (in_array($name, $this->capability)) {
            return true;
        }
        else if (strpos($name, '=')) {
            return false;
        }

        $result = array();
        foreach ($this->capability as $cap) {
            $entry = explode('=', $cap);
            if ($entry[0] == $name) {
                $result[] = $entry[1];
            }
        }

        return $result ?: false;
    }
629487
private boolean isValid(Map<String, Object> capability) {
        return capability != null && capability.containsKey(BUNDLE_NAME);
    }
1284343
@Override
    public Set<Capability> getCapabilities(FileSystem fs, Path path) {
        if (logger.isDebugEnabled()) {
            logger.debug("orc file path: " + path.toUri().getPath());
        }

        Reader orcReader = null;
        RecordReader recordReader = null;
        try {
            // no need to close orcreader
            orcReader = OrcFile.createReader(fs, path);
            recordReader = orcReader.rows(null);
        } catch (Exception e) {
            if (logger.isDebugEnabled()) {
                logger.debug(path.toUri().getPath() + " is not a ORC file.");
                logger.debug("Error in opening ORC file: "
                    + e.getLocalizedMessage());
            }
            return EnumSet.noneOf(Capability.class);
        } finally {
            if (recordReader != null) {
                try {
                    recordReader.close();
                } catch (IOException e) {
                    logger.error(e);
                }
            }
        }
        return EnumSet.of(Capability.READ, Capability.SCHEMA);
    }
638482
def has_capabilities(self, *caps):
		
		for cap in caps:
			if isinstance(cap, WNetworkClientCapabilities) is True:
				cap = cap.value
			if WCapabilitiesHolder.has_capabilities(self, cap) is False:
				return False
		return True
611062
public function get_capabilities() {
        global $DB, $CFG;

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

        $cm = $DB->get_record('course_modules', array('id'=>$this->_instanceid));
        $module = $DB->get_record('modules', array('id'=>$cm->module));

        $subcaps = array();
        $subpluginsfile = "$CFG->dirroot/mod/$module->name/db/subplugins.php";
        if (file_exists($subpluginsfile)) {
            $subplugins = array();  // should be redefined in the file
            include($subpluginsfile);
            if (!empty($subplugins)) {
                foreach (array_keys($subplugins) as $subplugintype) {
                    foreach (array_keys(core_component::get_plugin_list($subplugintype)) as $subpluginname) {
                        $subcaps = array_merge($subcaps, array_keys(load_capability_def($subplugintype.'_'.$subpluginname)));
                    }
                }
            }
        }

        $modfile = "$CFG->dirroot/mod/$module->name/lib.php";
        $extracaps = array();
        if (file_exists($modfile)) {
            include_once($modfile);
            $modfunction = $module->name.'_get_extra_capabilities';
            if (function_exists($modfunction)) {
                $extracaps = $modfunction();
            }
        }

        $extracaps = array_merge($subcaps, $extracaps);
        $extra = '';
        list($extra, $params) = $DB->get_in_or_equal(
            $extracaps, SQL_PARAMS_NAMED, 'cap0', true, '');
        if (!empty($extra)) {
            $extra = "OR name $extra";
        }

        // Fetch the list of modules, and remove this one.
        $components = \core_component::get_component_list();
        $componentnames = $components['mod'];
        unset($componentnames["mod_{$module->name}"]);
        $componentnames = array_keys($componentnames);

        // Exclude all other modules.
        list($notcompsql, $notcompparams) = $DB->get_in_or_equal($componentnames, SQL_PARAMS_NAMED, 'notcomp', false);
        $params = array_merge($params, $notcompparams);


        // Exclude other component submodules.
        $i = 0;
        $ignorecomponents = [];
        foreach ($componentnames as $mod) {
            if ($subplugins = \core_component::get_subplugins($mod)) {
                foreach (array_keys($subplugins) as $subplugintype) {
                    $paramname = "notlike{$i}";
                    $ignorecomponents[] = $DB->sql_like('component', ":{$paramname}", true, true, true);
                    $params[$paramname] = "{$subplugintype}_%";
                    $i++;
                }
            }
        }
        $notlikesql = "(" . implode(' AND ', $ignorecomponents) . ")";

        $sql = "SELECT *
                  FROM {capabilities}
                 WHERE (contextlevel = ".CONTEXT_MODULE."
                   AND component {$notcompsql}
                   AND {$notlikesql})
                       $extra";

        return $DB->get_records_sql($sql.' '.$sort, $params);
    }
1353601
async def get_available_abilities(self, units: Union[List[Unit], Units], ignore_resource_requirements=False) -> List[List[AbilityId]]:
        
        # right know only checks cooldown, energy cost, and whether the ability has been researched
        return await self._client.query_available_abilities(units, ignore_resource_requirements)
244533
def check_simple(self, checks, radl):
        """"""

        for f in self.features:
            if not isinstance(f, Feature) or f.prop not in checks:
                continue
            f._check(checks[f.prop], radl)
713915
def capability_functions(self, fn):
        """"""
        if _debug: Collector._debug("capability_functions %r", fn)

        # build a list of functions to call
        fns = []
        for cls in self.capabilities:
            xfn = getattr(cls, fn, None)
            if _debug: Collector._debug("    - cls, xfn: %r, %r", cls, xfn)
            if xfn:
                fns.append( (getattr(cls, '_zindex', None), xfn) )

        # sort them by z-index
        fns.sort(key=lambda v: v[0])
        if _debug: Collector._debug("    - fns: %r", fns)

        # now yield them in order
        for xindx, xfn in fns:
            if _debug: Collector._debug("    - yield xfn: %r", xfn)
            yield xfn
1047409
def sanitise_capabilities(capabilities):
    
    for c in REQUIRED_CAPABILITIES:
        capabilities[c] = options[c]

    for c in PROTECTED_CAPABILITIES:
        if c in capabilities:
            del capabilities['client_secret']

    return capabilities
158425
def check(self, options=None):
        """"""
        self.check_values(options)
        self.check_attributes(options)
        self.check_values(options)
        return self
1110917
def startup_capabilities(cls, rcfile=False, norc=False, stdin=False,
                             command=False):
        
        raise NotImplementedError
712587
function resolveCapabilities(capabilities, capabilitiesDictionary) {
    if (typeof capabilities !== "string") {
        // we do not know how to parse non string capabilities, let's assume it
        // is selenium compliant capabilities and return it.
        return capabilities;
    }

    // try to parse as a JSON string
    try {
        return JSON.parse(capabilities);
    } catch (e) { }


    // No luck with JSON assumption.
    // Try to read from configuration.
    if (capabilities in capabilitiesDictionary) {
        return capabilitiesDictionary[capabilities];
    }

    // still no luck ?
    // assume this is browserName...
    return { browserName: capabilities };
}
1371356
def ability(cls, id_, name, function_type, ability_id, general_id=0):
    """"""
    assert function_type in ABILITY_FUNCTIONS
    return cls(id_, name, ability_id, general_id, function_type,
               FUNCTION_TYPES[function_type], None)
530223
def get_configured_capabilities(self):
        """"""

        capabilities = OrderedDict()
        mbgp_caps = []
        if self.cap_mbgp_ipv4:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_IPv4_UC.afi, RF_IPv4_UC.safi))

        if self.cap_mbgp_ipv6:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_IPv6_UC.afi, RF_IPv6_UC.safi))

        if self.cap_mbgp_vpnv4:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_IPv4_VPN.afi, RF_IPv4_VPN.safi))

        if self.cap_mbgp_vpnv6:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_IPv6_VPN.afi, RF_IPv6_VPN.safi))

        if self.cap_rtc:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_RTC_UC.afi, RF_RTC_UC.safi))

        if self.cap_mbgp_evpn:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_L2_EVPN.afi, RF_L2_EVPN.safi))

        if self.cap_mbgp_ipv4fs:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_IPv4_FLOWSPEC.afi, RF_IPv4_FLOWSPEC.safi))

        if self.cap_mbgp_ipv6fs:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_IPv6_FLOWSPEC.afi, RF_IPv6_FLOWSPEC.safi))

        if self.cap_mbgp_vpnv4fs:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_VPNv4_FLOWSPEC.afi, RF_VPNv4_FLOWSPEC.safi))

        if self.cap_mbgp_vpnv6fs:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_VPNv6_FLOWSPEC.afi, RF_VPNv6_FLOWSPEC.safi))

        if self.cap_mbgp_l2vpnfs:
            mbgp_caps.append(
                BGPOptParamCapabilityMultiprotocol(
                    RF_L2VPN_FLOWSPEC.afi, RF_L2VPN_FLOWSPEC.safi))

        if mbgp_caps:
            capabilities[BGP_CAP_MULTIPROTOCOL] = mbgp_caps

        if self.cap_refresh:
            capabilities[BGP_CAP_ROUTE_REFRESH] = [
                BGPOptParamCapabilityRouteRefresh()]

        if self.cap_enhanced_refresh:
            capabilities[BGP_CAP_ENHANCED_ROUTE_REFRESH] = [
                BGPOptParamCapabilityEnhancedRouteRefresh()]

        if self.cap_four_octet_as_number:
            capabilities[BGP_CAP_FOUR_OCTET_AS_NUMBER] = [
                BGPOptParamCapabilityFourOctetAsNumber(self.local_as)]

        return capabilities
1350152
def capability_info(self, name=None):
        
        for r in self.resources:
            if (r.capability == name):
                return(r)
        return(None)
574268
def capability_module(cap_name)
      @cap_logger.debug("Searching for cap: #{cap_name}")
      @cap_host_chain.each do |host_name, host|
        @cap_logger.debug("Checking in: #{host_name}")
        caps = @cap_caps[host_name]

        if caps && caps.key?(cap_name)
          @cap_logger.debug("Found cap: #{cap_name} in #{host_name}")
          return caps[cap_name]
        end
      end

      nil
    end
131590
protected function determine() {
		$this->checkPlatform();
		$this->checkBrowsers();
		$this->checkForAol();
		$this->reduceVersion(); //modified for compatibility
		$this->checkPlatformVersion();	//add BugBuster
	}