MCPcopy Create free account
hub / github.com/numpy/numpy / __init__

Method __init__

numpy/lib/_version.py:55–76  ·  view source on GitHub ↗
(self, vstring)

Source from the content-addressed store, hash-verified

53 """
54
55 def __init__(self, vstring):
56 self.vstring = vstring
57 ver_main = re.match(r'\d+\.\d+\.\d+', vstring)
58 if not ver_main:
59 raise ValueError("Not a valid numpy version string")
60
61 self.version = ver_main.group()
62 self.major, self.minor, self.bugfix = [int(x) for x in
63 self.version.split('.')]
64 if len(vstring) == ver_main.end():
65 self.pre_release = 'final'
66 else:
67 alpha = re.match(r'a\d', vstring[ver_main.end():])
68 beta = re.match(r'b\d', vstring[ver_main.end():])
69 rc = re.match(r'rc\d', vstring[ver_main.end():])
70 pre_rel = [m for m in [alpha, beta, rc] if m is not None]
71 if pre_rel:
72 self.pre_release = pre_rel[0].group()
73 else:
74 self.pre_release = ''
75
76 self.is_devversion = bool(re.search(r'.dev', vstring))
77
78 def _compare_version(self, other):
79 """Compare major.minor.bugfix"""

Callers

nothing calls this directly

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected