rigetti / rpcq

The RPC framework and message specification for @rigetti Quantum Cloud Services.
Apache License 2.0
76 stars 29 forks source link

Setting a default of nil has unexpected behavior for boolean types when generating python bindings #134

Closed stephanbro closed 3 years ago

stephanbro commented 4 years ago

Code can describe this better than I can. Message definition:

     (|relay_closed|
      :documentation "Set the state of the Flux relay.\
          True  - Relay closed, allows flux current to flow.\
          False - Relay open, no flux current can flow."
      :type :bool
      :required nil,
      :default nil))

Generated python bindings:

    relay_closed: Optional[bool] = False
    """Set the state of the Flux relay.
          True  - Relay closed, allows flux current to flow.
          False - Relay open, no flux current can flow."""

My desired behavior would change relay_closed: Optional[bool] = False to be relay_closed: Optional[bool] = None

notmgsk commented 3 years ago

Fixed by #136