Create or update a new tag for a given object version.
549544
def create_or_update(cls, object_version, key, value):
        """"""
        assert len(key) < 256
        assert len(value) < 256
        obj = cls.get(object_version, key)
        if obj:
            obj.value = value
            db.session.merge(obj)
        else:
            obj = cls.create(object_version, key, value)
        return obj
1308808
def _write_new_tag_to_init(self):
        
        for line in fileinput.input(self.init_file, inplace=1):
            if line.strip().startswith("__version__"):
                line = "__version__ = \"" + self.tag + "\""
            print(line.strip("\n"))
1034366
def up(tag, sql, revision):
    
    alembic_command.upgrade(
        config=get_config(),
        revision=revision,
        sql=sql,
        tag=tag
    )
841105
def post(self, object_type, object_id):
        """"""
        if object_id == 0:
            return Response(status=404)

        tagged_objects = []
        for name in request.get_json(force=True):
            if ':' in name:
                type_name = name.split(':', 1)[0]
                type_ = TagTypes[type_name]
            else:
                type_ = TagTypes.custom

            tag = db.session.query(Tag).filter_by(name=name, type=type_).first()
            if not tag:
                tag = Tag(name=name, type=type_)

            tagged_objects.append(
                TaggedObject(
                    object_id=object_id,
                    object_type=object_type,
                    tag=tag,
                ),
            )

        db.session.add_all(tagged_objects)
        db.session.commit()

        return Response(status=201)
305031
public static void setVersion(JsonNode node, Long version) {
		obj(node).put(ID_VERSION, version);
	}
79269
def newDoc(version):
    
    ret = libxml2mod.xmlNewDoc(version)
    if ret is None:raise treeError('xmlNewDoc() failed')
    return xmlDoc(_obj=ret)
1295977
def update_version_module(check_name, old_ver, new_ver):
    
    version_file = get_version_file(check_name)
    contents = read_file(version_file)

    contents = contents.replace(old_ver, new_ver)
    write_file(version_file, contents)
1328795
def updateObjectFromXML(xml_doc, obj, mapping):
    
    nsmap = None
    if isinstance(mapping, dict):
        # The special key @namespaces is used to pass
        # namespaces and prefix mappings for xpath selectors.
        # e.g. {'x': 'http://example.com/namespace'}
        if '@namespaces' in mapping:
            nsmap = mapping['@namespaces']
    else:
        raise TypeError('Tag-to-property map must be a dict.')
    # Iterate over the keys of the translation dictionary from event objects
    # to xml objects, so we can update the fields with the new information
    for k, v in mapping.items():
        if k.startswith('@'):
            continue
        selected_text = None
        if isinstance(v, basestring):
            selector = v
        elif isinstance(v, list):
            selector = '/'.join(v)
        else:
            raise TypeError(
                'Invalid tag-to-property mapping dict: '
                'values must be strings or lists, not %s.' % (type(v),)
            )
        try:
            selected_text = xml_doc.xpath(selector, namespaces=nsmap)
            if isinstance(selected_text, list):
                selected_text = selected_text[0]
            selected_text = selected_text.text
            setattr(obj, k, selected_text)
        except IndexError:
            # Assume the value is missing. It's also possible that the
            # given selector is valid but wrong, but the more common
            # case is that the element is missing. To be consistent with
            # the prior implementation, empty resultsets just mean empty
            # attributes.
            continue
    return obj
943094
def new(self, **dict):
        ''''''
        if not self._item_new_path:
            raise AttributeError('new is not available for %s' % self._item_name)

        # Remap various tag to tag_id
        for tag in self._object._remap_to_id:
            self._object._remap_tag_to_tag_id(tag, dict)

        target = self._item_new_path
        payload = json.dumps({self._item_type:dict})
        json_data = self._redmine.post(target, payload)
        data = self._redmine.unwrap_json(self._item_type, json_data)
        data['_source_path'] = target
        return self._objectify(data=data)
959178
def update(self, obj, size):
        '''
        '''
        self.number += 1
        self.total  += size
        if self.high < size:  # largest
           self.high = size
           try:  # prefer using weak ref
               self.objref, self.weak = Weakref.ref(obj), True
           except TypeError:
               self.objref, self.weak = obj, False
737205
function getNewVersions() {
  return getTags()
    .then(tags => {
      var newVersions = []
      for(tag of tags) {
        if (semver.gt(tag.name, update.latest) || (
            semver.eq(tag.name, update.latest) && (semver(tag.name).build[0] || 0) > (semver(update.latest).build[0] || 0)
          )) {
          newVersions.push(tag)
        }
      }
      newVersions.reverse()
      // order versions from lower to greater
      console.log(chalk.blue('New versions available: ' + (newVersions.map(v => v.name).join(', ') || 'none') + '.'))
      return newVersions
    })
    .catch(e => console.log(e.stack))
}
279994
def new_tag(self, label, cfrom=-1, cto=-1, tagtype='', **kwargs):
        '''  '''
        tag_obj = Tag(label, cfrom, cto, tagtype=tagtype, **kwargs)
        return self.add_tag(tag_obj)
1307724
public function createTagVersionRequest($baseUrl, $consumerName, $version, $tagName)
    {
        $url = $baseUrl . '/pacticipants/' . $consumerName . '/versions/' . $version . '/tags/' . $tagName;

        $request = new Request('PUT', $url, [
            "Content-Type" => "application/json"
        ]);

        return $request;
    }
299200
public static void setVersion(Object object, int version) {
		try {
			Field versionField = object.getClass().getField("version");
			versionField.set(object, version);
		} catch (NoSuchFieldException | SecurityException | IllegalAccessException e) {
			throw new RuntimeException(e);
		}
	}
1259461
function createAmpCustomElementTag(tagName, version) {
  const scriptType = AMP_SCRIPT_TYPE_MAP[tagName] || 'custom-element';
  return `<script async ${scriptType}="${tagName}" ` +
      `src="https://cdn.ampproject.org/v0/${tagName}-${version}.js"></script>`;
}
1240416
def validate_tag(self, tag_name, prefix=None):
        
        new_version = semantic_version(tag_name)
        current = self.latest()
        if current:
            tag_name = current['tag_name']
            if prefix:
                tag_name = tag_name[len(prefix):]
            tag_name = semantic_version(tag_name)
            if tag_name >= new_version:
                what = 'equal to' if tag_name == new_version else 'older than'
                raise GithubException(
                    'Your local version "%s" is %s '
                    'the current github version "%s".\n'
                    'Bump the local version to '
                    'continue.' %
                    (
                        str(new_version),
                        what,
                        str(tag_name)
                    )
                )
        return current
251608
def change(self, key, value):
        """"""
        self.obj[key] = value
        self.changes.append("Updating build:{}.{}={}"
                            .format(self.obj['name'], key, value))
        return self