Labels
labels
Module for managing task labels in Kaleidoscope.
This module provides classes and services for working with task labels, including retrieval and filtering of labels from the Kaleidoscope workspace.
Classes:
| Name | Description |
|---|---|
Label |
Represents a task label with an ID and name. |
LabelsService |
Service class for interacting with label-related API endpoints. |
Label
Bases: _KaleidoscopeBaseModel
A class representing a label in the Kaleidoscope system.
This class extends _KaleidoscopeBaseModel and provides functionality for managing label data including serialization and string representations.
Attributes:
| Name | Type | Description |
|---|---|---|
label_name |
str
|
The name of the label. |
LabelsService
LabelsService(client: KaleidoscopeClient)
Service class for managing and retrieving task labels from Kaleidoscope.
This service provides methods to fetch labels from the Kaleidoscope workspace and filter them by specific criteria. It uses caching to optimize repeated label retrieval requests.
Example
# get all labels
all_labels = client.labels.get_labels()
# get labels by id
specific_labels = client.labels.get_labels_by_ids(['id1', 'id2'])
Methods:
| Name | Description |
|---|---|
get_labels |
Retrieve the task labels defined in the workspace. |
get_labels_by_ids |
Retrieve a list of Label objects whose IDs match the provided list. |
Source code in kalpy/labels.py
55 56 | |
get_labels
cached
Retrieve the task labels defined in the workspace.
This method caches its values.
Returns:
| Type | Description |
|---|---|
list[Label]
|
List[Label]: The labels in the workspace. |
Note
If an exception occurs during the API request, it logs the error, clears the cache, and returns an empty list.
Source code in kalpy/labels.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
get_labels_by_ids
Retrieve a list of Label objects whose IDs match the provided list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[str]
|
A list of label IDs to filter by. |
required |
Returns:
| Type | Description |
|---|---|
list[Label]
|
List[Label]: A list of Label instances with IDs found in ids. |
Source code in kalpy/labels.py
79 80 81 82 83 84 85 86 87 88 | |