is_anno_item
FunctionSource
flag: TypeGuard[AnnoItem] = is_anno_item(data: Any)
Implementation of isinstance(data, AnnoItem)
.
Aliases
This function can be acquired by
import dash_picture_annotation as dpa
dpa.is_anno_item
dpa.typehints.is_anno_item
Arguments
Requires
Argument | Type | Required | |
---|---|---|---|
data | Any | The value to be verified. |
Returns
Argument | Type | |
---|---|---|
flag | bool | If this value is True , data an instance of AnnoItem , vice versa. |
Examples
Check whether an object is an AnnoItem
- Codes
- Results
check_is_anno_item.py
import dash_picture_annotation as dpa
mark: dpa.AnnoMark = {"x": 1, "y": 2, "width": 1, "height": 1, "type": "RECT"}
print(dpa.is_anno_item({}))
print(dpa.is_anno_item({"id": "test"}))
print(dpa.is_anno_item({"id": "test", "mark": mark}))
print(dpa.is_anno_item({"id": "test", "mark": mark, "comment": "test"}))
print(dpa.is_anno_item({"id": "test", "mark": mark, "comment": "test", "x": 1}))
print(dpa.is_anno_item({"id": "test", "mark": mark, "comment": 5}))
False
False
True
True
True
False