From cc6ba2e40a1e6be6656e33327fdb3904dacb27a3 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Mon, 15 Apr 2024 13:24:51 +0200 Subject: [PATCH] fix(examples): fix commented parts of z_put.py (#176) * fix(examples): fix commented parts of z_put.py * fix: apply PR reviews * fix: apply PR reviews --- examples/z_put.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/z_put.py b/examples/z_put.py index 2f04ab02..f73a9c1e 100644 --- a/examples/z_put.py +++ b/examples/z_put.py @@ -17,7 +17,6 @@ import argparse import json import zenoh -from zenoh import config, Value # --- Command line argument parsing --- --- --- --- --- --- parser = argparse.ArgumentParser( @@ -76,31 +75,31 @@ def main(): # --- Examples of put with other types: # - Integer - # session.put('/demo/example/Integer', 3) + # session.put('demo/example/Integer', 3) # - Float - # session.put('/demo/example/Float', 3.14) + # session.put('demo/example/Float', 3.14) # - Properties (as a Dictionary with str only) - # session.put('/demo/example/Properties', {'p1': 'v1', 'p2': 'v2'}) + # session.put('demo/example/Properties', {'p1': 'v1', 'p2': 'v2'}) # - Json (str format) - # session.put('/demo/example/Json', - # json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]), - # encoding=Encoding.TEXT_JSON) + # session.put('demo/example/Json', + # json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]).encode(), + # encoding=zenoh.Encoding.TEXT_JSON()) # - Raw ('application/octet-stream' encoding by default) - # session.put('/demo/example/Raw', b'\x48\x69\x21') + # session.put('demo/example/Raw', b'\x48\x69\x21') # - Custom encoding - # session.put('/demo/example/Custom', + # session.put('demo/example/Custom', # b'\x48\x69\x21', # encoding='my_encoding') # - UTF-16 String specifying the charset as Encoding suffix - # session.put('/demo/example/UTF-16', + # session.put('demo/example/UTF-16', # 'hello'.encode('utf-16'), - # encoding=Encoding.TEXT_PLAIN.with_suffix(';charset=utf-16')) + # encoding=zenoh.Encoding.TEXT_PLAIN.with_suffix(';charset=utf-16')) session.close()