From 5d3cb70c442e4bdb6ee0636f52774da125422484 Mon Sep 17 00:00:00 2001 From: QC Ware Ci Bot Date: Tue, 15 Mar 2022 20:49:11 +0000 Subject: [PATCH] automated push from d6f3095527106c0b51a6ee0e44ff915ccf29363c --- pyproject.toml | 11 +++++-- qcware/forge/__init__.py | 2 +- qcware/forge/config/config.py | 30 +++++++++---------- qcware/forge/qml/types/__init__.py | 10 +++---- .../transforms/transform_params.py | 8 ++--- .../transforms/transform_results.py | 6 ++-- .../optimization/results/results_types.py | 5 ++-- qcware/types/qml/fit_data.py | 4 +-- tox.ini | 12 ++++++++ 9 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 tox.ini diff --git a/pyproject.toml b/pyproject.toml index 6ed6330..3df8465 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "qcware" -version = "7.4.0" +version = "7.4.1" description = "The python client for QC Ware's Forge SaaS quantum computing product" authors = ["Vic Putz ","Bryan Burr bool: @@ -61,7 +61,7 @@ def server_result_to_wire(method_name: str, worker_result: object): return f(worker_result) -_from_wire_result_replacers: dict[str, Callable] = {} +_from_wire_result_replacers: Dict[str, Callable] = {} def client_result_from_wire(method_name: str, worker_result: object): diff --git a/qcware/types/optimization/results/results_types.py b/qcware/types/optimization/results/results_types.py index 358b1fe..67304cb 100644 --- a/qcware/types/optimization/results/results_types.py +++ b/qcware/types/optimization/results/results_types.py @@ -8,6 +8,7 @@ from qcware.types.optimization.problem_spec import BinaryProblem from qcware.types.optimization.results import utils from qcware.types.optimization.variable_types import domain_bit_values +from typing import Dict class Sample(pydantic.BaseModel): @@ -15,7 +16,7 @@ class Sample(pydantic.BaseModel): value: int occurrences: int = 1 - @pydantic.validator("occurrences") + @pydantic.validator("occurrences", allow_reuse=True) def positive_occurrences(cls, v): if v <= 0: raise ValueError( @@ -30,7 +31,7 @@ def str_bitstring(self, domain: Domain): """Write the sample bitstring in a format like '011' or '+--'.""" return binary_ints_to_binstring(bl=self.bitstring, domain=domain) - def convert(self, mapping: dict[int, int]) -> "Sample": + def convert(self, mapping: Dict[int, int]) -> "Sample": return Sample( bitstring=tuple(mapping[i] for i in self.bitstring), value=self.value, diff --git a/qcware/types/qml/fit_data.py b/qcware/types/qml/fit_data.py index e7a84f9..ebf1592 100644 --- a/qcware/types/qml/fit_data.py +++ b/qcware/types/qml/fit_data.py @@ -7,7 +7,7 @@ as additional internal data. """ -from typing import Optional, Union +from typing import Optional, Union, Tuple import numpy.typing import quasar @@ -23,7 +23,7 @@ class FitDataBase(BaseModel): loader_mode: str num_measurements: int absolute: bool - opt_shape: Optional[tuple[int, int]] + opt_shape: Optional[Tuple[int, int]] class QNearestCentroidFitData(FitDataBase): diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..102e6ef --- /dev/null +++ b/tox.ini @@ -0,0 +1,12 @@ +[tox] +skipsdist = true +envlist = py37, py38, py39, py310 + +[testenv] +setenv = + QCWARE_HOST=http://localhost:5454 + QCWARE_API_KEY=QCWARE +whitelist_externals = poetry +commands = + poetry install -v + poetry run pytest -k cpu