From 246fa69216550267f80e53f5187859286b63ea3d Mon Sep 17 00:00:00 2001 From: bensteUEM Date: Mon, 7 Oct 2024 19:45:18 +0200 Subject: [PATCH] fixing more ruff linting issues #102 --- churchtools_api/churchtools_api_abstract.py | 2 +- churchtools_api/groups.py | 13 ++++++++++--- churchtools_api/resources.py | 4 ++-- generate_pyproj.py | 1 + pyproject.toml | 10 +++++----- tests/test_churchtools_api_abstract.py | 2 +- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/churchtools_api/churchtools_api_abstract.py b/churchtools_api/churchtools_api_abstract.py index 168fed9..72fca49 100644 --- a/churchtools_api/churchtools_api_abstract.py +++ b/churchtools_api/churchtools_api_abstract.py @@ -25,7 +25,7 @@ def combine_paginated_response_data( Args: response_content: the original response form ChurchTools which either has meta/pagination or not url: the url used for the original request in order to repear it - kwargs - can contain headers and params passthrough + kwargs: can contain headers and params passthrough Returns: response 'data' without pagination diff --git a/churchtools_api/groups.py b/churchtools_api/groups.py index 610596f..480a924 100644 --- a/churchtools_api/groups.py +++ b/churchtools_api/groups.py @@ -22,6 +22,10 @@ def get_groups(self, **kwargs) -> list[dict]: Keywords: group_id: int: optional filter by group id (only to be used on it's own) + kwargs: keyword arguments passthrough + + Keywords: + group_id Permissions: requires "view group" for all groups which should be considered @@ -117,7 +121,7 @@ def create_group( name: required name group_status_id: required status id grouptype_id: required grouptype id - k + kwargs: keywords see below Kwargs: campus_id: int: optional campus id @@ -284,6 +288,7 @@ def get_group_members(self, group_id: int, **kwargs) -> list[dict]: Arguments: group_id: group id + kwargs: see below Kwargs: role_ids: list[int]: optional filter list of role ids @@ -326,8 +331,9 @@ def get_groups_members( Args: group_ids: list of group ids to look for. Defaults to Any with_deleted: If true return also delted group members. Defaults to True + kwargs: see below - Kwargs: + Keywords: grouptype_role_ids: list[int] of grouptype_role_ids to consider person_ids: list[int]: person to consider for result @@ -379,8 +385,9 @@ def add_group_member(self, group_id: int, person_id: int, **kwargs) -> dict: Arguments: group_id: required group id person_id: required person id + kwargs: see below - Kwargs: + Keywords: grouptype_role_id: int: optional grouptype role id group_member_status: str: optional member status diff --git a/churchtools_api/resources.py b/churchtools_api/resources.py index be4ef0b..3f6aaf3 100644 --- a/churchtools_api/resources.py +++ b/churchtools_api/resources.py @@ -51,9 +51,9 @@ def get_bookings(self, **kwargs) -> list[dict]: """Access to all Resource bookings in churchtools based on a combination of Keyword Arguments. Arguments: - kwargs - see list below - some combination limits do apply + kwargs: see list below - some combination limits do apply - KwArgs: + Keywords: booking_id: int: only one booking by id (use standalone only) resources_ids:list[int]: required if not booking_id status_ids: list[int]: filter by list of stats ids to consider (requires resource_ids) diff --git a/generate_pyproj.py b/generate_pyproj.py index 06c5e1d..13d7e3b 100644 --- a/generate_pyproj.py +++ b/generate_pyproj.py @@ -34,6 +34,7 @@ "autopep8": "^2.0.4", "pytest": "^8.3.3", "pre-commit": "^3.8.0", + "ruff": "^0.6.9", }, }, }, diff --git a/pyproject.toml b/pyproject.toml index 7d6ce93..a3f73a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ setuptools = "^66.1.1" autopep8 = "^2.0.4" pytest = "^8.3.3" pre-commit = "^3.8.0" +ruff = "^0.6.9" [tool.ruff] exclude = [ @@ -64,10 +65,11 @@ select = [ "ALL", ] ignore = [ - "S101", + "S101", # TODO: Github #104 - pytest asserts "ANN001","ANN002","ANN003","ANN201", - "FIX002", - "C901","ARG002", + "FIX002", #Open ToDos + "C901", #complexity + "ARG002", "FA100", "FBT001","FBT002", "TD002","TD003","TD004", @@ -81,9 +83,7 @@ ignore = [ "PTH110","PTH107","PTH123","PTH118","PTH112","PTH103", "SIM102","SIM113","SIM115", "G001","G003", "G004", - "B024", "A001","A002", - "D417", "TRY300", "BLE001", "PERF401" diff --git a/tests/test_churchtools_api_abstract.py b/tests/test_churchtools_api_abstract.py index 9484839..04a2165 100644 --- a/tests/test_churchtools_api_abstract.py +++ b/tests/test_churchtools_api_abstract.py @@ -19,7 +19,7 @@ logging.config.dictConfig(config=logging_config) -class TestsChurchToolsApiAbstract(ABC): +class TestsChurchToolsApiAbstract(ABC): # noqa: B024 """This is supposed to be the base configuration for PyTest test classes that require API access.""" def setup_class(self) -> None: