fix: resolve ruff lint errors (E402, F401, F821)
- check_versions.py: restore correct file (import re was placed before shebang causing E402 for all following imports; missing 'client' in kubernetes import causing F821 at line 236) - request_upgrades.py: remove unused 're' import and unused 'client' from kubernetes import (only 'config' is needed here) - web.py: remove unused 'os' import
This commit is contained in:
+4
-2
@@ -1,4 +1,3 @@
|
||||
import re
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
k8s-version-tracker: Weekly Kubernetes image version checker and Mattermost notifier.
|
||||
@@ -9,6 +8,8 @@ notification with the weekly report.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
import logging
|
||||
import subprocess
|
||||
from dataclasses import dataclass, field
|
||||
@@ -16,7 +17,7 @@ from typing import Optional
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import requests
|
||||
from kubernetes import config
|
||||
from kubernetes import client, config
|
||||
from packaging.version import Version, InvalidVersion
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
|
||||
@@ -120,6 +121,7 @@ def parse_image_ref(image: str) -> ImageInfo:
|
||||
def _semver_tags(tags: list[str], current_tag: str) -> Optional[str]:
|
||||
"""From a list of tags, return the latest stable semver tag comparable to current."""
|
||||
norm = current_tag.lstrip("v")
|
||||
has_v_prefix = current_tag.startswith("v")
|
||||
|
||||
# Detect suffix pattern (e.g. '-alpine', '-amd64')
|
||||
suffix_match = re.search(r"(-[a-zA-Z][a-zA-Z0-9._-]*)$", norm)
|
||||
|
||||
Reference in New Issue
Block a user