Convert the dictionary of environment variables to
    a dictionary of desired capabilities to send to the
    Remote WebDriver.

    `tags` is a list of string tags to apply to the SauceLabs job.
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
505715
def tags(self):
        
        tags = self.definition.tags or {}
        return dict(self.context.tags, **tags)
1090678
def generated_tag_data(tags):
    
    generated_tags = []
    for key, value in tags.items():
        generated_tags.append({
            'Key': key,
            'Value': value,
        })
    return generated_tags
135988
protected static String encodeTags(Map<String, String> tags) {
        if (tags == null) {
            return null;
        }
        try {
            StringBuilder builder = new StringBuilder();
            boolean first = true;
            for (Entry<String, String> entry : tags.entrySet()) {
                if (!first) {
                    builder.append(',');
                }
                builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); //$NON-NLS-1$
                builder.append(':');
                builder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); //$NON-NLS-1$
                first = false;
            }
            return builder.toString();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return ""; //$NON-NLS-1$
        }
    }
771805
def tags= (tags)

      tags = tags.split(',') if tags.is_a?(String)

      @tags = TagArray.new(list_id, tags)

      queue_operation('setTasks', tags.join(','))
    end
1195160
def from_dict(cls, tag=None):
        

        if tag is None:
            tag = {}

        l = Tag()
        l.name = tag['name']
        return l
55670
def extract_tags(cls, obj):
        
        return dict(uuid=obj.uuid, entrypoint=obj.__class__.path)
1108908
def tokenize_tags(tags_string):
    

    # text is parsed in two steps:
    # the first step extract every single world that is 3 > chars long
    # and that contains only alphanumeric characters, underscores and dashes
    tags_string = tags_string.lower().strip(",")
    single_words = set([w[:100] for w in re.split(';|,|\*|\n| ', tags_string)
                          if len(w) >= 3 and re.match("^[A-Za-z0-9_-]*$", w)])
    # the second step divide the original string using comma as separator
    comma_separated = set([t[:100] for t in tags_string.split(",") if t])
    # resulting set are merged using union
    return list(single_words | comma_separated)
926476
def platform_to_tags(platform, interpreter):
  
  if platform.count('-') >= 3:
    tags = platform.rsplit('-', 3)
  else:
    tags = [platform, interpreter.identity.impl_ver,
            interpreter.identity.abbr_impl, interpreter.identity.abi_tag]
  tags[0] = tags[0].replace('.', '_').replace('-', '_')
  return tags
628085
def generate_tags(self):
        
        self.tags = dict()
        for section in self.sections():
            if self.has_option(section, 'tags'):
                tags = self.get(section, 'tags')
                for tag in [str(t).strip() for t in tags.split(',')]:
                    if tag not in self.tags:
                        self.tags[tag] = list()
                    self.tags[tag].append(section.split(':')[1])
424567
def parse_tags(self, tags):
        
        dtags = {}
        if tags:
            try:
                dtags = dict([x.split(':') for x in tags.split(',')])
            except ValueError:
                # one of the 'key:value' pairs was missing
                logger.info('Invalid tags passed: %s', tags)
                dtags = {}

        return dtags
754277
def _parse_service_env_vars(self, env_vars):
        
        env = {}
        for var in env_vars:
            # Yeah yeah.. it's less performant.. splitting twice.. who cares.
            k, v = var.split('=')
            env.update({k: v})
        return env
1149523
def as_dict(self):
        
        tags_dict = dict(self)
        tags_dict['@module'] = self.__class__.__module__
        tags_dict['@class'] = self.__class__.__name__
        return tags_dict
820044
def tags(self):
        
        if self._tags is None:
            LOG.debug('need to build tags')
            self._tags = {}

            if hasattr(self.Meta, 'tags_spec') and (self.Meta.tags_spec is not None):
                LOG.debug('have a tags_spec')
                method, path, param_name, param_value = self.Meta.tags_spec[:4]
                kwargs = {}
                filter_type = getattr(self.Meta, 'filter_type', None)
                if filter_type == 'arn':
                    kwargs = {param_name: [getattr(self, param_value)]}
                elif filter_type == 'list':
                    kwargs = {param_name: [getattr(self, param_value)]}
                else:
                    kwargs = {param_name: getattr(self, param_value)}
                if len(self.Meta.tags_spec) > 4:
                    kwargs.update(self.Meta.tags_spec[4])
                LOG.debug('fetching tags')
                self.data['Tags'] = self._client.call(
                    method, query=path, **kwargs)
                LOG.debug(self.data['Tags'])

            if 'Tags' in self.data:
                _tags = self.data['Tags']
                if isinstance(_tags, list):
                    for kvpair in _tags:
                        if kvpair['Key'] in self._tags:
                            if not isinstance(self._tags[kvpair['Key']], list):
                                self._tags[kvpair['Key']] = [self._tags[kvpair['Key']]]
                            self._tags[kvpair['Key']].append(kvpair['Value'])
                        else:
                            self._tags[kvpair['Key']] = kvpair['Value']
                elif isinstance(_tags, dict):
                    self._tags = _tags
        return self._tags
582241
def list_tags(Name,
           region=None, key=None, keyid=None, profile=None):
    '''
    

    '''

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        rid = _get_trail_arn(Name,
                             region=region, key=key, keyid=keyid,
                             profile=profile)
        ret = conn.list_tags(ResourceIdList=[rid])
        tlist = ret.get('ResourceTagList', []).pop().get('TagsList')
        tagdict = {}
        for tag in tlist:
            tagdict[tag.get('Key')] = tag.get('Value')
        return {'tags': tagdict}
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
863779
def _required_envs(env_vars):
    
    envs = {
        key: os.environ.get(key)
        for key in env_vars
    }

    # Check for missing keys
    missing = [key for key, val in list(envs.items()) if val is None]
    if missing:
        msg = (
            u"These environment variables must be set: " + u", ".join(missing)
        )
        raise BrowserConfigError(msg)

    # Check that we support this browser
    if envs['SELENIUM_BROWSER'] not in BROWSERS:
        msg = u"Unsuppported browser: {0}".format(envs['SELENIUM_BROWSER'])
        raise BrowserConfigError(msg)

    return envs
1180505
def tags(self, task, params={}, **options): 
        
        path = "/tasks/%s/tags" % (task)
        return self.client.get_collection(path, params, **options)