-
Notifications
You must be signed in to change notification settings - Fork 660
Description
I am using PyZMQ in a small CLI project and so far it is smooth sailing.
Thank you very much for your fine work. ❤️
Now, I would like to be able to specify socket options via CLI with --option OPTION VALUE. This gives me the option value as string, which I need to parse into the correct type for PyZMQ to not complain when calling socket.set(option, value).
I found that PyZMQ already has the enum _OptType defined and attached to the socket option constants as well, so what I am currently doing is
PARSERS = {
"int": int,
"int64": int,
"bytes": lambda value: value.encode(),
"fd": lambda value: value, # ???
}
option_type = option._opt_type.value
parse = PARSERS[option_type]
value = parse(value)However, as the _opt_type attribute is written as private, this makes me feel uneasy.
So, is there a chance to have that socket option type value exposed as public attribute?
And while we are at it: What does the fd type mean in PyZMQ (in ZMQ ZMQ_USE_FD is expected to be an integer), i.e. how would a pass that from CLI to socket?