diff --git a/docs/source/code_examples/labels_v2.py b/docs/source/code_examples/labels_v2.py index 8c9334e5e..2c22af4ef 100644 --- a/docs/source/code_examples/labels_v2.py +++ b/docs/source/code_examples/labels_v2.py @@ -1,7 +1,7 @@ """Working with the LabelRowV2 =========================== -The :class:`encord.objects.LabelRowV2` class is a wrapper around the Encord label row data format. It +The :class:`encord.objects.ontology_labels_impl.LabelRowV2` class is a wrapper around the Encord label row data format. It provides a convenient way to read, create, and manipulate labels. """ @@ -63,14 +63,14 @@ print(f"Annotation task status: {label_row.annotation_task_status}") # %% -# Inspect the filters in :meth:`~encord.project.Project.list_label_rows_v2` to only get a subset of the label rows. +# Inspect the filters in :meth:`encord.project.Project.list_label_rows_v2` to only get a subset of the label rows. # # You can find more examples around all the available read properties by inspecting the properties of the -# :class:`~encord.objects.LabelRowV2` class. +# :class:`encord.objects.ontology_labels_impl.LabelRowV2` class. # # Exporting labels # -------------------------------- -# To export or download labels, or perform any other function that includes reading or writing labels, call the :meth:`~encord.objects.LabelRowV2.initialise_labels` +# To export or download labels, or perform any other function that includes reading or writing labels, call the :meth:`encord.objects.ontology_labels_impl.LabelRowV2.initialise_labels` # method, which will download the state of the label from the Encord server and create a label hash if none exists. # # Once this method has been called, you can create your first label. @@ -83,7 +83,7 @@ # %% # Saving labels # -------------------------------- -# Once :meth:`~encord.objects.LabelRowV2.initialise_labels` has been called, you can create your first label. +# Once :meth:`encord.objects.ontology_labels_impl.LabelRowV2.initialise_labels` has been called, you can create your first label. first_label_row: LabelRowV2 = label_rows[0] @@ -99,7 +99,7 @@ # %% # Creating/reading object instances # --------------------------------- -# The :class:`encord.objects.LabelRowV2` class works with its corresponding ontology. If you add object instances +# The :class:`encord.objects.ontology_labels_impl.LabelRowV2` class works with its corresponding ontology. If you add object instances # or classification instances, these will be created from the ontology. You can read more about object instances # here: https://docs.encord.com/docs/annotate-working-with-ontologies#objects # @@ -109,7 +109,7 @@ # Finding the ontology object # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # -# The LabelRowV2 is designed to work with its corresponding ontology via the :class:`~encord.objects.ontology_labels_impl.OntologyStructure`. +# The LabelRowV2 is designed to work with its corresponding ontology via the :class:`encord.objects.ontology_labels_impl.OntologyStructure`. # You will need to use the title or feature node hash to find the right objects, classifications, attributes, or # attribute options. See the example below to find the ontology object for the demonstrative "Box of a human" object. # diff --git a/encord/client.py b/encord/client.py index ada7058b3..961c3ba42 100644 --- a/encord/client.py +++ b/encord/client.py @@ -994,7 +994,7 @@ def save_label_row(self, uid, label, validate_before_saving: bool = False): return self._querier.basic_setter(LabelRow, uid, payload=label, retryable=True) def save_label_rows(self, uids: List[str], payload: List[LabelRow], validate_before_saving: bool = False): - """This function is meant for internal use, please consider using :class:`encord.objects.LabelRowV2` class instead + """This function is meant for internal use, please consider using :class:`encord.objects.ontology_labels_impl.LabelRowV2` class instead Saves multiple label rows. See :meth:`.save_label_row` @@ -1020,7 +1020,7 @@ def create_label_row(self, uid, *, get_signed_url=False) -> LabelRow: def create_label_rows( self, uids: List[str], *, get_signed_url: bool = False, branch_name: Optional[str] = None ) -> List[LabelRow]: - """This function is meant for internal use, please consider using :class:`encord.objects.LabelRowV2` class instead + """This function is meant for internal use, please consider using :class:`encord.objects.ontology_labels_impl.LabelRowV2` class instead Create multiple label rows. See :meth:`.create_label_row` @@ -1174,7 +1174,7 @@ def __set_project_ontology(self, ontology: LegacyOntology) -> bool: return self._querier.basic_setter(OrmProject, uid=None, payload=payload) def workflow_reopen(self, label_hashes: List[str]) -> None: - """This function is documented in :meth:`encord.objects.LabelRowV2.workflow_reopen`.""" + """This function is documented in :meth:`encord.objects.ontology_labels_impl.LabelRowV2.workflow_reopen()`.""" self._querier.basic_setter( LabelWorkflowGraphNode, label_hashes, @@ -1182,7 +1182,7 @@ def workflow_reopen(self, label_hashes: List[str]) -> None: ) def workflow_complete(self, label_hashes: List[str]) -> None: - """This function is documented in :meth:`encord.objects.LabelRowV2.workflow_complete`.""" + """This function is documented in :meth:`encord.objects.ontology_labels_impl.LabelRowV2.workflow_complete()`.""" self._querier.basic_setter( LabelWorkflowGraphNode, label_hashes, diff --git a/encord/constants/enums.py b/encord/constants/enums.py index 7701c4368..557a76a4b 100644 --- a/encord/constants/enums.py +++ b/encord/constants/enums.py @@ -17,6 +17,23 @@ class DataType(StringEnum): + """ + Enumeration of supported data types for labeling and storage. + + Values: + video + img_group + dicom + image + dicom_study + nifti + audio + plain_text + pdf + group + scene + """ + VIDEO = "video" IMG_GROUP = "img_group" DICOM = "dicom" diff --git a/encord/http/utils.py b/encord/http/utils.py index 645fde46f..9c5dee479 100644 --- a/encord/http/utils.py +++ b/encord/http/utils.py @@ -96,7 +96,7 @@ def get_batches(iterable: List, n: int) -> List[List]: List[List]: A list of lists where each sublist represents a batch. Note: - This can be replaced with :func:`itertools.batched` in Python 3.12+. + This can be replaced with `itertools.batched `_ in Python 3.12+. """ return [iterable[ndx : min(ndx + n, len(iterable))] for ndx in range(0, len(iterable), n)] diff --git a/encord/objects/classification_instance.py b/encord/objects/classification_instance.py index d2c188e7d..56015b636 100644 --- a/encord/objects/classification_instance.py +++ b/encord/objects/classification_instance.py @@ -403,9 +403,9 @@ def set_answer( Args: answer: The answer to set. attribute: The ontology attribute to set the answer for. If not set, this will be attempted to be - inferred. For answers to :class:`encord.objects.common.RadioAttribute` or - :class:`encord.objects.common.ChecklistAttribute`, this can be inferred automatically. For - :class:`encord.objects.common.TextAttribute`, this will only be inferred if there is only one possible + inferred. For answers to :class:`encord.objects.attributes.RadioAttribute` or + :class:`encord.objects.attributes.ChecklistAttribute`, this can be inferred automatically. For + :class:`encord.objects.attributes.TextAttribute`, this will only be inferred if there is only one possible TextAttribute to set for the entire classification instance. Otherwise, a :class:`encord.exceptions.LabelRowError` will be thrown. overwrite: If `True`, the answer will be overwritten if it already exists. If `False`, this will throw diff --git a/encord/objects/common.py b/encord/objects/common.py index d84e765b3..e479d79ff 100644 --- a/encord/objects/common.py +++ b/encord/objects/common.py @@ -22,6 +22,16 @@ class PropertyType(StringEnum): + """ + Enumeration of supported classification and attribute types + + Values: + radio + text + checklist + numeric + """ + RADIO = "radio" TEXT = "text" CHECKLIST = "checklist" @@ -29,6 +39,24 @@ class PropertyType(StringEnum): class Shape(StringEnum): + """ + Enumeration of supported geometric and data shapes for labeling. + + Values: + bounding_box + polygon + point + skeleton + polyline + rotatable_bounding_box + bitmask + audio + text + cuboid + cuboid_2d + segmentation + """ + BOUNDING_BOX = "bounding_box" POLYGON = "polygon" POINT = "point" diff --git a/encord/orm/dataset.py b/encord/orm/dataset.py index e2d759719..ae4e340fd 100644 --- a/encord/orm/dataset.py +++ b/encord/orm/dataset.py @@ -106,7 +106,7 @@ class DataClientMetadata: class ImageData: - """Information about individual images within a single :class:`~encord.orm.dataset.DataRow` of type + """Information about individual images within a single :class:`encord.orm.dataset.DataRow` of type :meth:`DataType.IMG_GROUP `. Get this information using the :meth:`DataRow.images ` property. """ @@ -284,7 +284,7 @@ def title(self) -> str: """The data title. The setter updates the custom client metadata. This queues a request for the backend which will be - executed on a call of :meth:`~encord.orm.dataset.DataRow.save()`. + executed on a call of :meth:`encord.orm.dataset.DataRow.save()`. """ return self["data_title"] @@ -333,10 +333,10 @@ def duration(self) -> Optional[int]: @property def client_metadata(self) -> Optional[MappingProxyType]: """The currently cached client metadata. To cache the client metadata, use the - :meth:`~encord.orm.dataset.DataRow.refetch_data()` function. + :meth:`encord.orm.dataset.DataRow.refetch_data()` function. The setter updates the custom client metadata. This queues a request for the backend which will - be executed on a call of :meth:`~encord.orm.dataset.DataRow.save()`. + be executed on a call of :meth:`encord.orm.dataset.DataRow.save()`. """ return MappingProxyType(self["client_metadata"]) if self["client_metadata"] is not None else None @@ -382,7 +382,7 @@ def file_link(self) -> Optional[str]: @property def signed_url(self) -> Optional[str]: """The cached signed url of the given data asset. To cache the signed url, use the - :meth:`~encord.orm.dataset.DataRow.refetch_data()` function. + :meth:`encord.orm.dataset.DataRow.refetch_data()` function. """ return self["signed_url"] @@ -402,8 +402,8 @@ def storage_location(self) -> StorageLocation: @property def images_data(self) -> Optional[List[ImageData]]: - """A list of the cached :class:`~encord.orm.dataset.ImageData` objects for the given data asset. - Fetch the images with appropriate settings in the :meth:`~encord.orm.dataset.DataRow.refetch_data()` function. + """A list of the cached :class:`encord.orm.dataset.ImageData` objects for the given data asset. + Fetch the images with appropriate settings in the :meth:`encord.orm.dataset.DataRow.refetch_data()` function. If the data type is not :meth:`DataType.IMG_GROUP ` then this returns None. """ diff --git a/encord/project.py b/encord/project.py index aa8ad651a..002d0c2a5 100644 --- a/encord/project.py +++ b/encord/project.py @@ -238,8 +238,8 @@ def list_label_rows_v2( label_hashes: List of label hashes to filter by. edited_before: Optionally filter to only rows last edited before the specified time. edited_after: Optionally filter to only rows last edited after the specified time. - label_statuses: Optionally filter to only those label rows that have one of the specified :class:`~encord.orm.label_row.AnnotationTaskStatus`es. - shadow_data_state: Optionally filter by data type in Benchmark QA projects. See :class:`~encord.orm.label_row.ShadowDataState`. + label_statuses: Optionally filter to only those label rows that have one of the specified :class:`encord.orm.label_row.AnnotationTaskStatus`es. + shadow_data_state: Optionally filter by data type in Benchmark QA projects. See :class:`encord.orm.label_row.ShadowDataState`. data_title_eq: Optionally filter by exact title match. data_title_like: Optionally filter by fuzzy title match; SQL syntax. workflow_graph_node_title_eq: Optionally filter by exact match with workflow node title. @@ -252,7 +252,7 @@ def list_label_rows_v2( branch_name: Optionally specify a branch name. A branch name cannot be specified if include_all_label_branches is set to True Returns: - A list of :class:`~encord.objects.LabelRowV2` instances for all the matching label rows. + A list of :class:`encord.objects.ontology_labels_impl.LabelRowV2` instances for all the matching label rows. """ label_row_metadatas = self._client.list_label_rows( edited_before, diff --git a/encord/project_ontology/ontology_classification.py b/encord/project_ontology/ontology_classification.py index e98b28604..25a27d3eb 100644 --- a/encord/project_ontology/ontology_classification.py +++ b/encord/project_ontology/ontology_classification.py @@ -19,7 +19,7 @@ class OntologyClassification: """DEPRECATED: prefer using :class:`encord.ontology.Ontology` - A dataclass which holds classifications of the :class:`encord.project_ontology.Ontology`. + A dataclass which holds classifications of the :class:`encord.project_ontology.ontology.Ontology`. """ #: A unique (to the ontology) identifier of the classification. diff --git a/encord/project_ontology/ontology_object.py b/encord/project_ontology/ontology_object.py index b6efbc247..2b7938990 100644 --- a/encord/project_ontology/ontology_object.py +++ b/encord/project_ontology/ontology_object.py @@ -16,9 +16,9 @@ @dataclass class OntologyObject: - """DEPRECATED: prefer using :class:`encord.ontology.Ontology` + """This class is DEPRECATED. We recommend using :class:`encord.ontology.ontology` - A dataclass which holds an object for of the :class:`encord.project_ontology.Ontology`. + A dataclass which holds an object for the :class:`encord.project_ontology.ontology`. """ #: A unique (to the ontology) identifier of the classification. diff --git a/encord/storage.py b/encord/storage.py index afc6fb3ae..052a95a53 100644 --- a/encord/storage.py +++ b/encord/storage.py @@ -1166,8 +1166,8 @@ def update( name (Optional[str]): New folder name. description (Optional[str]): New folder description. client_metadata (Optional[Dict[str, Any]]): New client metadata. - bundle (Optional[Bundle]): Optional :class:`encord.http.Bundle` to use for the operation. If provided, the operation - will be bundled into a single server call with other item updates using the same bundle. + bundle (Optional[Bundle]): Optional :class:`encord.http.bundle.Bundle` to use for the operation. If provided, the operation + is bundled into a single server call with other item updates using the same bundle. Returns: None @@ -1916,7 +1916,8 @@ def update( name: New item name. description: New item description. client_metadata: New client metadata. - bundle: Optional bundle to use for bundling operations. + bundle (Optional[Bundle]): Optional :class:`encord.http.bundle.Bundle` to use for the operation. If provided, the operation + is bundled into a single server call with other item updates using the same bundle. Returns: None diff --git a/encord/user_client.py b/encord/user_client.py index 37f26d62b..7524fbc4d 100644 --- a/encord/user_client.py +++ b/encord/user_client.py @@ -498,7 +498,7 @@ def list_projects( tags_anyof: optional tag names filter; matches projects having at least one of the tag names. Returns: - list of Projects matching filter conditions, as :class:`~encord.project.Project` instances. + list of Projects matching filter conditions, as :class:`encord.project.Project` instances. """ properties_filter = ProjectFilterParams.from_dict(self.__validate_filter(locals())) properties_filter.include_org_access = include_org_access @@ -532,7 +532,7 @@ def create_project( dataset_hashes: a list of the Dataset uids that the project will use project_description: the optional description of the project ontology_hash: the uid of an Ontology to be used. If omitted, a new empty Ontology will be created - workflow_settings: selects and configures the type of the quality control Workflow to use, See :class:`encord.orm.project.ProjectWorkflowSettings` for details. If omitted, :class:`~encord.orm.project.ManualReviewWorkflowSettings` is used. + workflow_settings: selects and configures the type of the quality control Workflow to use, See :class:`encord.orm.project.ProjectWorkflowSettings` for details. If omitted, :class:`encord.orm.project.ManualReviewWorkflowSettings` is used. workflow_template_hash: Project is created using a Workflow based on the template provided. If omitted, the project will be created using the default standard workflow. Returns: