From ae2f54bdda98b9294b2ebd3f9d2248e45e9a7ae5 Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Wed, 4 Dec 2024 12:15:44 +0530 Subject: [PATCH] chore: format code and remove unused dependencies --- pyproject.toml | 82 ++++++++++++++++++++++++- tests/async_tests/test_package.py | 4 +- tests/sync_tests/test_configtree.py | 4 +- tests/sync_tests/test_deployment.py | 4 +- tests/sync_tests/test_managedservice.py | 8 +-- tests/sync_tests/test_project.py | 4 +- tests/utils/test_util.py | 4 +- 7 files changed, 87 insertions(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 44d4fa2..5020f32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,9 +34,87 @@ dev = [ "pytest-cov>=5.0.0", "pytest-mock>=3.14.0", "pytest>=8.3.3", - "anyio>=4.5.2", - "asyncer>=0.0.8", "typing-extensions>=4.12.2", "pytest-asyncio>=0.24.0", "asyncmock>=0.4.2", ] + + +[tool.ruff] +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +# Same as Black. +line-length = 90 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[tool.ruff.lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F", "B", "Q", "W"] +ignore = ["E741", "B904"] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[tool.ruff.format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/tests/async_tests/test_package.py b/tests/async_tests/test_package.py index 705c4cf..cf6380e 100644 --- a/tests/async_tests/test_package.py +++ b/tests/async_tests/test_package.py @@ -51,9 +51,7 @@ async def test_create_package_success(client, mocker: AsyncMock): # noqa: F811 json={ "kind": "Package", "metadata": {"name": "test-package", "guid": "mock_package_guid"}, - "spec": { - "users": [{"userGUID": "mock_user_guid", "emailID": "mock_email"}] - }, + "spec": {"users": [{"userGUID": "mock_user_guid", "emailID": "mock_email"}]}, }, ) diff --git a/tests/sync_tests/test_configtree.py b/tests/sync_tests/test_configtree.py index f9efd85..5c837b9 100644 --- a/tests/sync_tests/test_configtree.py +++ b/tests/sync_tests/test_configtree.py @@ -205,9 +205,7 @@ def test_update_configtree_success(client, mocker: MockerFixture): # noqa: F811 } # Call the update_configtree method - response = client.update_configtree( - name="mock_configtree_name", body=configtree_body - ) + response = client.update_configtree(name="mock_configtree_name", body=configtree_body) # Validate the response assert isinstance(response, Munch) diff --git a/tests/sync_tests/test_deployment.py b/tests/sync_tests/test_deployment.py index 19ea9fe..2ffaa19 100644 --- a/tests/sync_tests/test_deployment.py +++ b/tests/sync_tests/test_deployment.py @@ -195,9 +195,7 @@ def test_update_deployment_success(client, deployment_body, mocker: MockerFixtur if v is not None } - response = client.update_deployment( - name="mock_deployment_name", body=deployment_body - ) + response = client.update_deployment(name="mock_deployment_name", body=deployment_body) assert isinstance(response, Munch) assert response["metadata"]["guid"] == "test_deployment_guid" diff --git a/tests/sync_tests/test_managedservice.py b/tests/sync_tests/test_managedservice.py index f6304fc..0d88ac7 100644 --- a/tests/sync_tests/test_managedservice.py +++ b/tests/sync_tests/test_managedservice.py @@ -35,9 +35,7 @@ def test_list_providers_success(client, mocker: MockerFixture): # noqa: F811 # Validate the response assert isinstance(response, Munch) - assert response["items"] == [ - {"name": "test-provider", "guid": "mock_provider_guid"} - ] + assert response["items"] == [{"name": "test-provider", "guid": "mock_provider_guid"}] def test_list_instances_success(client, mocker: MockerFixture): # noqa: F811 @@ -69,9 +67,7 @@ def test_list_instances_success(client, mocker: MockerFixture): # noqa: F811 # Validate the response assert isinstance(response, Munch) - assert response["items"] == [ - {"name": "test-instance", "guid": "mock_instance_guid"} - ] + assert response["items"] == [{"name": "test-instance", "guid": "mock_instance_guid"}] def test_get_instance_success(client, mocker: MockerFixture): # noqa: F811 diff --git a/tests/sync_tests/test_project.py b/tests/sync_tests/test_project.py index 8259f2e..9987d70 100644 --- a/tests/sync_tests/test_project.py +++ b/tests/sync_tests/test_project.py @@ -242,9 +242,7 @@ def test_update_project_success(client, mock_response_project, mocker: MockerFix } # Call the update_project method - response = client.update_project( - project_guid="mock_project_guid", body=project_body - ) + response = client.update_project(project_guid="mock_project_guid", body=project_body) # Validate the response assert isinstance(response, Munch) diff --git a/tests/utils/test_util.py b/tests/utils/test_util.py index 2109849..0a40217 100644 --- a/tests/utils/test_util.py +++ b/tests/utils/test_util.py @@ -30,9 +30,7 @@ def mock_response_project(): "kind": "Project", "metadata": {"name": "test-project", "guid": "mock_project_guid"}, "spec": { - "users": [ - {"userGUID": "mock_user_guid", "emailID": "test.user@example.com"} - ] + "users": [{"userGUID": "mock_user_guid", "emailID": "test.user@example.com"}] }, }