From cc97cb1911acd2a87de5c0d0d5f004b80da4bf27 Mon Sep 17 00:00:00 2001 From: Tomiii Date: Mon, 26 Feb 2024 12:29:28 +0100 Subject: [PATCH 1/2] * feat: add pdf url type --- labelbox/schema/asset_attachment.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/labelbox/schema/asset_attachment.py b/labelbox/schema/asset_attachment.py index 1ab4de83a..975954418 100644 --- a/labelbox/schema/asset_attachment.py +++ b/labelbox/schema/asset_attachment.py @@ -7,10 +7,10 @@ class AssetAttachment(DbObject): - """ Asset attachment provides extra context about an asset while labeling. + """Asset attachment provides extra context about an asset while labeling. Attributes: - attachment_type (str): IMAGE, VIDEO, IMAGE_OVERLAY, HTML, RAW_TEXT, or TEXT_URL. TEXT attachment type is deprecated. + attachment_type (str): IMAGE, VIDEO, IMAGE_OVERLAY, HTML, RAW_TEXT, TEXT_URL, or PDF_URL. TEXT attachment type is deprecated. attachment_value (str): URL to an external file or a string of text """ @@ -32,6 +32,7 @@ def __missing__(cls, value: object): HTML = "HTML" RAW_TEXT = "RAW_TEXT" TEXT_URL = "TEXT_URL" + PDF_URL = "PDF_URL" for topic in AttachmentType: vars()[topic.name] = topic.value @@ -41,12 +42,12 @@ def __missing__(cls, value: object): @classmethod def validate_attachment_json(cls, attachment_json: Dict[str, str]) -> None: - for required_key in ['type', 'value']: + for required_key in ["type", "value"]: if required_key not in attachment_json: raise ValueError( f"Must provide a `{required_key}` key for each attachment. Found {attachment_json}." ) - cls.validate_attachment_type(attachment_json['type']) + cls.validate_attachment_type(attachment_json["type"]) @classmethod def validate_attachment_type(cls, attachment_type: str) -> None: From be39213156884260625e0001f7823bfe67eb6bce Mon Sep 17 00:00:00 2001 From: Tomiii Date: Wed, 28 Feb 2024 08:32:54 +0100 Subject: [PATCH 2/2] * feat: attach --- labelbox/schema/asset_attachment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/labelbox/schema/asset_attachment.py b/labelbox/schema/asset_attachment.py index 975954418..2ec65de21 100644 --- a/labelbox/schema/asset_attachment.py +++ b/labelbox/schema/asset_attachment.py @@ -42,12 +42,12 @@ def __missing__(cls, value: object): @classmethod def validate_attachment_json(cls, attachment_json: Dict[str, str]) -> None: - for required_key in ["type", "value"]: + for required_key in ['type', 'value']: if required_key not in attachment_json: raise ValueError( f"Must provide a `{required_key}` key for each attachment. Found {attachment_json}." ) - cls.validate_attachment_type(attachment_json["type"]) + cls.validate_attachment_type(attachment_json['type']) @classmethod def validate_attachment_type(cls, attachment_type: str) -> None: