MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / __init__

Method __init__

couchbase_version.py:45–70  ·  view source on GitHub ↗
(self, rawtext)

Source from the content-addressed store, hash-verified

43
44class VersionInfo(object):
45 def __init__(self, rawtext):
46 self.rawtext = rawtext
47 t = self.rawtext.rsplit('-', 2)
48 if len(t) != 3:
49 raise MalformedGitTag(self.rawtext)
50
51 vinfo, self.ncommits, self.sha = t
52 self.ncommits = int(self.ncommits)
53
54 # Split up the X.Y.Z
55 match = RE_XYZ.match(vinfo)
56 (self.ver_maj, self.ver_min, self.ver_patch, self.ver_extra) =\
57 match.groups()
58
59 # Per PEP-440, replace any 'DP' with an 'a', and any beta with 'b'
60 if self.ver_extra:
61 self.ver_extra = re.sub(r'^dp', 'a', self.ver_extra, count=1)
62 self.ver_extra = re.sub(r'^alpha', 'a', self.ver_extra, count=1)
63 self.ver_extra = re.sub(r'^beta', 'b', self.ver_extra, count=1)
64 m = re.search(r'^([ab]|dev|rc|post)(\d+)?', self.ver_extra)
65 if m.group(1) in ["dev", "post"]:
66 self.ver_extra = "." + self.ver_extra
67 if m.group(2) is None:
68 # No suffix, then add the number
69 first = self.ver_extra[0]
70 self.ver_extra = first + '0' + self.ver_extra[1:]
71
72 @property
73 def is_final(self):

Callers

nothing calls this directly

Calls 5

MalformedGitTagClass · 0.85
matchMethod · 0.80
groupsMethod · 0.80
groupMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected