From dcebccadbadfd2d2ac1f1b0d745aedd9d70a6c4c Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Fri, 5 Apr 2024 22:05:28 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Enable=20`ARG001`=20to=20prevent?= =?UTF-8?q?=20unused=20arguments=20(#1152)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/routes/users.py | 2 +- backend/app/tests/api/routes/test_items.py | 8 ++++---- backend/app/tests/api/routes/test_users.py | 14 +++++++------- backend/pyproject.toml | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/backend/app/api/routes/users.py b/backend/app/api/routes/users.py index 598cebd..0a30215 100644 --- a/backend/app/api/routes/users.py +++ b/backend/app/api/routes/users.py @@ -115,7 +115,7 @@ def update_password_me( @router.get("/me", response_model=UserOut) -def read_user_me(session: SessionDep, current_user: CurrentUser) -> Any: +def read_user_me(current_user: CurrentUser) -> Any: """ Get current user. """ diff --git a/backend/app/tests/api/routes/test_items.py b/backend/app/tests/api/routes/test_items.py index 56cfa95..a47b358 100644 --- a/backend/app/tests/api/routes/test_items.py +++ b/backend/app/tests/api/routes/test_items.py @@ -6,7 +6,7 @@ from app.tests.utils.item import create_random_item def test_create_item( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: data = {"title": "Foo", "description": "Fighters"} response = client.post( @@ -39,7 +39,7 @@ def test_read_item( def test_read_item_not_found( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: response = client.get( f"{settings.API_V1_STR}/items/999", @@ -96,7 +96,7 @@ def test_update_item( def test_update_item_not_found( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: data = {"title": "Updated title", "description": "Updated description"} response = client.put( @@ -138,7 +138,7 @@ def test_delete_item( def test_delete_item_not_found( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: response = client.delete( f"{settings.API_V1_STR}/items/999", diff --git a/backend/app/tests/api/routes/test_users.py b/backend/app/tests/api/routes/test_users.py index 115e399..28bffe8 100644 --- a/backend/app/tests/api/routes/test_users.py +++ b/backend/app/tests/api/routes/test_users.py @@ -101,7 +101,7 @@ def test_get_existing_user_current_user(client: TestClient, db: Session) -> None def test_get_existing_user_permissions_error( - client: TestClient, normal_user_token_headers: dict[str, str], db: Session + client: TestClient, normal_user_token_headers: dict[str, str] ) -> None: r = client.get( f"{settings.API_V1_STR}/users/999999", @@ -167,7 +167,7 @@ def test_retrieve_users( def test_update_user_me( - client: TestClient, normal_user_token_headers: dict[str, str], db: Session + client: TestClient, normal_user_token_headers: dict[str, str] ) -> None: full_name = "Updated Name" email = random_email() @@ -184,7 +184,7 @@ def test_update_user_me( def test_update_password_me( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: new_password = random_lower_string() data = { @@ -214,7 +214,7 @@ def test_update_password_me( def test_update_password_me_incorrect_password( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: new_password = random_lower_string() data = {"current_password": new_password, "new_password": new_password} @@ -247,7 +247,7 @@ def test_update_user_me_email_exists( def test_update_password_me_same_password_error( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: data = { "current_password": settings.FIRST_SUPERUSER_PASSWORD, @@ -337,7 +337,7 @@ def test_update_user( def test_update_user_not_exists( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: data = {"full_name": "Updated_full_name"} r = client.patch( @@ -415,7 +415,7 @@ def test_delete_user_current_user(client: TestClient, db: Session) -> None: def test_delete_user_not_found( - client: TestClient, superuser_token_headers: dict[str, str], db: Session + client: TestClient, superuser_token_headers: dict[str, str] ) -> None: r = client.delete( f"{settings.API_V1_STR}/users/99999999", diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 2e578c5..a9eeb04 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -57,6 +57,7 @@ select = [ "B", # flake8-bugbear "C4", # flake8-comprehensions "UP", # pyupgrade + "ARG001", # unused arguments in functions ] ignore = [ "E501", # line too long, handled by black