def __init__(self, rawtext):
        self.rawtext = rawtext
        t = self.rawtext.rsplit('-', 2)
        if len(t) != 3:
            raise MalformedGitTag(self.rawtext)

        vinfo, self.ncommits, self.sha = t
        self.ncommits = int(self.ncommits)

        # Split up the X.Y.Z
        match = RE_XYZ.match(vinfo)
        (self.ver_maj, self.ver_min, self.ver_patch, self.ver_extra) =\
            match.groups()

        # Per PEP-440, replace any 'DP' with an 'a', and any beta with 'b'
        if self.ver_extra:
            self.ver_extra = re.sub(r'^dp', 'a', self.ver_extra, count=1)
            self.ver_extra = re.sub(r'^beta', 'b', self.ver_extra, count=1)
            m = re.search(r'^([ab])(\d+)?', self.ver_extra)
            if m.group(2) is None:
                # No suffix, then add the number
                first = self.ver_extra[0]
                self.ver_extra = first + '0' + self.ver_extra[1:]
dataset/ETHPy150Open couchbase/couchbase-python-client/couchbase_version.py/VersionInfo.__init__/original