This commit is contained in:
Iliyan Angelov
2025-12-01 06:50:10 +02:00
parent 91f51bc6fe
commit 62c1fe5951
4682 changed files with 544807 additions and 31208 deletions

View File

@@ -0,0 +1,19 @@
from packaging.specifiers import SpecifierSet
def is_pinned_requirement(spec: SpecifierSet) -> bool:
"""
Check if a requirement is pinned.
Args:
spec (SpecifierSet): The specifier set of the requirement.
Returns:
bool: True if the requirement is pinned, False otherwise.
"""
if not spec or len(spec) != 1:
return False
specifier = next(iter(spec))
return (specifier.operator == '==' and '*' != specifier.version[-1]) or specifier.operator == '==='