Set tags for a given archive
335864
def add_tags(self, *tags):
        '''
        
        '''
        normed_tags = self.api.manager._normalize_tags(tags)
        self.api.manager.add_tags(self.archive_name, normed_tags)
568834
protected function set_items() {
		$year = get_query_var( 'year' );
		if ( $year ) {
			$month = get_query_var( 'monthnum' );
		} else {
			$ymd   = get_query_var( 'm' );
			$year  = substr( $ymd, 0, 4 );
			$month = substr( $ymd, 4, 2 );
		}

		$this->set( $this->year( $year ), get_year_link( $year ) );
		$this->set( $this->month( $month ), get_month_link( $year, $month ) );
		$this->set( $this->get_the_archive_title() );
	}
493526
def process_tags(self, tag=None):
        """"""
        if self.downloaded is False:
            raise serror("Track not downloaded, can't process tags..")
        filetype = magic.from_file(self.filepath, mime=True)
        if filetype != "audio/mpeg":
            raise serror("Cannot process tags for file type %s." % filetype)

        print("Processing tags for %s.." % self.filepath)
        if tag is None:
            tag = stag()
        tag.load_id3(self)
        tag.write_id3(self.filepath)
328957
function setTags(swig, tags) {
  var name, tag;
  for (name in tags) {
    tag = tags[name];
    swig.setTag(name, tag.parse, tag.compile, tag.ends, tag.blockLevel);
  }
}
794171
def add_tags(self, tags):
        

        if isinstance(tags, (str, unicode)):
            tags = [tags]

        objs = object_session(self)
        tmps = [FeedTag(tag=t, feed=self) for t in tags]
        objs.add_all(tmps)
        objs.commit()
140125
def delete_tags(self, archive_name, tags):
        '''
        

        '''
        updated_tag_list = list(self._get_tags(archive_name))
        for tag in tags:
            if tag in updated_tag_list:
                updated_tag_list.remove(tag)

        self._set_tags(archive_name, updated_tag_list)
38614
def _maybe_init_tags(self, run_id, tag_to_metadata):
    
    cursor = self._db.cursor()
    # TODO: for huge numbers of tags (e.g. 1000+), this is slower than just
    # querying for the known tag names explicitly; find a better tradeoff.
    cursor.execute('SELECT tag_name, tag_id FROM Tags WHERE run_id = ?',
                   (run_id,))
    tag_to_id = {row[0]: row[1] for row in cursor.fetchall()
                 if row[0] in tag_to_metadata}
    new_tag_data = []
    for tag, metadata in six.iteritems(tag_to_metadata):
      if tag not in tag_to_id:
        tag_id = self._create_id()
        tag_to_id[tag] = tag_id
        new_tag_data.append((run_id, tag_id, tag, time.time(),
                             metadata.display_name,
                             metadata.plugin_data.plugin_name,
                             self._make_blob(metadata.plugin_data.content)))
    cursor.executemany(
        """
        INSERT INTO Tags (
          run_id, tag_id, tag_name, inserted_time, display_name, plugin_name,
          plugin_data
        ) VALUES (?, ?, ?, ?, ?, ?, ?)
        """,
        new_tag_data)
    return tag_to_id
655303
protected function setTagsContext()
    {
        $objectManager = Bootstrap::$staticObjectManager;
        $environment = $objectManager->get(Environment::class);

        $tags = [
            'php_version' => phpversion(),
            'flow_context' => (string)$environment->getContext(),
            'flow_version' => FLOW_VERSION_BRANCH
        ];

        $this->client->tags_context($tags);
    }
516036
def setTags( self, tags ):
        
        self.setUpdatesEnabled(False)
        self.blockSignals(True)
        
        self.clear()
        for tag in tags:
            self.addItem(XMultiTagItem(tag, self))
        
        self.blockSignals(False)
        self.setUpdatesEnabled(True)
958043
def tags(self):
        """"""
        if not self.raw_content:
            return set()
        return {word.strip("#").lower() for word in self.raw_content.split() if word.startswith("#") and len(word) > 1}
294255
def set_tag(self, tag):
        """"""
        return Eq(
            self._lhs, self._rhs, tag=tag,
            _prev_lhs=self._prev_lhs, _prev_rhs=self._prev_rhs,
            _prev_tags=self._prev_tags)
895244
def create(
        ctx,
        archive_name,
        authority_name,
        versioned=True,
        tag=None,
        helper=False):
    '''
    
    '''

    tags = list(tag)

    _generate_api(ctx)
    args, kwargs = _parse_args_and_kwargs(ctx.args)
    assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args)

    var = ctx.obj.api.create(
        archive_name,
        authority_name=authority_name,
        versioned=versioned,
        metadata=kwargs,
        tags=tags,
        helper=helper)

    verstring = 'versioned archive' if versioned else 'archive'
    click.echo('created {} {}'.format(verstring, var))
485531
def _load_tags(self,directory):
        
        #FIXME: should check if DB tracking file before using it
        # --- Read tags out of file
        _tags=''
        try:
            fullfile=os.path.join(directory,TAG_FILE)
            ltags=open(fullfile).readline().split(',')
            _tags=''' '''

            for tag in ltags:
                _tags+='''"'''+tag.strip()+'''" '''
            _tags=_tags.strip()
        except:
            logger.info("No tags found in %s"%(directory))

        return _tags
930679
def Tag(env, target, source, *more_tags, **kw_tags):
    
    if not target:
        target=source
        first_tag=None
    else:
        first_tag=source

    if first_tag:
        kw_tags[first_tag[0]] = ''

    if len(kw_tags) == 0 and len(more_tags) == 0:
        raise UserError("No tags given.")

    # XXX: sanity checks
    for x in more_tags:
        kw_tags[x] = ''

    if not SCons.Util.is_List(target):
        target=[target]
    else:
        # hmm, sometimes the target list, is a list of a list
        # make sure it is flattened prior to processing.
        # TODO: perhaps some bug ?!?
        target=env.Flatten(target)

    for t in target:
        for (k,v) in kw_tags.items():
            # all file tags have to start with PACKAGING_, so we can later
            # differentiate between "normal" object attributes and the
            # packaging attributes. As the user should not be bothered with
            # that, the prefix will be added here if missing.
            if k[:10] != 'PACKAGING_':
                k='PACKAGING_'+k
            t.Tag(k, v)
806243
def set_tags(self, tags):
        
        for key, value in tags.items():
            self.set_tag(key, value)
260917
function _processCollectedTags($source)
        {
            $to_replace = array();
            $ordered = array();
            foreach(self::$tag_collections as $tag_name=>$tags)
            {
//              if this block has a collection order use it
                if(isset(self::$_tag_order[$tag_name]) === true)
                {
                    $pos = self::$_tag_order[$tag_name];
                    $ordered[$pos] = $tags;
                    continue;
                }
//              the source should be modified by the collection script
                $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                if($this->_options['tag_global_callback'] !== false)
                {
                    $tags = call_user_func($this->_options['tag_global_callback'], 'collection', $tag_func_name, $tags, $source);
                }
                else
                {
                    $tags = call_user_func($tag_func_name, $tags, $source);
                }
                
                if($tags === -1)
                {
                    $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                }
                else if(is_array($tags) === false)
                {
                    $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" did not return the array of process tags.');
                }
                else if(count($tags) > 0)
                {
//                  input the parsed tags back into the source or store for re-intergration
                    foreach ($tags as $key => $tag)
                    {
                        if(strpos($source, $tag['tag']) !== false)
                        {
                            $source = str_replace($tag['tag'], $tag['parsed'], $source);
                        }
                        else
                        {
//                          do a reverse tag lookup here as the tag was not found in the source, thus it must be buried and un processed
                            array_push($to_replace, $tag);
                        }
                    }
                }
            }
            foreach($ordered as $key=>$tags)
            {
//              the source should be modified by the collection script
                $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                $tags = call_user_func($tag_func_name, $tags);
                if($tags === -1)
                {
                    $source = self::throwError($tag['name'], 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                }
            }
            return $this->_doBuriedReplacements($to_replace, $source);
        }
872553
def tags=(tags_array)
      as_strings = tags_array.collect { |tag| tag.to_s }
      self.service.setTags(as_strings.join(','))
    end