MCPcopy
hub / github.com/mne-tools/mne-python / _strip_dev

Function _strip_dev

mne/utils/check.py:133–149  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

131
132
133def _strip_dev(version):
134 # First capturing group () is what we want to keep, at the beginning:
135 #
136 # - at least one numeral, then
137 # - repeats of {dot, at least one numeral}
138 #
139 # The rest (consume to the end of the string) is the stuff we want to cut
140 # off:
141 #
142 # - A period (maybe), then
143 # - "dev", "rc", or "+", then
144 # - numerals, periods, dashes, and "a" through "g" (hex chars)
145 #
146 # Thanks https://www.regextester.com !
147 exp = r"^([0-9]+(?:\.[0-9]+)*)\.?(?:dev|rc|\+)[0-9+a-g\.\-]+$"
148 match = re.match(exp, version)
149 return match.groups()[0] if match is not None else version
150
151
152def _require_version(lib, what, version="0.0"):

Callers 1

check_versionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected