MCPcopy
hub / github.com/google/adk-python / _requirement_names

Function _requirement_names

tests/unittests/test_release_dependencies.py:76–89  ·  view source on GitHub ↗

Returns the lowercased PEP 508 distribution names from ``requirements``. Strips extras specifiers, version specifiers, and environment markers so the caller can do exact-name membership checks.

(requirements: list[str])

Source from the content-addressed store, hash-verified

74
75
76def _requirement_names(requirements: list[str]) -> set[str]:
77 """Returns the lowercased PEP 508 distribution names from ``requirements``.
78
79 Strips extras specifiers, version specifiers, and environment markers so the
80 caller can do exact-name membership checks.
81 """
82 names: set[str] = set()
83 for req in requirements:
84 # Drop everything after a marker, version specifier, or extras block.
85 head = req.split(';', 1)[0].strip()
86 for sep in ('[', '>', '<', '=', '!', '~', ' '):
87 head = head.split(sep, 1)[0]
88 names.add(head.strip().lower())
89 return names
90
91
92def test_main_deps_include_packaging(pyproject: dict) -> None:

Callers 1

Calls 4

setFunction · 0.85
stripMethod · 0.80
splitMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected