Skip to content

QPI-driver: dead condition in qblox apply parameters #13

Description

@ch-ahindura

Describe the bug
In _apply_parameters (qpi_driver/executors/qblox/config.py), the branch condition contains dead code:

if (
    callable(attribute)
    and not hasattr(attribute, "__class__")   # always False: everything has __class__
    or (hasattr(attribute, "__call__") and not isinstance(attribute, (int, float, str, bool)))
):

not hasattr(attribute, "__class__") is always False (every Python object has __class__), so the first clause callable(attribute) and not hasattr(attribute, "__class__") is always False. Via and/or precedence the whole condition collapses to just the second clause. The first two lines are misleading and don't do what they appear to.

To Reproduce
Steps to reproduce the behavior:

  1. Read _apply_parameters in qpi_driver/executors/qblox/config.py.
  2. Evaluate not hasattr(<any object>, "__class__") → always False.
  3. Conclude the first clause never contributes to the branch decision.

Expected behavior
The condition should express the intended check without dead sub-expressions. The net runtime behaviour appears correct (it reduces to the second clause), but the first two lines should be removed for clarity. The quantify _apply_parameters is written more cleanly and can serve as a reference.

Screenshots
N/A.

Desktop (please complete the following information):

  • OS: N/A (backend Python library bug, platform-independent)
  • Browser: N/A
  • Version: qpi-driver, qpi_driver/executors/qblox/config.py (_apply_parameters)

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context
Severity: Low — code clarity / dead code; no observed behavioural impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions