Coverage for appr/semver.py: 29%

# Coverage for appr/semver.py : 29%

## 17 statements 5 run 12 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from __future__ import absolute_import, division, print_function from semantic_version import Spec, Version def versions(versions_str, stable=False): if stable: return [Version(x) for x in versions_str if len(x.split("-")) == 1] else: return [Version(x) for x in versions_str] def last_version(versions_str, stable=False): return sorted(versions(versions_str, stable))[-1] def select_version(versions_str, query, stable=False): if isinstance(query, str): query = query.split(",") query = [x.replace(" ", "") for x in query] stable = True if "-" in str(query): stable = False spec = Spec(*query) return spec.select(versions(versions_str, stable))