Skip to content

Commit f3e79d1

Browse files
committed
fix: apply isort and black formatting
Signed-off-by: Dan Gil <[email protected]>
1 parent ba316c7 commit f3e79d1

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

.github/workflows/extract_dependency_versions.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ def extract_dockerfile_args(self, dockerfile_path: Path, component: str) -> None
782782
]
783783
if any(subdep in key for subdep in skip_subdeps):
784784
continue
785-
785+
786786
category = (
787787
"System"
788788
if key.startswith(
@@ -1846,15 +1846,15 @@ def normalize_dependency_name(self, name: str, category: str = "") -> str:
18461846
18471847
Note: This is intentionally conservative to avoid false positives.
18481848
Only normalizes well-known dependencies with common naming variations.
1849-
1849+
18501850
For Go modules, we don't normalize at all since the full import path
18511851
is significant (e.g., github.com/pkg/errors vs k8s.io/errors are different).
18521852
"""
18531853
# For Go dependencies, use the full name without normalization
18541854
# Go module paths are unique identifiers and should not be normalized
18551855
if category == "Go Dependency" or category == "Go Module":
18561856
return name.strip()
1857-
1857+
18581858
# Convert to lowercase for comparison
18591859
name_lower = name.lower()
18601860

@@ -1863,7 +1863,7 @@ def normalize_dependency_name(self, name: str, category: str = "") -> str:
18631863
pytorch_exceptions = ["pytorch triton", "pytorch_triton", "triton"]
18641864
if any(exc in name_lower for exc in pytorch_exceptions):
18651865
return name_lower # Don't normalize these
1866-
1866+
18671867
# Common normalization rules (ordered by specificity to avoid false matches)
18681868
normalizations = {
18691869
"tensorrt-llm": "tensorrt-llm",
@@ -1890,10 +1890,10 @@ def normalize_dependency_name(self, name: str, category: str = "") -> str:
18901890
def _normalize_version_for_comparison(self, version: str) -> str:
18911891
"""
18921892
Normalize version string for comparison by removing pinning operators.
1893-
1893+
18941894
This allows us to detect true version differences while ignoring
18951895
differences in how versions are pinned.
1896-
1896+
18971897
Examples:
18981898
- "==0.115.12" -> "0.115.12"
18991899
- ">=0.115.0" -> "0.115.0"
@@ -1902,18 +1902,18 @@ def _normalize_version_for_comparison(self, version: str) -> str:
19021902
- "2.7.1+cu128" -> "2.7.1+cu128" (unchanged)
19031903
"""
19041904
import re
1905-
1905+
19061906
# Remove common Python version operators
19071907
# This regex captures: ==, >=, <=, ~=, !=, <, >, and extracts the version
19081908
version = version.strip()
1909-
1909+
19101910
# Handle compound version specs like ">=32.0.1,<33.0.0" - take the first version
19111911
if "," in version:
19121912
version = version.split(",")[0].strip()
1913-
1913+
19141914
# Remove operators
19151915
version = re.sub(r"^(==|>=|<=|~=|!=|<|>)\s*", "", version)
1916-
1916+
19171917
return version.strip()
19181918

19191919
def detect_version_discrepancies(self) -> List[Dict[str, any]]:
@@ -1924,7 +1924,7 @@ def detect_version_discrepancies(self) -> List[Dict[str, any]]:
19241924
List of dictionaries containing discrepancy information:
19251925
- dependency_name: The normalized dependency name
19261926
- instances: List of {version, source_file, component} for each occurrence
1927-
1927+
19281928
Note: This intentionally filters out some categories to reduce false positives:
19291929
- Base/Runtime Images (intentionally different per component)
19301930
- Go indirect dependencies (transitive, expected to vary)
@@ -1936,14 +1936,14 @@ def detect_version_discrepancies(self) -> List[Dict[str, any]]:
19361936
"Runtime Image",
19371937
"Docker Compose Service", # Services use different base images
19381938
}
1939-
1939+
19401940
# Dependency names to skip (even if they have different categories)
19411941
skip_names = {
19421942
"base image",
19431943
"runtime image",
19441944
"base", # Often refers to base images
19451945
}
1946-
1946+
19471947
# Group dependencies by normalized name
19481948
dependency_groups = {}
19491949

@@ -1956,17 +1956,20 @@ def detect_version_discrepancies(self) -> List[Dict[str, any]]:
19561956
# Skip unversioned dependencies for discrepancy detection
19571957
if dep["Version"] in ["unspecified", "N/A", "", "latest"]:
19581958
continue
1959-
1959+
19601960
# Skip categories that are expected to vary
19611961
if category in skip_categories:
19621962
continue
1963-
1963+
19641964
# Skip dependency names that are expected to vary
19651965
if normalized_name in skip_names:
19661966
continue
1967-
1967+
19681968
# Skip Go indirect dependencies (transitive dependencies)
1969-
if category == "Go Dependency" and "indirect" in dep.get("Notes", "").lower():
1969+
if (
1970+
category == "Go Dependency"
1971+
and "indirect" in dep.get("Notes", "").lower()
1972+
):
19701973
continue
19711974

19721975
if normalized_name not in dependency_groups:
@@ -1998,7 +2001,7 @@ def detect_version_discrepancies(self) -> List[Dict[str, any]]:
19982001
if len(normalized_versions) > 1:
19992002
# Get the original versions for display
20002003
original_versions = sorted(set(inst["version"] for inst in instances))
2001-
2004+
20022005
discrepancies.append(
20032006
{
20042007
"normalized_name": normalized_name,

0 commit comments

Comments
 (0)