Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Types of changes:
- A github workflow for validating `CHANGELOG` updates in a PR ([#214](https://github.com/qBraid/pyqasm/pull/214))

### Improved / Modified
- Added `slots=True` parameter to the data classes in `elements.py` to improve memory efficiency ([#218](https://github.com/qBraid/pyqasm/pull/218))

### Deprecated

Expand Down
8 changes: 4 additions & 4 deletions src/pyqasm/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Context(Enum):
GATE = "gate"


@dataclass
@dataclass(slots=True)
class DepthNode:
"""Base class for depth nodes."""

Expand All @@ -52,7 +52,7 @@ class DepthNode:
depth: int = 0


@dataclass
@dataclass(slots=True)
class QubitDepthNode(DepthNode):
"""Qubit depth node."""

Expand All @@ -68,7 +68,7 @@ def is_idle(self) -> bool:
return self._total_ops() == 0


@dataclass
@dataclass(slots=True)
class ClbitDepthNode(DepthNode):
"""Classical bit depth node."""

Expand All @@ -78,7 +78,7 @@ def is_idle(self) -> bool:
return self.num_measurements == 0


@dataclass
@dataclass(slots=True)
class Variable: # pylint: disable=too-many-instance-attributes
"""
Class representing an OpenQASM variable.
Expand Down