Skip to content

Runs ruff on repo #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/api/create_container_registry_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Example of creating a container registry auth with the Runpod API. """
"""Example of creating a container registry auth with the Runpod API."""

import runpod

Expand Down
3 changes: 1 addition & 2 deletions examples/api/create_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
""" Example of creating an endpoint with the Runpod API. """
"""Example of creating an endpoint with the Runpod API."""

import runpod

# Set your global API key with `runpod config` or uncomment the line below:
# runpod.api_key = "YOUR_RUNPOD_API_KEY"

try:

new_template = runpod.create_template(
name="test", image_name="runpod/base:0.4.4", is_serverless=True
)
Expand Down
3 changes: 1 addition & 2 deletions examples/api/create_template.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
""" Example of creating a template with the Runpod API. """
"""Example of creating a template with the Runpod API."""

import runpod

# Set your global API key with `runpod config` or uncomment the line below:
# runpod.api_key = "YOUR_RUNPOD_API_KEY"

try:

new_template = runpod.create_template(name="test", image_name="runpod/base:0.1.0")

print(new_template)
Expand Down
2 changes: 1 addition & 1 deletion examples/endpoints/health.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Example of getting the health of an endpoint. """
"""Example of getting the health of an endpoint."""

import runpod

Expand Down
2 changes: 1 addition & 1 deletion examples/endpoints/streaming.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Example of streaming data from an endpoint. """
"""Example of streaming data from an endpoint."""

import runpod

Expand Down
2 changes: 1 addition & 1 deletion examples/serverless/concurrent_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Concurrency Modifier Example """
"""Concurrency Modifier Example"""

import runpod

Expand Down
2 changes: 1 addition & 1 deletion examples/serverless/simple_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Simple Handler
"""Simple Handler

To setup a local API server, run the following command:
python simple_handler.py --rp_serve_api
Expand Down
2 changes: 1 addition & 1 deletion runpod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Allows runpod to be imported as a module. """
"""Allows runpod to be imported as a module."""

import logging
import os
Expand Down
2 changes: 1 addition & 1 deletion runpod/api/mutations/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Allows for the creation of mutations in the GraphQL API. """
"""Allows for the creation of mutations in the GraphQL API."""
2 changes: 1 addition & 1 deletion runpod/api/mutations/container_register_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" RunPod | API Wrapper | Mutations | Container Registry Auth """
"""RunPod | API Wrapper | Mutations | Container Registry Auth"""


def generate_container_registry_auth(name: str, username: str, password: str):
Expand Down
2 changes: 1 addition & 1 deletion runpod/api/mutations/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" RunPod | API Wrapper | Mutations | Endpoints """
"""RunPod | API Wrapper | Mutations | Endpoints"""

# pylint: disable=too-many-arguments

Expand Down
2 changes: 1 addition & 1 deletion runpod/api/mutations/templates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" RunPod | API Wrapper | Mutations | Templates """
"""RunPod | API Wrapper | Mutations | Templates"""

# pylint: disable=too-many-arguments, too-many-branches

Expand Down
2 changes: 1 addition & 1 deletion runpod/api/queries/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" GraphQL queries for endpoints. """
"""GraphQL queries for endpoints."""

QUERY_ENDPOINT = """
query Query {
Expand Down
1 change: 1 addition & 0 deletions runpod/cli/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .groups.ssh.commands import ssh_cli



@click.group()
def runpod_cli():
"""A collection of CLI functions for RunPod."""
Expand Down
1 change: 0 additions & 1 deletion runpod/cli/groups/project/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def start_project(): # pylint: disable=too-many-locals, too-many-branches
return

with SSHConnection(project_pod_id) as ssh_conn:

project_path_uuid = (
f'{config["project"]["volume_mount_path"]}/{config["project"]["uuid"]}'
)
Expand Down
2 changes: 1 addition & 1 deletion runpod/cli/utils/rp_runpodignore.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Reads the .runpodignore file and returns a list of files to ignore. """
"""Reads the .runpodignore file and returns a list of files to ignore."""

import fnmatch
import os
Expand Down
2 changes: 1 addition & 1 deletion runpod/endpoint/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Helper functions for the RunPod Endpoint API. """
"""Helper functions for the RunPod Endpoint API."""

FINAL_STATES = ["COMPLETED", "FAILED", "TIMED_OUT"]

Expand Down
2 changes: 1 addition & 1 deletion runpod/serverless/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Core functionality for the runpod serverless worker. """
"""Core functionality for the runpod serverless worker."""

import asyncio
import ctypes
Expand Down
2 changes: 1 addition & 1 deletion runpod/serverless/modules/rp_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Retrieve handler info. """
"""Retrieve handler info."""

import inspect
from typing import Callable
Expand Down
2 changes: 1 addition & 1 deletion runpod/serverless/modules/rp_http.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This module is used to handle HTTP requests.
This module is used to handle HTTP requests.
"""

import json
Expand Down
1 change: 0 additions & 1 deletion runpod/serverless/utils/rp_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
runpod | serverless | utils | validator.py
Provides a function to validate the input to the model.
"""

# pylint: disable=too-many-branches

import json
Expand Down
2 changes: 1 addition & 1 deletion runpod/user_agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" User-Agent for RunPod-Python-SDK """
"""User-Agent for RunPod-Python-SDK"""

import os
import platform
Expand Down
1 change: 1 addition & 0 deletions runpod/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from importlib.metadata import PackageNotFoundError, version



def get_version():
""" Get the version of runpod-python """ ""
try:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
}

if __name__ == "__main__":

setup(
name="runpod",
use_scm_version=True,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api/test_ctl_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Tests for ctl_commands.py """
"""Tests for ctl_commands.py"""

import unittest
from unittest.mock import patch
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api/test_mutation_container_registry_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Test suite for the generate_container_registry_auth function. """
"""Test suite for the generate_container_registry_auth function."""

import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_api/test_mutations_templates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Unit tests for the function generate_pod_template in the file api_wrapper.py """
"""Unit tests for the function generate_pod_template in the file api_wrapper.py"""

import unittest

Expand Down
3 changes: 2 additions & 1 deletion tests/test_cli/test_cli_groups/test_exec_helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
""" Unit tests for the runpod.cli.groups.exec.helpers module. """
"""Unit tests for the runpod.cli.groups.exec.helpers module."""

import unittest
from unittest.mock import mock_open, patch

from runpod.cli.groups.exec.helpers import POD_ID_FILE, get_session_pod



class TestGetSessionPod(unittest.TestCase):
"""Unit tests for get_session_pod"""

Expand Down
3 changes: 1 addition & 2 deletions tests/test_cli/test_cli_groups/test_project_functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Test functions in runpod.cli.groups.project.functions module. """
"""Test functions in runpod.cli.groups.project.functions module."""

import os
import shutil
Expand Down Expand Up @@ -206,7 +206,6 @@ def test_failed_pod_launch(self, mock_attempt_pod, mock_get_pod):
with patch("builtins.print") as mock_print, patch(
"runpod.cli.groups.project.functions.load_project_config"
):

start_project()
mock_print.assert_called_with(
"Selected GPU types unavailable, try again later or use a different type."
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cli/test_cli_groups/test_ssh_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from runpod.cli.groups.ssh.commands import add_key, list_keys



class TestSSHCommands(unittest.TestCase):
"""Tests for the SSH commands of the CLI."""

Expand All @@ -21,7 +22,6 @@ def test_list_keys(self):
{"name": "key2", "type": "DSA", "fingerprint": "fp2"},
],
) as mock_get_keys:

result = runner.invoke(list_keys)

self.assertIn("key1", result.output)
Expand All @@ -39,7 +39,6 @@ def test_add_key_without_params(self):
) as mock_prompt, patch(
"runpod.cli.groups.ssh.commands.click.confirm", return_value=True
) as mock_confirm: # pylint: disable=line-too-long

result = runner.invoke(add_key, [])

self.assertIn("The key has been added to your account.", result.output)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_cli_groups/test_ssh_functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Tests for the SSH functions """
"""Tests for the SSH functions"""

import base64
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_cli_utils/test_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Unit testing for runpod.cli.utils.rp_info.py """
"""Unit testing for runpod.cli.utils.rp_info.py"""

from unittest.mock import patch

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_cli_utils/test_runpodignore.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Unit tests for the runpodignore module in the cli.utils package. """
"""Unit tests for the runpodignore module in the cli.utils package."""

# pylint: disable=duplicate-code

Expand Down
4 changes: 4 additions & 0 deletions tests/test_cli/test_cli_utils/test_ssh_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class TestSSHConnection(unittest.TestCase):
"""Test the SSHConnection class."""

def setUp(self):
self.patch_get_pod_ssh_ip_port = patch(
"runpod.cli.utils.ssh_cmd.get_pod_ssh_ip_port",
return_value=("127.0.0.1", 22),
).start()

self.patch_get_pod_ssh_ip_port = patch(
"runpod.cli.utils.ssh_cmd.get_pod_ssh_ip_port",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_cli_utils/test_userspace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Unit testing for runpod.cli.utils.rp_userspace.py """
"""Unit testing for runpod.cli.utils.rp_userspace.py"""

import os
import unittest
Expand Down
1 change: 1 addition & 0 deletions tests/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from runpod.error import AuthenticationError, QueryError, RunPodError



class TestErrorClasses(unittest.TestCase):
"""Unit tests for the error classes in the runpod.error module."""

Expand Down
2 changes: 0 additions & 2 deletions tests/test_serverless/test_modules/test_http.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Test rp_http.py module.
"""

# pylint: disable=too-few-public-methods

import gc
Expand Down Expand Up @@ -89,7 +88,6 @@ def mock_request_info_init(self, *args, **kwargs):
) as mock_retry, patch.object(
aiohttp.RequestInfo, "__init__", mock_request_info_init
):

mock_retry.side_effect = aiohttp.ClientResponseError(
request_info=MockRequestInfo,
history=None,
Expand Down
1 change: 0 additions & 1 deletion tests/test_serverless/test_modules/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_call_log(self):
log = rp_logger.RunPodLogger()

with patch("runpod.serverless.modules.rp_logger.RunPodLogger.log") as mock_log:

log.warn("Test log message")

mock_log.assert_called_once_with("Test log message", "WARN", None)
Expand Down
1 change: 1 addition & 0 deletions tests/test_serverless/test_modules/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from runpod.serverless.modules.rp_progress import _thread_target, progress_update



class TestProgressUpdate(unittest.TestCase):
"""Tests for the progress_update function."""

Expand Down
1 change: 1 addition & 0 deletions tests/test_shared/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from unittest.mock import mock_open, patch



class TestAPIKey(unittest.TestCase):
"""Test the API key"""

Expand Down
2 changes: 1 addition & 1 deletion tests/test_user_agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Tests for the user_agent module. """
"""Tests for the user_agent module."""

import os
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Test the version module """
"""Test the version module"""

from importlib.metadata import PackageNotFoundError
from unittest.mock import patch
Expand Down
Loading