Skip to content

CODE QUALITY: Type annotations use None defaults without Optional #58

Description

@Manideep3969

Issue

Several dataclass fields default to None but are typed as the non-optional type:

  • fusion.py: FusionResult fields original_circuit, optimized_circuit, etc.
  • scheduling.py: ScheduleResult.circuit: QuantumCircuit = None
  • Users accessing result.original_circuit.num_qubits on a default result get AttributeError

Fix

Use QuantumCircuit | None = None for these fields and add null-checks in property methods.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3-lowLow priority

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions