Splits a revision ID into its generation number and opaque suffix string
189873
public static String parseRevIDSuffix(String rev) {
        String result = null;
        int dashPos = rev.indexOf('-');
        if (dashPos >= 0) {
            result = rev.substring(dashPos + 1);
        }
        return result;
    }
1051581
def find_tags(self):
        """"""
        listing = self.context.capture('hg', 'tags')
        for line in listing.splitlines():
            tokens = line.split()
            if len(tokens) >= 2 and ':' in tokens[1]:
                revision_number, revision_id = tokens[1].split(':')
                yield Revision(
                    repository=self,
                    revision_id=revision_id,
                    revision_number=int(revision_number),
                    tag=tokens[0],
                )
904878
def transform_revision(self, revision):
        """"""
        config = self.manager.get_source('config')
        return config.load_resource(revision)
1145943
def rename_with_num(self, prefix="", new_path=None, remove_desc=True):
        """"""
        # Temporary path #
        if new_path is None: numbered = self.__class__(new_temp_path())
        else:                numbered = self.__class__(new_path)
        # Generator #
        def numbered_iterator():
            for i,read in enumerate(self):
                read.id  = prefix + str(i)
                read.seq = read.seq.upper()
                if remove_desc: read.description = ""
                yield read
        # Do it #
        numbered.write(numbered_iterator())
        numbered.close()
        # Replace it #
        if new_path is None:
            os.remove(self.path)
            shutil.move(numbered, self.path)
        return numbered
76453
def record_variant_id(record):
    """"""
    if record.ID:
        return record.ID
    else:
        return record.CHROM + ':' + str(record.POS)
1082946
def _get_tags_by_num(self):
		
		by_revision = operator.attrgetter('revision')
		tags = sorted(self.get_tags(), key=by_revision)
		revision_tags = itertools.groupby(tags, key=by_revision)

		def get_id(rev):
			return rev.split(':', 1)[0]
		return dict(
			(get_id(rev), [tr.tag for tr in tr_list])
			for rev, tr_list in revision_tags
		)
135658
public static long getRevisionNumber(ModuleIdentifier revisionId) {
        int revision;
        try {
            revision = Integer.parseInt(revisionId.getSlot());
        } catch (NumberFormatException nf) {
            revision = -1;
        }
        return revision;
    }
725236
public String disAssembleId(String id, String... suffixes) {
		int count = 0;
		for (String s : suffixes) {
			count += s.length() + Dom.ID_SEPARATOR.length();
		}
		return id.substring(0, id.length() - count);
	}
1215596
def copy_w_id_suffix(elem, suffix="_copy"):
    """"""
    mycopy = deepcopy(elem)
    for id_elem in mycopy.xpath('//*[@id]'):
        id_elem.set('id', id_elem.get('id') + suffix)
    return mycopy
1196030
def getFileName(self, suffix=None, extension="jar"):
        

        assert (self._artifactId is not None)
        assert (self._version is not None)

        return "{0}-{1}{2}{3}".format(
            self._artifactId,
            self._version.getRawString(),
            "-" + suffix.lstrip("-") if suffix is not None else "",
            "." + extension.lstrip(".") if extension is not None else ""
        )
849062
def remove_suffix(text, suffix):
	
	rest, suffix, null = text.partition(suffix)
	return rest
1025348
public void parse(String version_string) {
        _version = 0;
        _revision = 0;
        _subrevision = 0;
        _suffix = "";
        int pos = 0;
        int startpos = 0;
        int endpos = version_string.length();
        while ( (pos < endpos) && Character.isDigit(version_string.charAt(pos))) {
            pos++;
        }
        _version = Integer.parseInt(version_string.substring(startpos,pos));
        if ((pos < endpos) && version_string.charAt(pos)=='.') {
            startpos = ++pos;
            while ( (pos < endpos) && Character.isDigit(version_string.charAt(pos))) {
                pos++;
            }
            _revision = Integer.parseInt(version_string.substring(startpos,pos));
        }
        if ((pos < endpos) && version_string.charAt(pos)=='.') {
            startpos = ++pos;
            while ( (pos < endpos) && Character.isDigit(version_string.charAt(pos))) {
                pos++;
            }
            _subrevision = Integer.parseInt(version_string.substring(startpos,pos));
        }
        if (pos < endpos) {
            _suffix = version_string.substring(pos);
        }
    }
1149259
def find_revision_id(self, revision=None):
        """"""
        # Make sure the local repository exists.
        self.create()
        # Try to find the revision id of the specified revision.
        revision = self.expand_branch_name(revision)
        output = self.context.capture('git', 'rev-parse', revision)
        # Validate the `git rev-parse' output.
        return self.ensure_hexadecimal_string(output, 'git rev-parse')
504818
def read_version():
    
    regex = re.compile('^(?P<number>\d.*?) .*$')

    with open('../CHANGELOG.rst') as f:
        for line in f:
            match = regex.match(line)
            if match:
                return match.group('number')
87103
def revisionId(self):
        
        log.warning("'RevisionId' requested, ensure that you are don't need 'id'")
        revision_id = self.json()['revisionId']
        assert revision_id == self.id, "RevisionId differs id-{}!=revisionId-{}".format(self.id, revision_id)
        return revision_id
530681
def get_seq_number_from_id(id, id_template, prefix, **kw):
    
    separator = kw.get("separator", "-")
    postfix = id.replace(prefix, "").strip(separator)
    postfix_segments = postfix.split(separator)
    seq_number = 0
    possible_seq_nums = filter(lambda n: n.isalnum(), postfix_segments)
    if possible_seq_nums:
        seq_number = possible_seq_nums[-1]

    # Check if this id has to be expressed as an alphanumeric number
    seq_number = get_alpha_or_number(seq_number, id_template)
    seq_number = to_int(seq_number)
    return seq_number
547064
private String createNewIdentifier(ParseTreeNode productionPart, String suffix)
	    throws TreeException {
	String identifier = "";
	if (productionPart.hasChild("IDENTIFIER")) {
	    identifier = productionPart.getChild("IDENTIFIER").getText();
	} else if (productionPart.hasChild("STRING_LITERAL")) {
	    identifier = productionPart.getChild("STRING_LITERAL").getText();
	}
	return createIdentifierName(identifier, suffix);
    }