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

General Gate Class #32

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

General Gate Class #32

wants to merge 7 commits into from

Conversation

aleramos119
Copy link
Collaborator

Description

Allows for operation between gates, like multiplication and addition.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

if TYPE_CHECKING:
from numpy.typing import NDArray

from mqt.yaqs.core.data_structures.networks import MPS

from ..libraries.gate_library import BaseGate

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'BaseGate' may not be defined if module
yaqs.core.libraries.gate_library
is imported before module
yaqs.core.data_structures.simulation_parameters
, as the
definition
of BaseGate occurs after the cyclic
import
of yaqs.core.data_structures.simulation_parameters.

Copilot Autofix AI 12 days ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

self.sites = list(sites)


class Destroy(BaseGate):

Check failure

Code scanning / CodeQL

Missing call to `__init__` during object initialization Error

Class Destroy may not be initialized properly as
method BaseGate.__init__
is not called from its
__init__ method
.

Copilot Autofix AI 12 days ago

To fix the problem, we need to ensure that the __init__ method of the BaseGate class is called when initializing instances of the Destroy and H classes. This can be achieved by using the super() function in the __init__ methods of these subclasses. This approach ensures that the initialization logic of the base class is executed, maintaining the integrity of the object state.

Suggested changeset 1
src/mqt/yaqs/core/libraries/gate_library.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/mqt/yaqs/core/libraries/gate_library.py b/src/mqt/yaqs/core/libraries/gate_library.py
--- a/src/mqt/yaqs/core/libraries/gate_library.py
+++ b/src/mqt/yaqs/core/libraries/gate_library.py
@@ -389,2 +389,3 @@
         """Initializes the gate."""
+        super().__init__()
         return
@@ -422,2 +423,3 @@
         """Initializes the gate."""
+        super().__init__()
         return
EOF
@@ -389,2 +389,3 @@
"""Initializes the gate."""
super().__init__()
return
@@ -422,2 +423,3 @@
"""Initializes the gate."""
super().__init__()
return
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 31 lines in your changes missing coverage. Please review.

Project coverage is 94.5%. Comparing base (53e08cd) to head (a6597dd).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/mqt/yaqs/core/libraries/gate_library.py 63.9% 31 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main     #32     +/-   ##
=======================================
- Coverage   96.1%   94.5%   -1.6%     
=======================================
  Files         20      20             
  Lines       1772    1854     +82     
=======================================
+ Hits        1703    1753     +50     
- Misses        69     101     +32     
Flag Coverage Δ
python 94.5% <66.6%> (-1.6%) ⬇️
Files with missing lines Coverage Δ
src/mqt/yaqs/core/data_structures/networks.py 97.0% <100.0%> (ø)
...yaqs/core/data_structures/simulation_parameters.py 97.2% <100.0%> (ø)
src/mqt/yaqs/core/libraries/observables_library.py 100.0% <ø> (ø)
src/mqt/yaqs/core/libraries/gate_library.py 84.5% <63.9%> (-8.0%) ⬇️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant