From bd7c046c7d9406d8f650688f2671f512967b1324 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Mon, 2 Jun 2025 14:37:31 +0200 Subject: [PATCH 1/2] add docs for z_serialize and z_deserialize functions --- zenoh/ext.pyi | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/zenoh/ext.pyi b/zenoh/ext.pyi index a497f783..4f4c78df 100644 --- a/zenoh/ext.pyi +++ b/zenoh/ext.pyi @@ -43,5 +43,20 @@ class Float64(float): class ZDeserializeError(Exception): pass -def z_serialize(obj: Any) -> ZBytes: ... -def z_deserialize(tp: type[_T], zbytes: ZBytes) -> _T: ... +def z_serialize(obj: Any) -> ZBytes: + """Serialize an object of supported type according to the `Zenoh serialization format `. + Supported types are: + - UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool; + - Str, Bytes, ByteArray; + - List, Dict, Set, FrozenSet and Tuple of supported types. + """ + pass + +def z_deserialize(tp: type[_T], zbytes: ZBytes) -> _T: + """Deserialize into an object of supported type according to the `Zenoh serialization format `. + Supported types are: + - UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool; + - Str, Bytes, ByteArray; + - List, Dict, Set, FrozenSet and Tuple of supported types. + """ + pass From f3539281b49a1b723fd4347b6e603c2cfe61e10c Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 3 Jun 2025 12:40:24 +0200 Subject: [PATCH 2/2] add zenoh.ext to docs index --- docs/conf.py | 1 + docs/index.rst | 7 +++++++ zenoh/ext.pyi | 24 ++++++++++++++++-------- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 6b441a4f..1f6d3957 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,6 +26,7 @@ import tomllib import zenoh +import zenoh.ext # -- Project information ----------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index 2933bf0e..48e511c9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -74,3 +74,10 @@ module zenoh.handlers .. automodule:: zenoh.handlers :members: :undoc-members: + +module zenoh.ext +================ + +.. automodule:: zenoh.ext + :members: + :undoc-members: diff --git a/zenoh/ext.pyi b/zenoh/ext.pyi index 4f4c78df..d291ebe0 100644 --- a/zenoh/ext.pyi +++ b/zenoh/ext.pyi @@ -44,19 +44,27 @@ class ZDeserializeError(Exception): pass def z_serialize(obj: Any) -> ZBytes: - """Serialize an object of supported type according to the `Zenoh serialization format `. + """Serialize an object of supported type according to the `Zenoh serialization format `_. + Supported types are: - - UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool; - - Str, Bytes, ByteArray; - - List, Dict, Set, FrozenSet and Tuple of supported types. + + * UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool; + + * Str, Bytes, ByteArray; + + * List, Dict, Set, FrozenSet and Tuple of supported types. """ pass def z_deserialize(tp: type[_T], zbytes: ZBytes) -> _T: - """Deserialize into an object of supported type according to the `Zenoh serialization format `. + """Deserialize into an object of supported type according to the `Zenoh serialization format `_. + Supported types are: - - UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool; - - Str, Bytes, ByteArray; - - List, Dict, Set, FrozenSet and Tuple of supported types. + + * UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool; + + * Str, Bytes, ByteArray; + + * List, Dict, Set, FrozenSet and Tuple of supported types. """ pass