fix: remove unused imports and f-string prefixes
All checks were successful
CI / Lint & Check (push) Successful in 12s
All checks were successful
CI / Lint & Check (push) Successful in 12s
This commit is contained in:
@@ -6,30 +6,13 @@ import time
|
|||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from .client import api_request, paginated_request, resolve_digest
|
from .client import api_request, resolve_digest
|
||||||
from .constants import (
|
from .constants import (
|
||||||
ADMIN_PAGE_SIZE,
|
ADMIN_PAGE_SIZE,
|
||||||
COL_ACTION,
|
|
||||||
COL_ADMIN,
|
COL_ADMIN,
|
||||||
COL_CREATED,
|
COL_CREATED,
|
||||||
COL_CVE,
|
|
||||||
COL_DIGEST,
|
|
||||||
COL_EMAIL,
|
COL_EMAIL,
|
||||||
COL_OPERATION,
|
|
||||||
COL_PACKAGE,
|
|
||||||
COL_PROJECT,
|
|
||||||
COL_REPO,
|
|
||||||
COL_RESOURCE,
|
|
||||||
COL_SCHEDULE,
|
|
||||||
COL_SEVERITY,
|
|
||||||
COL_SIZE,
|
|
||||||
COL_STATUS,
|
|
||||||
COL_TAG,
|
|
||||||
COL_TAGS,
|
|
||||||
COL_TIME,
|
|
||||||
COL_USERNAME,
|
COL_USERNAME,
|
||||||
COL_VERSION,
|
|
||||||
DEFAULT_RESULT_LIMIT,
|
|
||||||
GC_SCHEDULE_MANUAL,
|
GC_SCHEDULE_MANUAL,
|
||||||
HTTP_ACCEPTED,
|
HTTP_ACCEPTED,
|
||||||
HTTP_CREATED,
|
HTTP_CREATED,
|
||||||
@@ -799,7 +782,7 @@ def cmd_gc_run(args: Namespace, user: str, password: str, url: str) -> int:
|
|||||||
latest = history[0]
|
latest = history[0]
|
||||||
status = latest.get("job_status", "")
|
status = latest.get("job_status", "")
|
||||||
if status == "Success":
|
if status == "Success":
|
||||||
print(f"\nGC complete")
|
print("\nGC complete")
|
||||||
return 0
|
return 0
|
||||||
elif status in ("Error", "Failed", "Stopped"):
|
elif status in ("Error", "Failed", "Stopped"):
|
||||||
print(f"\nGC failed: {status}")
|
print(f"\nGC failed: {status}")
|
||||||
@@ -916,7 +899,7 @@ def cmd_user_create(args: Namespace, user: str, password: str, url: str) -> int:
|
|||||||
if admin_result.get("status") == HTTP_OK or not admin_result.get("error"):
|
if admin_result.get("status") == HTTP_OK or not admin_result.get("error"):
|
||||||
print(f"Granted admin privileges to: {username}")
|
print(f"Granted admin privileges to: {username}")
|
||||||
else:
|
else:
|
||||||
print(f"Warning: Failed to grant admin privileges")
|
print("Warning: Failed to grant admin privileges")
|
||||||
print_error(admin_result)
|
print_error(admin_result)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -1094,9 +1077,6 @@ def cmd_audit_purge(args: Namespace, user: str, password: str, url: str) -> int:
|
|||||||
print("Aborted")
|
print("Aborted")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
# Get current purge schedule
|
|
||||||
current = api_request(f"{url}/api/v2.0/system/purgeaudit/schedule", user, password)
|
|
||||||
|
|
||||||
# Build schedule payload
|
# Build schedule payload
|
||||||
payload = {
|
payload = {
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import unittest
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from harbor.client import build_url, resolve_digest
|
from harbor.client import build_url, resolve_digest
|
||||||
from harbor.constants import SHA256_PREFIX
|
|
||||||
|
|
||||||
|
|
||||||
class TestBuildUrl(unittest.TestCase):
|
class TestBuildUrl(unittest.TestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user