Skip to content

Commit bc1a809

Browse files
committed
fix(ruff): resolve all remaining linting errors
- CLI: Add explicit re-exports for config, ssh, and get_pod_ssh_ip_port (F401) - Pod commands: Replace bare except with specific OSError handling (E722) - FastAPI: Remove duplicate Job import from worker_state (F811) - RPC Job: Use isinstance() instead of type() for dict comparison (E721) - Llama2 template: Add ruff noqa directive for template placeholder code (F821) - Download tests: Rename duplicate test_download_file to test_download_file_with_content_disposition (F811) All ruff checks now pass without errors.
1 parent c4ccc0c commit bc1a809

8 files changed

Lines changed: 8 additions & 7 deletions

File tree

runpod/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import threading
44

5-
from .groups import config, ssh
5+
from .groups import config as config, ssh as ssh
66

77
STOP_EVENT = threading.Event()
88

runpod/cli/groups/pod/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,5 @@ def sync_pods(source_pod_id, dest_pod_id, source_workspace, dest_workspace):
242242
try:
243243
if 'local_temp_path' in locals():
244244
os.unlink(local_temp_path)
245-
except:
245+
except OSError:
246246
pass

runpod/cli/groups/project/starter_templates/llama2/src/handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
""" A template for a Llama2 handler file. """
22

33
# pylint: skip-file
4+
# ruff: noqa
45

56

67
from transformers import HfApi

runpod/cli/groups/ssh/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
""" CLI functions for SSH. """
22

3-
from . import functions
3+
from . import functions as functions

runpod/cli/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
""" Collection of utility functions for the CLI """
22

3-
from .rp_info import get_pod_ssh_ip_port
3+
from .rp_info import get_pod_ssh_ip_port as get_pod_ssh_ip_port

runpod/serverless/modules/rp_fastapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .rp_handler import is_generator
1818
from .rp_job import run_job, run_job_generator
1919
from .rp_ping import Heartbeat
20-
from .worker_state import Job, JobsProgress
20+
from .worker_state import JobsProgress
2121

2222
RUNPOD_ENDPOINT_ID = os.environ.get("RUNPOD_ENDPOINT_ID", None)
2323

runpod/serverless/modules/rp_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def handle_job(session: ClientSession, config: Dict[str, Any], job) -> dic
127127
async for stream_output in generator_output:
128128
log.debug(f"Stream output: {stream_output}", job["id"])
129129

130-
if type(stream_output.get("output")) == dict:
130+
if isinstance(stream_output.get("output"), dict):
131131
if stream_output["output"].get("error"):
132132
stream_output = {"error": str(stream_output["output"]["error"])}
133133

tests/test_serverless/test_utils/test_download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_download_file(self, mock_file, mock_get):
175175

176176
@patch("runpod.serverless.utils.rp_download.SyncClientSession.get")
177177
@patch("builtins.open", new_callable=mock_open)
178-
def test_download_file(self, mock_file, mock_get):
178+
def test_download_file_with_content_disposition(self, mock_file, mock_get):
179179
"""
180180
Tests download_file using filename from Content-Disposition
181181
"""

0 commit comments

Comments
 (0)