Skip to content

Commit a30d0d2

Browse files
committed
fix: resolve pylint warnings
- setup.py: add analysis deps (pandas, matplotlib, seaborn) to [dev] extra so pylint can resolve all imports during linting - pull_labs_poller.py: suppress unused-import on intentional boto3 availability check - setup_validate.py: remove redundant json.JSONDecodeError from except clauses (already covered by parent ValueError) - test_pull_labs_poller.py: disable protected-access check (tests intentionally exercise private methods) - test_role_manager.py: disable protected-access check - test_kcidb_submit.py: suppress unused-argument on mock callbacks that must match urlopen signature Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
1 parent e961b78 commit a30d0d2

6 files changed

Lines changed: 10 additions & 5 deletions

File tree

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
"isort>=5.0",
4646
"pre-commit>=2.0",
4747
"pytest-cov>=2.0",
48+
"pandas>=1.3.0",
49+
"matplotlib>=3.4.0",
50+
"seaborn>=0.11.0",
4851
],
4952
"analysis": [
5053
"pandas>=1.3.0",

src/kernel_ci_cloud_labs/pull_labs_poller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def _validate_default_executor_deps() -> None:
313313

314314
problems: List[str] = []
315315
try:
316-
import boto3 # noqa: F401,PLC0415
316+
import boto3 # noqa: F401,PLC0415 # pylint: disable=unused-import
317317
except ImportError as e:
318318
problems.append(
319319
f"boto3 import failed ({e}) — run: python3.11 -m pip install -e ."

src/kernel_ci_cloud_labs/setup_validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def _check_bucket_policy_statement(s3, bucket_name: str, fix: bool) -> bool:
200200
print(f"✗ Could not read bucket policy ({code}): {e}")
201201
return False
202202
existing = None
203-
except (ValueError, json.JSONDecodeError) as e:
203+
except ValueError as e:
204204
print(f"✗ Bucket policy is not valid JSON: {e}")
205205
return False
206206

@@ -365,7 +365,7 @@ def check_kcidb_jwt() -> bool:
365365
# JWT payload is base64url; pad to a multiple of 4 before decoding.
366366
payload_b64 = parts[1] + "=" * (-len(parts[1]) % 4)
367367
payload = json.loads(base64.urlsafe_b64decode(payload_b64))
368-
except (ValueError, json.JSONDecodeError) as e:
368+
except ValueError as e:
369369
print(f"✗ JWT payload not decodable: {e}")
370370
return False
371371

tests/test_kcidb_submit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def __enter__(self): return self
239239
def __exit__(self, *a): return False
240240
def read(self): return b'{}'
241241

242-
def fake_urlopen(req, timeout=None):
242+
def fake_urlopen(req, timeout=None): # pylint: disable=unused-argument
243243
captured["body"] = json.loads(req.data.decode("utf-8"))
244244
return FakeResp()
245245

@@ -266,7 +266,7 @@ def __enter__(self): return self
266266
def __exit__(self, *a): return False
267267
def read(self): return b'{}'
268268

269-
def fake_urlopen(req, timeout=None):
269+
def fake_urlopen(req, timeout=None): # pylint: disable=unused-argument
270270
captured["body"] = json.loads(req.data.decode("utf-8"))
271271
return FakeResp()
272272

tests/test_pull_labs_poller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: Apache-2.0
22
#
33
# Copyright (C) 2026 Collabora Limited
4+
# pylint: disable=protected-access
45
# Author: Denys Fedoryshchenko <denys.f@collabora.com>
56

67
"""Unit tests for pull_labs_poller (no network, no AWS)."""

tests/test_role_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Unit tests for AWS Role Manager"""
2+
# pylint: disable=protected-access
23

34
__authors__ = ["Max Hubmann <mxhbm@amazon.de>", "Norbert Manthey <nmanthey@amazon.de>"]
45
__copyright__ = "Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved."

0 commit comments

Comments
 (0)