Skip to content

Commit

Permalink
Fix types for calibration module
Browse files Browse the repository at this point in the history
  • Loading branch information
kozhukalov committed Nov 1, 2023
1 parent ce5d849 commit ec04601
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mitiq/calibration/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def add_result(
self.ideal[strategy.id, problem.id] = ideal_val

@staticmethod
def _performance_str(noisy_error: float, mitigated_error: float):
def _performance_str(noisy_error: float, mitigated_error: float) -> str:
"""Get human readable performance representaion."""
return (
f"{'✔' if mitigated_error < noisy_error else '✘'}\n"
Expand All @@ -79,7 +79,7 @@ def _performance_str(noisy_error: float, mitigated_error: float):

def _get_errors(
self, strategy_id: int, problem_id: int
) -> Tuple[str, float, float]:
) -> Tuple[float, float]:
"""Get errors for a given strategy/problem combination.
Returns:
Expand Down Expand Up @@ -293,7 +293,7 @@ def get_cost(self) -> Dict[str, int]:
"ideal_executions": ideal,
}

def run(self, log: OutputForm = None) -> None:
def run(self, log: Optional[OutputForm] = None) -> None:
"""Runs all the circuits required for calibration."""
if not self.results.is_missing_data():
self.results.reset_data()
Expand Down Expand Up @@ -331,7 +331,8 @@ def run(self, log: OutputForm = None) -> None:
self.results.log_results_cartesian()
else:
raise ValueError(
f"log parameter must be one of: {', '.join(OutputForm._member_names_)}"
"log parameter must be one of: "
f"{', '.join(OutputForm._member_names_)}"
)

def best_strategy(self) -> Strategy:
Expand Down

0 comments on commit ec04601

Please sign in to comment.