Skip to content

Commit

Permalink
Separate import from docplex and quantum_provider (#311)
Browse files Browse the repository at this point in the history
* do not import specific function from docplex module in init file

* expose only quantum_provider too

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* missing modification in test_utils_mean

* group imports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

---------

Co-authored-by: Gregoire Cattan <gregoire.cattan@ibm.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 17, 2024
1 parent 461e546 commit cda6a00
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 30 deletions.
12 changes: 7 additions & 5 deletions pyriemann_qiskit/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
from sklearn.svm import SVC

from .datasets import get_feature_dimension
from .utils import (
get_provider,
get_device,
get_simulator,
from .utils.docplex import (
set_global_optimizer,
ClassicalOptimizer,
NaiveQAOAOptimizer,
Expand All @@ -43,7 +40,12 @@
gen_two_local,
get_spsa,
)
from .utils.quantum_provider import get_quantum_kernel
from .utils.quantum_provider import (
get_quantum_kernel,
get_simulator,
get_provider,
get_device,
)
from .utils.utils import is_qfunction

logging.basicConfig(level=logging.WARNING)
Expand Down
26 changes: 4 additions & 22 deletions pyriemann_qiskit/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
from . import hyper_params_factory, filtering, preprocessing
from .quantum_provider import get_provider, get_device, get_simulator
from . import quantum_provider
from .math import cov_to_corr_matrix, union_of_diff
from .docplex import (
square_cont_mat_var,
square_int_mat_var,
square_bin_mat_var,
ClassicalOptimizer,
NaiveQAOAOptimizer,
QAOACVOptimizer,
set_global_optimizer,
get_global_optimizer,
)
from . import docplex
from .firebase_connector import (
FirebaseConnector,
Cache,
Expand All @@ -27,19 +18,10 @@
"hyper_params_factory",
"filtering",
"preprocessing",
"get_provider",
"get_device",
"get_simulator",
"quantum_provider",
"cov_to_corr_matrix",
"union_of_diff",
"square_cont_mat_var",
"square_int_mat_var",
"square_bin_mat_var",
"ClassicalOptimizer",
"NaiveQAOAOptimizer",
"QAOACVOptimizer",
"set_global_optimizer",
"get_global_optimizer",
"docplex",
"distance",
"mean",
"FirebaseConnector",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_docplex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from docplex.mp.model import Model
from docplex.mp.vartype import ContinuousVarType, IntegerVarType, BinaryVarType
from pyriemann_qiskit.utils import (
from pyriemann_qiskit.utils.docplex import (
square_cont_mat_var,
square_int_mat_var,
square_bin_mat_var,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils_distance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import numpy as np
from pyriemann_qiskit.utils import (
from pyriemann_qiskit.utils.docplex import (
ClassicalOptimizer,
NaiveQAOAOptimizer,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils_mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sklearn.pipeline import make_pipeline
from sklearn.model_selection import StratifiedKFold, cross_val_score
from pyriemann_qiskit.utils.mean import qmean_euclid, qmean_logeuclid
from pyriemann_qiskit.utils import ClassicalOptimizer, NaiveQAOAOptimizer
from pyriemann_qiskit.utils.docplex import ClassicalOptimizer, NaiveQAOAOptimizer
from pyriemann_qiskit.classification import QuanticMDM
from pyriemann_qiskit.datasets import get_mne_sample
from qiskit_optimization.algorithms import ADMMOptimizer
Expand Down

0 comments on commit cda6a00

Please sign in to comment.