MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_extra

Function get_extra

src/packagedcode/pypi.py:2249–2272  ·  view source on GitHub ↗

Return the "extra" value of a ``marker`` requirement Marker or None.

(marker)

Source from the content-addressed store, hash-verified

2247
2248
2249def get_extra(marker):
2250 """
2251 Return the "extra" value of a ``marker`` requirement Marker or None.
2252 """
2253 if not marker or not isinstance(marker, markers.Marker):
2254 return
2255
2256 marks = getattr(marker, '_markers', [])
2257
2258 for mark in marks:
2259 # filter for variable(extra) == value tuples of (Variable, Op, Value)
2260 if not isinstance(mark, tuple) and not len(mark) == 3:
2261 continue
2262
2263 variable, operator, value = mark
2264
2265 if (
2266 isinstance(variable, markers.Variable)
2267 and variable.value == 'extra'
2268 and isinstance(operator, markers.Op)
2269 and operator.value == '=='
2270 and isinstance(value, markers.Value)
2271 ):
2272 return value.value
2273
2274
2275def get_python_version_os(marker):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected