MCPcopy Index your code
hub / github.com/microsoft/SandDance / ensure_python

Function ensure_python

python/jupyter-widget/setupbase.py:91–106  ·  view source on GitHub ↗

Given a list of range specifiers for python, ensure compatibility.

(specs)

Source from the content-addressed store, hash-verified

89
90
91def ensure_python(specs):
92 """Given a list of range specifiers for python, ensure compatibility.
93 """
94 if not isinstance(specs, (list, tuple)):
95 specs = [specs]
96 v = sys.version_info
97 part = '%s.%s' % (v.major, v.minor)
98 for spec in specs:
99 if part == spec:
100 return
101 try:
102 if eval(part + spec):
103 return
104 except SyntaxError:
105 pass
106 raise ValueError('Python version %s unsupported' % part)
107
108
109def find_packages(top=HERE):

Callers 1

setup.pyFile · 0.90

Calls 1

evalFunction · 0.50

Tested by

no test coverage detected