Synthesize a capability enabled version response
        This is a very limited emulation for relatively recent feature sets
559458
def synthesize(vers, opts):
    
    parsed_version = parse_version(vers["version"])
    vers["capabilities"] = {}
    for name in opts["optional"]:
        vers["capabilities"][name] = check(parsed_version, name)
    failed = False  # noqa: F841 T25377293 Grandfathered in
    for name in opts["required"]:
        have = check(parsed_version, name)
        vers["capabilities"][name] = have
        if not have:
            vers["error"] = (
                "client required capability `"
                + name
                + "` is not supported by this server"
            )
    return vers
193117
def _get_vqa_v2_image_feature_dataset(
    directory, feature_url, feature_filename="mscoco_feat.tar.gz"):
  """"""
  feature_file = generator_utils.maybe_download_from_drive(
      directory, feature_filename, feature_url)
  with tarfile.open(feature_file, "r:gz") as feature_tar:
    feature_tar.extractall(directory)
446980
def get_capability(self, capability_name):
        
        try:
            capability = self._current_application().capabilities[capability_name]
        except Exception as e:
            raise e
        return capability
1212613
function registerSpecification(specification, remoteDN , options , callback){
    // Serialize the capability Object
    var post_data = {};
    post_data[remoteDN] = JSON.parse(specification.to_dict());
    post_data = JSON.stringify(post_data);

    var proto = https;
    var post_options = {
        path: SUPERVISOR_PATH_REGISTER_SPECIFICATION,
        method: 'POST',
        host: options.host,
        port: options.port,
        followRedirect:false,
        headers: {
            'Content-Type': MIME_TYPE,
            'Content-Length': Buffer.byteLength(post_data)
        } ,
        key: ssl_files.readFileContent(options.keyFile)
        ,cert: ssl_files.readFileContent(options.certFile)
        ,ca: ssl_files.readCaChain(options.caFile)
    };
    // Set up the request
    var post_req = proto.request(post_options, function(res) {
        var body = "";
        res.setEncoding('utf8');
        res.on('data', function (chunk) {
            if (chunk)
                body +=chunk;
        });
        res.on('end', function (chunk) {
            if (chunk)
                body +=chunk;
            if (res.statusCode == 200){
                // Send back the receipt
                callback(null, body);
            }else{
                callback(new Error(res.statusCode), null);
            }
        });
    });
    // post the data
    post_req.write(post_data);
    post_req.end();
}
827469
def failed_extra_capabilities(self):
        """"""
        failed = []
        for capability, f_name in self.extra_capability_checks.items():
            f = getattr(self, f_name)
            instance_capable = f()
            if not instance_capable:
                failed.append(capability)
        return failed
1031879
def create_response_object(self, service_id, version_number, name, status="200", response="OK", content="", request_condition=None, cache_condition=None):
		""""""
		body = self._formdata({
			"name": name,
			"status": status,
			"response": response,
			"content": content,
			"request_condition": request_condition,
			"cache_condition": cache_condition,
		}, FastlyResponseObject.FIELDS)
		content = self._fetch("/service/%s/version/%d/response_object" % (service_id, version_number), method="POST", body=body)
		return FastlyResponseObject(self, content)
287507
def featureSetsGenerator(self, request):
        
        dataset = self.getDataRepository().getDataset(request.dataset_id)
        return self._topLevelObjectGenerator(
            request, dataset.getNumFeatureSets(),
            dataset.getFeatureSetByIndex)
1146544
def set_feature_generator(self):
        """"""
        self.features = preparation.build_peptidetable(self.lookup,
                                                       self.headerfields,
                                                       self.isobaric,
                                                       self.precursor,
                                                       self.fdr, self.pep,
                                                       self.genecentric)
1221669
def get_or_create_from_legacy_response(self, response, **kwargs):
        '''
        
        '''
        response_cls = self.response_class(**kwargs).get_or_create(**kwargs)
        if not getattr(response_cls, self.column):
            setattr(response_cls, self.column, self.accessor(response))
            _action_and_commit(response_cls, session.add)
        if not getattr(response_cls, self.venue_column):
            setattr(
                response_cls, self.venue_column, self.venue_accessor(response))
            _action_and_commit(response_cls, session.add)
1181965
def capability(cap_name, *args)
      cap_mod = capability_module(cap_name.to_sym)
      if !cap_mod
        raise Errors::CapabilityNotFound,
          cap:  cap_name.to_s,
          host: @cap_host_chain[0][0].to_s
      end

      cap_method = nil
      begin
        cap_method = cap_mod.method(cap_name)
      rescue NameError
        raise Errors::CapabilityInvalid,
          cap: cap_name.to_s,
          host: @cap_host_chain[0][0].to_s
      end

      args = @cap_args + args
      @cap_logger.info(
        "Execute capability: #{cap_name} #{args.inspect} (#{@cap_host_chain[0][0]})")
      cap_method.call(*args)
    end
487254
def compose_capability(base, *classes):
    """"""
    if _debug: compose_capability._debug("compose_capability %r %r", base, classes)

    # make sure the base is 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,))

    # start with everything the base has and add the new ones
    bases = (base,) + classes

    # build a new name
    name = base.__name__
    for cls in classes:
        name += '+' + cls.__name__

    # return a new type
    return type(name, bases, {})
503267
def parseFeatureRequest(response):
    
    features = []
    while (len(response) > 0):
        tag = response[0]
        control = ((((((response[2] << 8) +
                        response[3]) << 8) +
                        response[4]) << 8) +
                        response[5])
        try:
            features.append([Features[tag], control])
        except KeyError:
            pass
        del response[:6]
    return features
432815
def _capabilities_dict(envs, tags):
    
    capabilities = {
        'browserName': envs['SELENIUM_BROWSER'],
        'acceptInsecureCerts': bool(envs.get('SELENIUM_INSECURE_CERTS', False)),
        'video-upload-on-pass': False,
        'sauce-advisor': False,
        'capture-html': True,
        'record-screenshots': True,
        'max-duration': 600,
        'public': 'public restricted',
        'tags': tags,
    }

    # Add SauceLabs specific environment vars if they are set.
    if _use_remote_browser(SAUCE_ENV_VARS):
        sauce_capabilities = {
            'platform': envs['SELENIUM_PLATFORM'],
            'version': envs['SELENIUM_VERSION'],
            'username': envs['SAUCE_USER_NAME'],
            'accessKey': envs['SAUCE_API_KEY'],
        }

        capabilities.update(sauce_capabilities)

    # Optional: Add in Jenkins-specific environment variables
    # to link Sauce output with the Jenkins job
    if 'JOB_NAME' in envs:
        jenkins_vars = {
            'build': envs['BUILD_NUMBER'],
            'name': envs['JOB_NAME'],
        }

        capabilities.update(jenkins_vars)

    return capabilities
1030017
def setDatastreamVersionable(self, pid, dsID, versionable):
        '''
        '''
        # /objects/{pid}/datastreams/{dsID} ? [versionable]
        http_args = {'versionable': versionable}
        url = 'objects/%(pid)s/datastreams/%(dsid)s' % {'pid': pid, 'dsid': dsID}
        response = self.put(url, params=http_args)
        # returns response code 200 on success
        return response.status_code == requests.codes.ok
1259549
def enable(self, **kwdargs):
        
        for feat, value in kwdargs:
            feat = feat.lower()
            if feat not in self.features:
                raise ValueError("'%s' is not a feature. Must be one of %s" % (
                    feat, str(self.features)))

            attr = self.features[feat]
            setattr(self, attr, bool(value))
1265551
def to_capabilities(self):
        
        caps = self._caps
        chrome_options = self.experimental_options.copy()
        chrome_options["extensions"] = self.extensions
        if self.binary_location:
            chrome_options["binary"] = self.binary_location
        chrome_options["args"] = self.arguments
        if self.debugger_address:
            chrome_options["debuggerAddress"] = self.debugger_address

        caps[self.KEY] = chrome_options

        return caps
1104763
def describe(self, **kwargs):
        
        response = self._new_response()
        description = {
            'cruddy_version': __version__,
            'table_name': self.table_name,
            'supported_operations': copy.copy(self.supported_ops),
            'prototype': copy.deepcopy(self.prototype),
            'operations': {}
        }
        for name, method in inspect.getmembers(self, inspect.ismethod):
            if not name.startswith('_'):
                argspec = inspect.getargspec(method)
                if argspec.defaults is None:
                    defaults = None
                else:
                    defaults = list(argspec.defaults)
                method_info = {
                    'docs': inspect.getdoc(method),
                    'argspec': {
                        'args': argspec.args,
                        'varargs': argspec.varargs,
                        'keywords': argspec.keywords,
                        'defaults': defaults
                    }
                }
                description['operations'][name] = method_info
        response.data = description
        return response