Skip to content

Commit 4cad8fb

Browse files
committed
fix(SUP-2586): remove unused code
1 parent 2771039 commit 4cad8fb

3 files changed

Lines changed: 0 additions & 126 deletions

File tree

src/kili/adapters/kili_api_gateway/label/common.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
from kili.adapters.kili_api_gateway.asset.formatters import load_asset_json_fields
55
from kili.adapters.kili_api_gateway.asset.operations import get_assets_query
66
from kili.adapters.kili_api_gateway.helpers.queries import fragment_builder
7-
from kili.adapters.kili_api_gateway.label.operations import (
8-
get_annotations_partial_query,
9-
)
107
from kili.core.graphql.graphql_client import GraphQLClient
118
from kili.domain.asset.asset import AssetId
129
from kili.domain.types import ListOrTuple
@@ -32,47 +29,3 @@ def get_asset(
3229
f"asset ID: {asset_id}. The asset does not exist or you do not have access to it."
3330
)
3431
return load_asset_json_fields(assets[0], fields, http_client=http_client)
35-
36-
37-
def get_annotation_fragment():
38-
"""Generates a fragment to get all annotations and their values."""
39-
return get_annotations_partial_query(
40-
annotation_fragment=fragment_builder(("__typename", "id", "job", "path", "labelId")),
41-
classification_annotation_fragment=fragment_builder(
42-
("annotationValue.categories", "chatItemId")
43-
),
44-
comparison_annotation_fragment=fragment_builder(
45-
(
46-
"annotationValue.choice.code",
47-
"annotationValue.choice.firstId",
48-
"annotationValue.choice.secondId",
49-
"chatItemId",
50-
)
51-
),
52-
transcription_annotation_fragment=fragment_builder(("annotationValue.text", "chatItemId")),
53-
video_annotation_fragment=fragment_builder(
54-
(
55-
"frames.start",
56-
"frames.end",
57-
"keyAnnotations.id",
58-
"keyAnnotations.frame",
59-
)
60-
),
61-
video_classification_annotation_fragment=fragment_builder(
62-
("keyAnnotations.annotationValue.categories",)
63-
),
64-
video_object_detection_annotation_fragment=fragment_builder(
65-
(
66-
"keyAnnotations.annotationValue.vertices: verticesScalar",
67-
"name",
68-
"mid",
69-
"category",
70-
)
71-
),
72-
video_transcription_annotation_fragment=fragment_builder(
73-
("keyAnnotations.annotationValue.text",)
74-
),
75-
object_detection_annotation_fragment=fragment_builder(
76-
("category", "mid", "name", "annotationValue.vertices: verticesScalar")
77-
),
78-
)

src/kili/adapters/kili_api_gateway/label/operations.py

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -71,82 +71,6 @@ def get_append_to_labels_mutation(fragment: str) -> str:
7171
"""
7272

7373

74-
def get_annotations_partial_query(
75-
annotation_fragment: str,
76-
classification_annotation_fragment: str,
77-
comparison_annotation_fragment: str,
78-
transcription_annotation_fragment: str,
79-
video_annotation_fragment: str,
80-
video_object_detection_annotation_fragment: str,
81-
video_classification_annotation_fragment: str,
82-
video_transcription_annotation_fragment: str,
83-
object_detection_annotation_fragment: str,
84-
) -> str:
85-
"""Get the gql annotations query."""
86-
inline_fragments = ""
87-
88-
if classification_annotation_fragment.strip():
89-
inline_fragments += f"""
90-
... on ClassificationAnnotation {{
91-
{classification_annotation_fragment}
92-
}}
93-
"""
94-
95-
if comparison_annotation_fragment.strip():
96-
inline_fragments += f"""
97-
... on ComparisonAnnotation {{
98-
{comparison_annotation_fragment}
99-
}}
100-
"""
101-
102-
if transcription_annotation_fragment.strip():
103-
inline_fragments += f"""
104-
... on TranscriptionAnnotation {{
105-
{transcription_annotation_fragment}
106-
}}
107-
"""
108-
109-
if video_annotation_fragment.strip():
110-
inline_fragments += f"""
111-
... on VideoAnnotation {{
112-
{video_annotation_fragment}
113-
}}
114-
"""
115-
116-
if video_object_detection_annotation_fragment.strip():
117-
inline_fragments += f"""
118-
... on VideoObjectDetectionAnnotation {{
119-
{video_object_detection_annotation_fragment}
120-
}}
121-
"""
122-
123-
if video_classification_annotation_fragment.strip():
124-
inline_fragments += f"""
125-
... on VideoClassificationAnnotation {{
126-
{video_classification_annotation_fragment}
127-
}}
128-
"""
129-
130-
if video_transcription_annotation_fragment.strip():
131-
inline_fragments += f"""
132-
... on VideoTranscriptionAnnotation {{
133-
{video_transcription_annotation_fragment}
134-
}}
135-
"""
136-
137-
if object_detection_annotation_fragment.strip():
138-
inline_fragments += f"""
139-
... on ObjectDetectionAnnotation {{
140-
{object_detection_annotation_fragment}
141-
}}
142-
"""
143-
144-
return f"""
145-
{annotation_fragment}
146-
{inline_fragments}
147-
"""
148-
149-
15074
GQL_COPY_LABELS = """
15175
mutation CopyLabels($data: CopyLabelsInput!) {
15276
copyLabels(data: $data)

tests/integration/adapters/kili_api_gateway/test_asset.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ def test_given_video_project_only_latest_label_json_response_requested_annotatio
1919
def mock_graphql_execute(query, *_args, **_kwargs) -> dict:
2020
captured_queries.append(query)
2121

22-
if "countAssetAnnotations" in query:
23-
return {"data": 1}
24-
2522
if "query countAssets" in query:
2623
return {"data": 1}
2724

0 commit comments

Comments
 (0)