Generate the HTML file for adding.
    :param tag_key: key of the tags.
    :param tag_list: list of the tags.
    :return: None
326980
def __write_add_tmpl(tag_key, tag_list):
    '''
    
    '''
    add_file = os.path.join(OUT_DIR, 'add', 'add_' + tag_key.split('_')[1] + '.html')
    add_widget_arr = []
    # var_dic = eval('dic_vars.' + bianliang)
    for sig in tag_list:
        html_sig = '_'.join(['html', sig])
        # var_html = eval('html_vars.' + html_sig)
        var_html = HTML_DICS[html_sig]

        if var_html['type'] in INPUT_ARR:
            tmpl = func_gen_html.gen_input_add(var_html)
        elif var_html['type'] == 'select':
            tmpl = func_gen_html.gen_select_add(var_html)
        elif var_html['type'] == 'radio':
            tmpl = func_gen_html.gen_radio_add(var_html)
        elif var_html['type'] == 'checkbox':
            tmpl = func_gen_html.gen_checkbox_add(var_html)
        elif var_html['type'] == 'file':
            tmpl = func_gen_html.gen_file_add(var_html)
        else:
            tmpl = ''
        add_widget_arr.append(tmpl)
    with open(add_file, 'w') as fileout:
        outstr = minify(
            TPL_ADD.replace(
                'xxxxxx',
                ''.join(add_widget_arr)
            ).replace(
                'yyyyyy',
                tag_key.split('_')[1][:2]
            ).replace(
                'kkkk',
                KIND_DICS['kind_' + tag_key.split('_')[-1]]
            )
        )
        fileout.write(outstr)
1032558
def uniqueTags(tagList):
    '''
        
    '''
    ret = []
    alreadyAdded = set()
    for tag in tagList:
        myUid = tag.getUid()
        if myUid in alreadyAdded:
            continue
        ret.append(tag)
    return TagCollection(ret)
276555
def tag(self, tags):
        
        # Get tag list and add/remove given tags
        tags = tags.lower()
        previous = self.tagged
        tagset = previous.copy()
        for tag in tags.replace(',', ' ').split():
            if tag.startswith('-'):
                tagset.discard(tag[1:])
            elif tag.startswith('+'):
                tagset.add(tag[1:])
            else:
                tagset.add(tag)

        # Write back new tagset, if changed
        tagset.discard('')
        if tagset != previous:
            tagset = ' '.join(sorted(tagset))
            self._make_it_so("setting tags %r on" % (tagset,), ["custom.set"], "tags", tagset)
            self._fields["custom_tags"] = tagset
779007
def add_tags(self, tags):
        
        if self.cloud_manager.assign_tags(self.uuid, tags):
            tags = self.tags + [str(tag) for tag in tags]
            object.__setattr__(self, 'tags', 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])
614035
def add_tags(self, **kwargs):
        
        j, _ = self.datacenter.request('POST', self.path + '/tags', 
            data=kwargs)
        return j
994237
def __render_tag(info, state):
    
    new_contexts, context_match = get_tag_context(info['tag_key'], state)
    replacement = ''

    if context_match or context_match == 0:
        replacement = context_match
    elif info['tag_key'] == '.':
        replacement = state.context()
    else:
        replacement = ''

    # Call all callables / methods / lambdas / functions
    if replacement and callable(replacement):
        replacement = make_unicode(replacement())

        state.push_tags(state.default_tags)
        replacement = __render(template=replacement, state=state)
        state.pop_tags()

    for i in xrange(new_contexts): state.context.pop()

    if state.escape():
        return html_escape(replacement)
    return replacement
961054
def render_tag(self, tag_func):
        
        @wraps(tag_func)
        def tag_wrapper(parser, token):
            class RenderTagNode(template.Node):
                def render(self, context):
                    return tag_func(context, token)
            return RenderTagNode()
        return self.tag(tag_wrapper)
1282341
def add_tags(self, dic, prefix):
        
        # fill missing tagvalues with "?", raise an error for unknown tagnames
        idxs = []
        for tagname in self.tagnames:
            if tagname in ('exposure', 'country'):
                idxs.append(self.add(tagname, prefix))
                continue
            try:
                tagvalue = dic.pop(tagname)
            except KeyError:
                tagvalue = '?'
            else:
                if tagvalue in '?*':
                    raise ValueError(
                        'Invalid tagvalue="%s"' % tagvalue)
            idxs.append(self.add(tagname, tagvalue))
        if dic:
            raise ValueError(
                'Unknown tagname %s or <tagNames> not '
                'specified in the exposure' % ', '.join(dic))
        return idxs
927397
def add_tag(self, tag):
        
        if tag not in self._tags:
            self._tags[tag] = dict()
179861
def tag_instance(self, instance_id, tag_list):

        '''
            
        '''

        title = '%s.tag_instance' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'instance_id': instance_id,
            'tag_list': tag_list
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # retrieve tag list of instance
        self.iam.printer_on = False
        instance_details = self.read_instance(instance_id)
        self.iam.printer_on = True
        old_tags = instance_details['tags']
    
    # determine tags to remove
        delete_list = []
        tag_map = {}
        for tag in tag_list:
            tag_map[tag['key']] = tag['value']
        for tag in old_tags:
            if tag['key'] not in tag_map.keys():
                delete_list.append(tag)
            elif tag['value'] != tag_map[tag['key']]:
                delete_list.append(tag)

    # convert tag list to camelcase
        delete_list = self.iam.prepare(delete_list)
        tag_list = self.iam.prepare(tag_list)
    
    # remove tags from instance
        if delete_list:
            try:
                delete_kwargs = {
                    'Resources': [ instance_id ],
                    'Tags': delete_list
                }
                self.connection.delete_tags(**delete_kwargs)
            except:
                AWSConnectionError(title)
            
    # tag instance with updated tags
        try:
            create_kwargs = {
                'Resources': [ instance_id ],
                'Tags': tag_list
            }
            response = self.connection.create_tags(**create_kwargs)
        except:
            raise AWSConnectionError(title)
        
        return response
632595
def tag_helper(tag, items, locked=True, remove=False):
    
    if not isinstance(items, list):
        items = [items]
    data = {}
    if not remove:
        for i, item in enumerate(items):
            tagname = '%s[%s].tag.tag' % (tag, i)
            data[tagname] = item
    if remove:
        tagname = '%s[].tag.tag-' % tag
        data[tagname] = ','.join(items)
    data['%s.locked' % tag] = 1 if locked else 0
    return data
689081
def tag_map(self):
        '''  '''
        tm = dd(list)
        for tag in self.__tags:
            tm[tag.tagtype].append(tag)
        return tm
1340517
def import_tags(self, tag_nodes):
        
        self.write_out(self.style.STEP('- Importing tags\n'))
        for tag_node in tag_nodes:
            tag_name = tag_node.find(
                '{%s}tag_slug' % WP_NS).text[:50]
            self.write_out('> %s... ' % tag_name)
            Tag.objects.get_or_create(name=tag_name)
            self.write_out(self.style.ITEM('OK\n'))
305777
def add_sequence(tag, options={})
      add(s = Sequence.new(tag, options))
      s
    end
494384
def add_tag(context, id, name):
    

    result = job.add_tag(context, id=id, name=name)
    utils.format_output(result, context.format)
472190
def _build_tags(self, tag_names: List[str]) -> dict:
        """"""
        tags = {}
        for tag_name in tag_names:
            tag_obj = self.tag(tag_name)
            if tag_obj is None:
                LOG.debug(f"create new tag: {tag_name}")
                tag_obj = self.new_tag(tag_name)
            tags[tag_name] = tag_obj
        return tags