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
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
k8s-version-tracker: Weekly Kubernetes image version checker and Mattermost notifier.
|
k8s-version-tracker: Weekly Kubernetes image version checker and Mattermost notifier.
|
||||||
@@ -9,6 +8,8 @@ notification with the weekly report.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@@ -16,7 +17,7 @@ from typing import Optional
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from kubernetes import config
|
from kubernetes import client, config
|
||||||
from packaging.version import Version, InvalidVersion
|
from packaging.version import Version, InvalidVersion
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
|
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]:
|
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."""
|
"""From a list of tags, return the latest stable semver tag comparable to current."""
|
||||||
norm = current_tag.lstrip("v")
|
norm = current_tag.lstrip("v")
|
||||||
|
has_v_prefix = current_tag.startswith("v")
|
||||||
|
|
||||||
# Detect suffix pattern (e.g. '-alpine', '-amd64')
|
# Detect suffix pattern (e.g. '-alpine', '-amd64')
|
||||||
suffix_match = re.search(r"(-[a-zA-Z][a-zA-Z0-9._-]*)$", norm)
|
suffix_match = re.search(r"(-[a-zA-Z][a-zA-Z0-9._-]*)$", norm)
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@ the tag updates. ArgoCD auto-syncs from there — no direct kubectl patching.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -18,7 +18,7 @@ from datetime import datetime, timezone
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from kubernetes import client, config
|
from kubernetes import config
|
||||||
from packaging.version import Version, InvalidVersion
|
from packaging.version import Version, InvalidVersion
|
||||||
|
|
||||||
from check_versions import (
|
from check_versions import (
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Routes:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user