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

⬆️πŸͺ update pre-commit hooks #54

Merged
merged 2 commits into from
Aug 22, 2023
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:

# Also run Black on examples in the documentation
- repo: https://github.com/asottile/blacken-docs
rev: "1.15.0"
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies:
Expand All @@ -64,13 +64,13 @@ repos:
# Format configuration files with prettier
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.1"
rev: "v3.0.2"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, javascript, json]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.284
rev: v0.0.285
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -82,7 +82,7 @@ repos:
- id: nb-clean

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.0
rev: v1.5.1
hooks:
- id: mypy
files: ^(src|tests|setup.py)
Expand Down
9 changes: 5 additions & 4 deletions src/mqt/problemsolver/satellitesolver/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def solve_using_vqe(qubo: QuadraticProgram, noisy_flag: bool = False) -> Any:
class VQE(qiskitVQE): # type: ignore[misc]
def __init__(self, VQE_params: dict[str, Any] | None = None) -> None:
"""Function which initializes the VQE class."""
if VQE_params is None or type(VQE_params) is not dict:
if VQE_params is None or not isinstance(VQE_params, dict):
VQE_params = {}
if VQE_params.get("optimizer") is None:
VQE_params["optimizer"] = COBYLA(maxiter=1000)
Expand All @@ -89,7 +89,7 @@ def get_solution(self, qubo: QuadraticProgram) -> tuple[QuantumCircuit, MinimumE
class QAOA(qiskitQAOA): # type: ignore[misc]
def __init__(self, QAOA_params: dict[str, Any] | None = None) -> None:
"""Function which initializes the QAOA class."""
if QAOA_params is None or type(QAOA_params) is not dict:
if QAOA_params is None or not isinstance(QAOA_params, dict):
QAOA_params = {}
if QAOA_params.get("optimizer") is None:
QAOA_params["optimizer"] = COBYLA(maxiter=1000)
Expand All @@ -110,14 +110,15 @@ def get_solution(self, qubo: QuadraticProgram) -> tuple[QuantumCircuit, MinimumE
class W_QAOA:
def __init__(self, W_QAOA_params: dict[str, Any] | None = None, QAOA_params: dict[str, Any] | None = None) -> None:
"""Function which initializes the QAOA class."""
if type(W_QAOA_params) is not dict:

if not isinstance(W_QAOA_params, dict):
W_QAOA_params = {}
if W_QAOA_params.get("pre_solver") is None:
W_QAOA_params["pre_solver"] = CobylaOptimizer()
if W_QAOA_params.get("relax_for_pre_solver") is None:
W_QAOA_params["relax_for_pre_solver"] = True
if W_QAOA_params.get("qaoa") is None:
if type(QAOA_params) is not dict:
if not isinstance(QAOA_params, dict):
W_QAOA_params["qaoa"] = qiskitQAOA()
else:
W_QAOA_params["qaoa"] = qiskitQAOA(**QAOA_params)
Expand Down
Loading