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

Method __init__

numpy/_utils/_pep440.py:292–325  ·  view source on GitHub ↗
(self, version)

Source from the content-addressed store, hash-verified

290 )
291
292 def __init__(self, version):
293 # Validate the version and parse it into pieces
294 match = self._regex.search(version)
295 if not match:
296 raise InvalidVersion("Invalid version: '{0}'".format(version))
297
298 # Store the parsed out pieces of the version
299 self._version = _Version(
300 epoch=int(match.group("epoch")) if match.group("epoch") else 0,
301 release=tuple(int(i) for i in match.group("release").split(".")),
302 pre=_parse_letter_version(
303 match.group("pre_l"),
304 match.group("pre_n"),
305 ),
306 post=_parse_letter_version(
307 match.group("post_l"),
308 match.group("post_n1") or match.group("post_n2"),
309 ),
310 dev=_parse_letter_version(
311 match.group("dev_l"),
312 match.group("dev_n"),
313 ),
314 local=_parse_local_version(match.group("local")),
315 )
316
317 # Generate a key which will be used for sorting
318 self._key = _cmpkey(
319 self._version.epoch,
320 self._version.release,
321 self._version.pre,
322 self._version.post,
323 self._version.dev,
324 self._version.local,
325 )
326
327 def __repr__(self):
328 return "<Version({0})>".format(repr(str(self)))

Callers

nothing calls this directly

Calls 5

InvalidVersionClass · 0.85
_parse_letter_versionFunction · 0.85
_parse_local_versionFunction · 0.85
_cmpkeyFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected