Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #701

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand Down
1 change: 1 addition & 0 deletions serverscripts/qibocal-index-reports.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""qibocal-index-reports.py
Generates a JSON index with reports information.
"""

import json
import pathlib
import sys
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/auto/draw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Drawing utilities for execution graphs."""

from typing import Set

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/auto/execute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tasks execution."""

from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional, Set
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/auto/graph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Execution graph and navigation utilities."""

import networkx as nx

from .runcard import Action, Id
Expand Down
7 changes: 4 additions & 3 deletions src/qibocal/auto/runcard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Specify runcard layout, handles (de)serialization."""

import os
from functools import cached_property
from typing import Any, NewType, Optional, Union
Expand Down Expand Up @@ -30,9 +31,9 @@ class Action:
"""Alternative subsequent actions, branching from the current one."""
priority: Optional[int] = None
"""Priority level, determining the execution order."""
qubits: Union[
list[QubitId], list[tuple[QubitId, QubitId]], list[list[QubitId]]
] = Field(default_factory=list)
qubits: Union[list[QubitId], list[tuple[QubitId, QubitId]], list[list[QubitId]]] = (
Field(default_factory=list)
)
"""Local qubits (optional)."""
update: bool = True
"""Runcard update mechanism."""
Expand Down
7 changes: 4 additions & 3 deletions src/qibocal/auto/task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Action execution tracker."""

import copy
from dataclasses import dataclass, field
from pathlib import Path
Expand Down Expand Up @@ -151,9 +152,9 @@ def run(
if self.parameters.nshots is None:
self.action.parameters["nshots"] = platform.settings.nshots
if self.parameters.relaxation_time is None:
self.action.parameters[
"relaxation_time"
] = platform.settings.relaxation_time
self.action.parameters["relaxation_time"] = (
platform.settings.relaxation_time
)
operation: Routine = self.operation
parameters = self.parameters

Expand Down
1 change: 1 addition & 0 deletions src/qibocal/auto/validate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extra tools to validate an execution graph."""

from .graph import Graph


Expand Down
1 change: 1 addition & 0 deletions src/qibocal/auto/validation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Validation module."""

from dataclasses import dataclass
from typing import NewType, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions src/qibocal/auto/validators/chi2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Chi2 validation"""

from typing import Union

from qibolab.qubits import QubitId, QubitPairId
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""CLI entry point."""

from ._base import command
1 change: 1 addition & 0 deletions src/qibocal/cli/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Adds global CLI options."""

import getpass
import pathlib

Expand Down
1 change: 1 addition & 0 deletions src/qibocal/cli/upload.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Upload report to server."""

import base64
import json
import pathlib
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions for the cli module"""

import datetime
import getpass
import json
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom logger implemenation."""

import logging
import os

Expand Down
1 change: 1 addition & 0 deletions src/qibocal/fitting/classifier/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def create_model(self, hyperpars):
@dataclass
class BenchmarkResults:
r"""Class that stores the models information."""

accuracy: float
testing_time: float
training_time: float
Expand Down
8 changes: 5 additions & 3 deletions src/qibocal/protocols/characterization/dispersive_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ def _plot(data: DispersiveShiftData, qubit, fit: DispersiveShiftResults):
2 * len(q_data),
)
params = data_fit[
"fitted_parameters_state_zero"
if i == 0
else "fitted_parameters_state_one"
(
"fitted_parameters_state_zero"
if i == 0
else "fitted_parameters_state_one"
)
][qubit]
fig.add_trace(
go.Scatter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ def _plot(data: DispersiveShiftQutritData, qubit, fit: DispersiveShiftQutritResu
2 * len(q_data),
)
params = data_fit[
"fitted_parameters_state_zero"
if i == 0
else (
"fitted_parameters_state_one"
if i == 1
else "fitted_parameters_state_two"
(
"fitted_parameters_state_zero"
if i == 0
else (
"fitted_parameters_state_one"
if i == 1
else "fitted_parameters_state_two"
)
)
][qubit]
fig.add_trace(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Collection of function to generate qibo circuits."""

from copy import deepcopy
from typing import Callable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""In this python script the fitting methods for the gate set protocols are defined.
They consist mostly of exponential decay fitting.
"""

from typing import Optional, Union

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class ReadoutMitigationMatrixParameters(Parameters):

@dataclass
class ReadoutMitigationMatrixResults(Results):
readout_mitigation_matrix: dict[
tuple[QubitId, ...], npt.NDArray[np.float64]
] = field(default_factory=dict)
readout_mitigation_matrix: dict[tuple[QubitId, ...], npt.NDArray[np.float64]] = (
field(default_factory=dict)
)
"""Readout mitigation matrices (inverse of measurement matrix)."""
measurement_matrix: dict[tuple[QubitId, ...], npt.NDArray[np.float64]] = field(
default_factory=dict
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SWAP experiment for two qubit gates, chevron plot."""

from dataclasses import dataclass, field
from typing import Optional

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Auxiliary functions to run CHSH protocol."""


READOUT_BASIS = ["ZZ", "ZX", "XZ", "XX"]


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CZ virtual correction experiment for two qubit gates, tune landscape."""

from dataclasses import dataclass, field
from typing import Optional

Expand Down
2 changes: 1 addition & 1 deletion src/qibocal/protocols/characterization/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def plot_results(data: Data, qubit: QubitId, qubit_states: list, fit: Results):
"accuracy",
"testing time [s]",
"training time [s]",
)
),
# pylint: disable=E1101
)
for i, model in enumerate(models_name):
Expand Down
1 change: 1 addition & 0 deletions src/qibocal/update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions to update parameters in platform."""

from typing import Union

from qibolab import pulses
Expand Down
1 change: 1 addition & 0 deletions tests/test_auto.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test graph execution."""

import pathlib

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Testing cli utils."""

from qibolab import create_platform

from qibocal.cli.utils import create_qubits_dict
Expand Down
1 change: 1 addition & 0 deletions tests/test_protocols.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test routines' acquisition method using dummy platform"""

import pathlib

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_task_options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test routines' acquisition method using dummy platform"""

from copy import deepcopy

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Testing update_* helper functions. """

import random
import re

Expand Down
Loading