From a418bbbaf8245e0966e856645c9ee218c1579c1f Mon Sep 17 00:00:00 2001 From: theodu Date: Thu, 24 Aug 2023 11:24:24 +0200 Subject: [PATCH] chore: add presentation layer --- src/kili/client.py | 8 ++++---- src/kili/{entrypoints => presentation}/client/__init__.py | 0 src/kili/{entrypoints => presentation}/client/internal.py | 2 +- src/kili/{entrypoints => presentation}/client/issue.py | 2 +- src/kili/services/plugins/model.py | 2 +- tests/e2e/test_e2e_client.py | 2 +- tests/e2e/test_json_response_validation.py | 2 +- tests/integration/entrypoints/client/test_client.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) rename src/kili/{entrypoints => presentation}/client/__init__.py (100%) rename src/kili/{entrypoints => presentation}/client/internal.py (96%) rename src/kili/{entrypoints => presentation}/client/issue.py (98%) diff --git a/src/kili/client.py b/src/kili/client.py index bf050e565..6fc8fd6c3 100644 --- a/src/kili/client.py +++ b/src/kili/client.py @@ -14,8 +14,6 @@ from kili.core.graphql.graphql_client import GraphQLClient, GraphQLClientName from kili.core.graphql.operations.api_key.queries import APIKeyQuery, APIKeyWhere from kili.core.graphql.operations.user.queries import GQL_ME -from kili.entrypoints.client.internal import InternalEntrypoints -from kili.entrypoints.client.issue import IssueEntrypoints from kili.entrypoints.mutations.asset import MutationsAsset from kili.entrypoints.mutations.data_connection import MutationsDataConnection from kili.entrypoints.mutations.issue import MutationsIssue @@ -40,6 +38,8 @@ from kili.entrypoints.subscriptions.label import SubscriptionsLabel from kili.exceptions import AuthenticationFailed, UserNotFoundError from kili.gateways.kili_api_gateway import KiliAPIGateway +from kili.presentation.client.internal import InternalClientMethod +from kili.presentation.client.issue import IssueClientMethod warnings.filterwarnings("default", module="kili", category=DeprecationWarning) @@ -78,7 +78,7 @@ class Kili( # pylint: disable=too-many-ancestors,too-many-instance-attributes QueriesProjectVersion, QueriesUser, SubscriptionsLabel, - IssueEntrypoints, + IssueClientMethod, ): """Kili Client.""" @@ -178,7 +178,7 @@ def __init__( api_key_query = APIKeyQuery(self.graphql_client, self.http_client) self._check_expiry_of_key_is_close(api_key_query, self.api_key) - self.internal = InternalEntrypoints(self) + self.internal = InternalClientMethod(self) def _check_api_key_valid(self) -> bool: """Check that the api_key provided is valid.""" diff --git a/src/kili/entrypoints/client/__init__.py b/src/kili/presentation/client/__init__.py similarity index 100% rename from src/kili/entrypoints/client/__init__.py rename to src/kili/presentation/client/__init__.py diff --git a/src/kili/entrypoints/client/internal.py b/src/kili/presentation/client/internal.py similarity index 96% rename from src/kili/entrypoints/client/internal.py rename to src/kili/presentation/client/internal.py index 87f879680..b1b703e5e 100644 --- a/src/kili/entrypoints/client/internal.py +++ b/src/kili/presentation/client/internal.py @@ -8,7 +8,7 @@ from kili.entrypoints.queries.api_key import QueriesApiKey -class InternalEntrypoints(MutationsOrganization, QueriesApiKey): +class InternalClientMethod(MutationsOrganization, QueriesApiKey): """Inherit classes for internal use by Kili Technology only.""" def __init__(self, kili): diff --git a/src/kili/entrypoints/client/issue.py b/src/kili/presentation/client/issue.py similarity index 98% rename from src/kili/entrypoints/client/issue.py rename to src/kili/presentation/client/issue.py index 033a5ac4f..bff1c7d7f 100644 --- a/src/kili/entrypoints/client/issue.py +++ b/src/kili/presentation/client/issue.py @@ -14,7 +14,7 @@ @for_all_methods(log_call, exclude=["__init__"]) -class IssueEntrypoints: +class IssueClientMethod: """Set of Issue mutations.""" kili_api_gateway: KiliAPIGateway diff --git a/src/kili/services/plugins/model.py b/src/kili/services/plugins/model.py index e97c9c37b..eb43cd2d9 100644 --- a/src/kili/services/plugins/model.py +++ b/src/kili/services/plugins/model.py @@ -3,7 +3,7 @@ import logging from typing import Dict, List, Optional -from kili.entrypoints.client import Kili +from kili.client import Kili from kili.services.plugins.helpers import get_logger diff --git a/tests/e2e/test_e2e_client.py b/tests/e2e/test_e2e_client.py index 3ab359523..b3f8e4adc 100644 --- a/tests/e2e/test_e2e_client.py +++ b/tests/e2e/test_e2e_client.py @@ -1,7 +1,7 @@ import pytest_mock from pyinstrument.profiler import Profiler -from kili.entrypoints.client import Kili +from kili.client import Kili def test_client_init_not_too_long_with_checks_enabled(): diff --git a/tests/e2e/test_json_response_validation.py b/tests/e2e/test_json_response_validation.py index 98196c959..3a6c7004f 100644 --- a/tests/e2e/test_json_response_validation.py +++ b/tests/e2e/test_json_response_validation.py @@ -4,7 +4,7 @@ import pytest from gql.transport import exceptions -from kili.entrypoints.client import Kili +from kili.client import Kili from kili.exceptions import GraphQLError diff --git a/tests/integration/entrypoints/client/test_client.py b/tests/integration/entrypoints/client/test_client.py index b78fcb3e3..93d27533f 100644 --- a/tests/integration/entrypoints/client/test_client.py +++ b/tests/integration/entrypoints/client/test_client.py @@ -6,8 +6,8 @@ import pytest_mock from filelock import FileLock +from kili.client import Kili from kili.core.graphql.graphql_client import DEFAULT_GRAPHQL_SCHEMA_CACHE_DIR -from kili.entrypoints.client import Kili from kili.exceptions import AuthenticationFailed