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,26 @@
"""
Utility functions for `pip-audit`.
"""
import sys
from typing import NoReturn # pragma: no cover
from packaging.version import Version
def assert_never(x: NoReturn) -> NoReturn: # pragma: no cover
"""
A hint to the typechecker that a branch can never occur.
"""
assert False, f"unhandled type: {type(x).__name__}"
def python_version() -> Version:
"""
Return a PEP-440-style version for the current Python interpreter.
This is more rigorous than `platform.python_version`, which can include
non-PEP-440-compatible data.
"""
info = sys.version_info
return Version(f"{info.major}.{info.minor}.{info.micro}")