collection
最后更新
depthai_nodes.message.collection类
Collection
items: 项的初始列表。
TypeError: 如果items不是列表或包含不兼容的项类型。
方法
init
Python
1def __init__(items: list[T]):items(list[T]): 初始项。空列表会将类型推断推迟到第一次插入。
append
Python
1def append(item: T):item(T): 与首次插入项的类型兼容的项。
TypeError: 如果项与推断的运行时类型不兼容。
copy
Python
1def copy(self) -> Collection:Collection: 一个新的Collection,其中的项通过copy_message复制。即使在子类上调用,这也会返回基本容器;子类特定的字段不会被复制。
TypeError: 如果项无法通过copy_message复制。
extend
Python
1def extend(items: list[T]):items(list[T]): 要追加的项。如果验证失败,现有内容保持不变。
TypeError: 如果任何项与推断的运行时类型不兼容。
items.setter
Python
1def items.setter(value: list[T]):value(list[T]): 替换列表。空列表保留先前推断的项类型。
TypeError: 如果值不是列表或包含与推断类型不兼容的项。
属性
item_cls
items
append()、extend() 或赋值给 items。