Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(examples): fix commented parts of z_put.py #176

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions examples/z_put.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import argparse
import json
import zenoh
from zenoh import config, Value

# --- Command line argument parsing --- --- --- --- --- ---
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -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()

Expand Down