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

🚸 Small library improvements #686

Merged
merged 5 commits into from
Sep 6, 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
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:

# Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.6.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -69,11 +69,12 @@ repos:
rev: v1.11.2
hooks:
- id: mypy
files: ^(src/mqt|test/python)
files: ^(src/mqt|test/python|noxfile.py)
args: []
additional_dependencies:
- pytest
- nox
- pandas-stubs
- pytest

# Also run Black on examples in the documentation
- repo: https://github.com/adamchainz/blacken-docs
Expand Down Expand Up @@ -107,7 +108,7 @@ repos:

# Check for spelling
- repo: https://github.com/crate-ci/typos
rev: v1.24.1
rev: v1.24.5
hooks:
- id: typos

Expand Down
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# set required cmake version
cmake_minimum_required(VERSION 3.19...3.28)
cmake_minimum_required(VERSION 3.19...3.30)

project(
mqt-core
LANGUAGES CXX
DESCRIPTION "MQT Core - The Backbone of the Munich Quantum Toolkit")

# Add path for custom modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(cmake/StandardProjectSettings.cmake)
Expand Down Expand Up @@ -84,10 +85,12 @@ if(BUILD_MQT_CORE_BENCHMARKS)
endif()

if(MQT_CORE_MASTER_PROJECT)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
if(NOT TARGET mqt-core-uninstall)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(mqt-core-uninstall COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
else()
set(mqt-core_FOUND
TRUE
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ report.exclude_also = [


[tool.mypy]
files = ["src/mqt", "test/python"]
files = ["src/mqt", "test/python", "noxfile.py"]
mypy_path = ["$MYPY_CONFIG_FILE_DIR/src"]
python_version = "3.8"
warn_unused_configs = true
Expand Down
9 changes: 5 additions & 4 deletions src/circuit_optimizer/CircuitOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,10 +1272,11 @@ void replaceMCXWithMCZ(
auto* compOp = dynamic_cast<qc::CompoundOperation*>(op.get());
replaceMCXWithMCZ(
compOp->begin(), [&compOp] { return compOp->end(); },
[&compOp](auto it, auto&& op) {
return compOp->insert(it, std::forward<decltype(op)>(op));
[&compOp](auto iter, auto&& operation) {
return compOp->insert(iter,
std::forward<decltype(operation)>(operation));
},
[&compOp](auto it) { return compOp->erase(it); });
[&compOp](auto iter) { return compOp->erase(iter); });
}
}
}
Expand Down Expand Up @@ -1668,7 +1669,7 @@ void elidePermutations(Iterator begin, const std::function<Iterator()>& end,
if (auto* compOp = dynamic_cast<CompoundOperation*>(op.get())) {
elidePermutations(
compOp->begin(), [&compOp]() { return compOp->end(); },
[&compOp](auto it) { return compOp->erase(it); }, permutation);
[&compOp](auto iter) { return compOp->erase(iter); }, permutation);
if (compOp->empty()) {
it = erase(it);
continue;
Expand Down
Loading