Repository: rigetti/quil-rs (language: python)

Issue:
Allow control flow graph and related types to be constructed and subclassed
It would be helpful if the control flow graph types could be subclassed and had some way of constructing them. This allows downstream dependencies to more easily extend them or modify their behavior.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml
index 90083f05..effc84d9 100644
--- a/.github/workflows/msrv.yml
+++ b/.github/workflows/msrv.yml
@@ -53,8 +53,8 @@ jobs:
           command: test
           args: --all-features
 
-  test-py:
-    name: Test quil-py
+  check-py:
+    name: Check quil-py
     runs-on: ubuntu-latest
     strategy:
       matrix:
@@ -67,7 +67,7 @@ jobs:
     - uses: davidB/rust-cargo-make@v1
     - uses: actions/checkout@v1
     - uses: snok/install-poetry@v1
-    - name: Run quil-py tests
+    - name: Run quil-py tests, lints, and formatting checks.
       run: cargo make --cwd quil-py
 
   fmt:
diff --git a/quil-py/Makefile.toml b/quil-py/Makefile.toml
index f93051ae..a3727ac5 100644
--- a/quil-py/Makefile.toml
+++ b/quil-py/Makefile.toml
@@ -10,6 +10,7 @@ command = "poetry"
 args = ["run", "maturin", "develop"]
 
 [tasks.stubtest]
+dependencies = ["poetry-install"]
 command = "poetry"
 args = ["run", "stubtest", "--allowlist", ".stubtest-allowlist", "quil"]
 
@@ -20,6 +21,21 @@ dependencies = [
     "stubtest",
 ]
 
+[tasks.format]
+dependencies = ["poetry-install"]
+command = "poetry"
+args = ["run", "ruff", "format"]
+
+[tasks.check-format]
+dependencies = ["poetry-install"]
+command = "poetry"
+args = ["run", "ruff", "format", "--check"]
+
+[tasks.lint]
+dependencies = ["poetry-install"]
+command = "poetry"
+args = ["run", "ruff", "check"]
+
 [tasks.pytest]
 command = "poetry"
 args = ["run", "pytest"]
@@ -37,7 +53,13 @@ command = "poetry"
 args = ["run", "pdoc", "-o", "build/docs", "quil", "!quil.quil", "--logo", "https://qcs.rigetti.com/static/img/rigetti-logo.svg"]
 
 [tasks.dev-flow]
-dependencies = ["dev-test-flow", "pytest-flow", "stubtest"]
+dependencies = [
+    "dev-test-flow",
+    "pytest-flow",
+    "stubtest",
+    "lint",
+    "check-format"
+]
 
 [tasks.default]
 alias = "dev-flow"
diff --git a/quil-py/make_docs.py b/quil-py/make_docs.py
index f27428e2..4c157d1a 100644
--- a/quil-py/make_docs.py
+++ b/quil-py/make_docs.py
@@ -1,11 +1,10 @@
-from pathlib import Path
 import sys
+from pathlib import Path
 
 import pdoc
 
 import quil  # noqa - we need to import quil for it to appear in sys.modules
 
-
 if __name__ == "__main__":
     print(dir(sys.modules["quil"]))
     print(dir(sys.modules["quil.validation"]))
diff --git a/quil-py/poetry.lock b/quil-py/poetry.lock
index c84d4b3c..dd8c2607 100644
--- a/quil-py/poetry.lock
+++ b/quil-py/poetry.lock
@@ -33,69 +33,6 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-
 tests = ["attrs[tests-no-zope]", "zope.interface"]
 tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest (>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", "pytest-xdist[psutil]", "pytest-xdist[psutil]"]
 
-[[package]]
-name = "black"
-version = "23.1.0"
-description = "The uncompromising code formatter."
-optional = false
-python-versions = ">=3.7"
-files = [
-    {file = "black-23.1.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221"},
-    {file = "black-23.1.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26"},
-    {file = "black-23.1.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b"},
-    {file = "black-23.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104"},
-    {file = "black-23.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074"},
-    {file = "black-23.1.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27"},
-    {file = "black-23.1.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648"},
-    {file = "black-23.1.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958"},
-    {file = "black-23.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a"},
-    {file = "black-23.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481"},
-    {file = "black-23.1.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad"},
-    {file = "black-23.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8"},
-    {file = "black-23.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24"},
-    {file = "black-23.1.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6"},
-    {file = "black-23.1.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd"},
-    {file = "black-23.1.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580"},
-    {file = "black-23.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468"},
-    {file = "black-23.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753"},
-    {file = "black-23.1.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651"},
-    {file = "black-23.1.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06"},
-    {file = "black-23.1.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739"},
-    {file = "black-23.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9"},
-    {file = "black-23.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555"},
-    {file = "black-23.1.0-py3-none-any.whl", hash = "sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32"},
-    {file = "black-23.1.0.tar.gz", hash = "sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac"},
-]
-
-[package.dependencies]
-click = ">=8.0.0"
-mypy-extensions = ">=0.4.3"
-packaging = ">=22.0"
-pathspec = ">=0.9.0"
-platformdirs = ">=2"
-tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
-typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}
-
-[package.extras]
-colorama = ["colorama (>=0.4.3)"]
-d = ["aiohttp (>=3.7.4)"]
-jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
-uvloop = ["uvloop (>=0.15.2)"]
-
-[[package]]
-name = "click"
-version = "8.1.3"
-description = "Composable command line interface toolkit"
-optional = false
-python-versions = ">=3.7"
-files = [
-    {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
-    {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
-]
-
-[package.dependencies]
-colorama = {version = "*", markers = "platform_system == \"Windows\""}
-
 [[package]]
 name = "colorama"
 version = "0.4.6"
@@ -362,17 +299,6 @@ files = [
     {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"},
 ]
 
-[[package]]
-name = "pathspec"
-version = "0.11.0"
-description = "Utility library for gitignore style pattern matching of file paths."
-optional = false
-python-versions = ">=3.7"
-files = [
-    {file = "pathspec-0.11.0-py3-none-any.whl", hash = "sha256:3a66eb970cbac598f9e5ccb5b2cf58930cd8e3ed86d393d541eaf2d8b1705229"},
-    {file = "pathspec-0.11.0.tar.gz", hash = "sha256:64d338d4e0914e91c1792321e6907b5a593f1ab1851de7fc269557a21b30ebbc"},
-]
-
 [[package]]
 name = "pdoc"
 version = "14.1.0"
@@ -393,21 +319,6 @@ pygments = ">=2.12.0"
 [package.extras]
 dev = ["black", "hypothesis", "mypy", "pygments (>=2.14.0)", "pytest", "pytest-cov", "pytest-timeout", "ruff", "tox", "types-pygments"]
 
-[[package]]
-name = "platformdirs"
-version = "3.1.1"
-description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
-optional = false
-python-versions = ">=3.7"
-files = [
-    {file = "platformdirs-3.1.1-py3-none-any.whl", hash = "sha256:e5986afb596e4bb5bde29a79ac9061aa955b94fca2399b7aaac4090860920dd8"},
-    {file = "platformdirs-3.1.1.tar.gz", hash = "sha256:024996549ee88ec1a9aa99ff7f8fc819bb59e2c3477b410d90a16d32d6e707aa"},
-]
-
-[package.extras]
-docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"]
-test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"]
-
 [[package]]
 name = "pluggy"
 version = "1.0.0"
@@ -460,6 +371,32 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
 [package.extras]
 testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"]
 
+[[package]]
+name = "ruff"
+version = "0.3.7"
+description = "An extremely fast Python linter and code formatter, written in Rust."
+optional = false
+python-versions = ">=3.7"
+files = [
+    {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"},
+    {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"},
+    {file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"},
+    {file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"},
+    {file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"},
+    {file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"},
+    {file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"},
+    {file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"},
+    {file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"},
+    {file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"},
+    {file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"},
+]
+
 [[package]]
 name = "six"
 version = "1.16.0"
@@ -525,4 +462,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"]
 [metadata]
 lock-version = "2.0"
 python-versions = "^3.8"
-content-hash = "0a3b0fa6670ec3156719cb56a052cce8f8fe11169745f976da20549182936840"
+content-hash = "c4cf08c102dd7ec09c483f00c9dbbabdca03917d1393809aafa65beab8253376"
diff --git a/quil-py/pyproject.toml b/quil-py/pyproject.toml
index 50f47aa3..fa30866a 100644
--- a/quil-py/pyproject.toml
+++ b/quil-py/pyproject.toml
@@ -29,7 +29,7 @@ python = "^3.8"
 numpy = "^1.21"
 
 [tool.poetry.group.dev.dependencies]
-black = "^23.1.0"
+ruff = "^0.3.7"
 maturin = "^1.2.3"
 mypy = "^1.1.1"
 pytest = "^7.2.2"
@@ -46,7 +46,78 @@ sdist-include = ["README.md"]
 requires = ["maturin>=1.0.0,<2.0.0"]
 build-backend = "maturin"
 
-[tool.black]
+[tool.ruff]
+exclude = [
+    ".bzr",
+    ".direnv",
+    ".eggs",
+    ".git",
+    ".git-rewrite",
+    ".hg",
+    ".ipynb_checkpoints",
+    ".mypy_cache",
+    ".nox",
+    ".pants.d",
+    ".pyenv",
+    ".pytest_cache",
+    ".pytype",
+    ".ruff_cache",
+    ".svn",
+    ".tox",
+    ".venv",
+    ".vscode",
+    "__pypackages__",
+    "_build",
+    "buck-out",
+    "build",
+    "dist",
+    "node_modules",
+    "site-packages",
+    "venv",
+]
 line-length = 120
-target-version = ['py38', 'py39', 'py310', 'py311']
-include = '\.pyi?$'
+indent-width = 4
+target-version = "py38"
+
+[tool.ruff.lint]
+select = ["D", "E4", "E7", "E9", "F", "I", "B", "S", "W"]
+ignore = [
+    "E741" # "Ambiguous" variable names like "I" aren't ambiguous in this contex.
+] 
+fixable = ["ALL"]
+unfixable = []
+# Allow unused variables when underscore-prefixed.
+dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
+
+[tool.ruff.lint.per-file-ignores]
+"quil/**/*.py" = [
+    "F403", # * imports allowed in extension module glue.
+    "D100", # docstrings belong in type stubs
+    "D104", 
+] 
+"test/**/*.py" = [
+    "D",    # docstrings are not enforced in tests
+    "S101", # asserts are allowed in tests
+    "S301", # we need to test pickling
+]
+"make_docs.py" = [ "D" ]
+
+[tool.ruff.format]
+quote-style = "double"
+indent-style = "space"
+skip-magic-trailing-comma = false
+line-ending = "auto"
+
+[tool.ruff.lint.pydocstyle]
+convention = "google"
+
+[tool.pyright]
+# This diagnostic is raised when a type stub is found without a corresponding source file. This is
+# necessarily the case for a pure Rust pyo3 module, so disabling it.
+reportMissingModuleSource = false
+
+[[tool.mypy.overrides]]
+module = [
+    "quil.quil",
+]
+ignore_missing_imports = true
diff --git a/quil-py/quil/__init__.py b/quil-py/quil/__init__.py
index 57fb3fa6..c04d99fc 100644
--- a/quil-py/quil/__init__.py
+++ b/quil-py/quil/__init__.py
@@ -1,6 +1,6 @@
-"""
-The `quil` package provides tools for constructing, manipulating, parsing, and printing [Quil](https://github.com/quil-lang/quil) programs.
+"""The `quil` package provides tools for constructing, manipulating, parsing, and printing [Quil](https://github.com/quil-lang/quil) programs.
 
 ⚠️ This package is still in early development and breaking changes should be expected between minor versions.
 """
+
 from .quil import *
diff --git a/quil-py/quil/expression/__init__.pyi b/quil-py/quil/expression/__init__.pyi
index 73b6ad4d..9d1da781 100644
--- a/quil-py/quil/expression/__init__.pyi
+++ b/quil-py/quil/expression/__init__.pyi
@@ -1,21 +1,19 @@
-"""
-The ``expression`` module contains classes for representing Quil expressions.
-"""
+"""The ``expression`` module contains classes for representing Quil expressions."""
+
 from enum import Enum
-from typing import Dict, final, Sequence, Optional, Union
+from typing import Dict, Optional, Sequence, Union, final
 
 from quil.instructions import MemoryReference
 
 class EvaluationError(ValueError):
-    """Error that may occur while evaluation an ``Expression``"""
+    """Error that may occur while evaluation an ``Expression``."""
 
 class ParseExpressionError(ValueError):
-    """Error that may occur while parsing an ``Expression``"""
+    """Error that may occur while parsing an ``Expression``."""
 
 @final
 class Expression:
-    """
-    A Quil expression.
+    """A Quil expression.
 
     # Variants:
     - ``address``: An address defined by a `quil.instructions.MemoryReference`.
@@ -45,16 +43,21 @@ class Expression:
 
     def inner(
         self,
-    ) -> Union[MemoryReference, FunctionCallExpression, InfixExpression, int, PrefixExpression, str,]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+    ) -> Union[
+        MemoryReference,
+        FunctionCallExpression,
+        InfixExpression,
+        int,
+        PrefixExpression,
+        str,
+    ]:
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     @staticmethod
     def parse(input: str) -> Expression:
-        """
-        Parses an ``Expression`` from a string. Raises a ``ParseExpressionError`` if the string
-        isn't a valid Quil expression.
+        """Parses an ``Expression`` from a string.
+
+        Raises a ``ParseExpressionError`` if the string isn't a valid Quil expression.
         """
     def is_address(self) -> bool: ...
     def is_function_call(self) -> bool: ...
@@ -90,56 +93,41 @@ class Expression:
     def as_variable(self) -> Optional[str]: ...
     def to_variable(self) -> str: ...
     def simplify(self):
-        """
-        Simplify the expression as much as possible, in-place.
-        """
+        """Simplify the expression as much as possible, in-place."""
         ...
     def into_simplified(self) -> "Expression":
-        """
-        Return a simplified copy of the expression.
-        """
+        """Return a simplified copy of the expression."""
     def evaluate(
         self,
         variables: Dict[str, complex],
         memory_references: Dict[str, Sequence[float]],
     ) -> complex:
-        """
-        Evaluate an expression, expecting that it may be fully reduced to a single complex number.
+        """Evaluate an expression, expecting that it may be fully reduced to a single complex number.
+
         If it cannot be reduced to a complex number, raises an ``EvaluationError``.
         """
         ...
     def substitute_variables(self, variable_values: Dict[str, "Expression"]) -> "Expression":
-        """
-        Returns a copy of the expression where every matching variable in `variable_values` is
-        replaced by the corresponding expression.
-        """
+        """Returns a copy of the expression where every matching variable in `variable_values` is replaced by the corresponding expression."""
         ...
     def to_real(self) -> float:
-        """
-        If this is a number with imaginary part "equal to" zero (of <em>small</em> absolute value), return
-        that number. Otherwise, raises an ``EvaluationError``
-        """
+        """If this is a number with imaginary part "equal to" zero (of <em>small</em> absolute value), return that number. Otherwise, raises an ``EvaluationError``."""
     def __add__(self, other: "Expression") -> "Expression": ...
     def __sub__(self, other: "Expression") -> "Expression": ...
     def __mul__(self, other: "Expression") -> "Expression": ...
     def __truediv__(self, other: "Expression") -> "Expression": ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
-        """
+        """Attempt to convert the instruction to a valid Quil string. Raises an exception if the instruction can't be converted to valid Quil."""
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format
-        that isn't valid Quil.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug
+        format that isn't valid Quil.
         """
 
 class FunctionCallExpression:
-    """
-    A Quil function call.
-    """
+    """A Quil function call."""
     @staticmethod
     def __new__(cls, function: ExpressionFunction, expression: Expression) -> "FunctionCallExpression": ...
     @property
@@ -152,9 +140,7 @@ class FunctionCallExpression:
     def expression(self, expression: Expression): ...
 
 class InfixExpression:
-    """
-    A Quil infix expression.
-    """
+    """A Quil infix expression."""
     @staticmethod
     def __new__(cls, left: Expression, operator: InfixOperator, right: Expression): ...
     @property
@@ -171,9 +157,7 @@ class InfixExpression:
     def right(self, expression: Expression): ...
 
 class PrefixExpression:
-    """
-    A Quil prefix expression.
-    """
+    """A Quil prefix expression."""
     @staticmethod
     def __new__(cls, operator: PrefixOperator, expression: Expression): ...
     @property
@@ -187,9 +171,8 @@ class PrefixExpression:
 
 @final
 class ExpressionFunction(Enum):
-    """
-    An enum representing a Quil function that can be applied to an expression.
-    """
+    """An enum representing a Quil function that can be applied to an expression."""
+
     Cis = "CIS"
     Cosine = "COSINE"
     Exponent = "EXPONENT"
@@ -198,17 +181,15 @@ class ExpressionFunction(Enum):
 
 @final
 class PrefixOperator(Enum):
-    """
-    An enum that represents the operators supported on a prefix expression.
-    """
+    """An enum that represents the operators supported on a prefix expression."""
+
     Plus = "PLUS"
     Minus = "MINUS"
 
 @final
 class InfixOperator(Enum):
-    """
-    An enum that represents the operators supported on an infix expression.
-    """
+    """An enum that represents the operators supported on an infix expression."""
+
     Caret = "CARET"
     Plus = "PLUS"
     Minus = "MINUS"
diff --git a/quil-py/quil/instructions/__init__.py b/quil-py/quil/instructions/__init__.py
index 3afbd6db..7062b812 100644
--- a/quil-py/quil/instructions/__init__.py
+++ b/quil-py/quil/instructions/__init__.py
@@ -1,4 +1,3 @@
-"""
-The `quil.instructions` module contains classes for representing Quil instructions.
-"""
+"""The `quil.instructions` module contains classes for representing Quil instructions."""
+
 from quil.instructions import *
diff --git a/quil-py/quil/instructions/__init__.pyi b/quil-py/quil/instructions/__init__.pyi
index 60a14f27..6997ca8b 100644
--- a/quil-py/quil/instructions/__init__.pyi
+++ b/quil-py/quil/instructions/__init__.pyi
@@ -1,15 +1,15 @@
 from enum import Enum
+from typing import Dict, List, Optional, Sequence, Tuple, Union, final
+
 import numpy as np
 from numpy.typing import NDArray
-from typing import Dict, List, Optional, Sequence, Tuple, Union, final
 from typing_extensions import Self
 
 from quil.expression import Expression
 
 @final
 class Instruction:
-    """
-    A Quil instruction. Each variant corresponds to a possible type of Quil instruction.
+    """A Quil instruction. Each variant corresponds to a possible type of Quil instruction.
 
     # Variants:
     - ``arithmetic``: An arithmetic expression defined by an ``Arithmetic``.
@@ -113,13 +113,9 @@ class Instruction:
             WaveformDefinition,
         ],
     ) -> Self:
-        """
-        Returns a new ``Instruction`` from the given inner data.
-        """
+        """Returns a new ``Instruction`` from the given inner data."""
     def is_quil_t(self) -> bool:
-        """
-        Returns ``True`` if the instruction is a Quil-T instruction, ``False`` otherwise.
-        """
+        """Returns ``True`` if the instruction is a Quil-T instruction, ``False`` otherwise."""
         ...
     def inner(
         self,
@@ -161,9 +157,7 @@ class Instruction:
         UnaryLogic,
         WaveformDefinition,
     ]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_arithmetic(self) -> bool: ...
     def is_binary_logic(self) -> bool: ...
@@ -205,91 +199,91 @@ class Instruction:
     def is_waveform_definition(self) -> bool: ...
     def is_wait(self) -> bool: ...
     @staticmethod
-    def new_halt() -> "Instruction": ...
+    def new_halt() -> Instruction: ...
     @staticmethod
-    def new_nop() -> "Instruction": ...
+    def new_nop() -> Instruction: ...
     @staticmethod
-    def new_wait() -> "Instruction": ...
+    def new_wait() -> Instruction: ...
     @staticmethod
-    def from_arithmetic(inner: Arithmetic) -> "Instruction": ...
+    def from_arithmetic(inner: Arithmetic) -> Instruction: ...
     @staticmethod
-    def from_binary_logic(inner: BinaryLogic) -> "Instruction": ...
+    def from_binary_logic(inner: BinaryLogic) -> Instruction: ...
     @staticmethod
-    def from_calibration_definition(inner: Calibration) -> "Instruction": ...
+    def from_calibration_definition(inner: Calibration) -> Instruction: ...
     @staticmethod
-    def from_capture(inner: Capture) -> "Instruction": ...
+    def from_capture(inner: Capture) -> Instruction: ...
     @staticmethod
     def from_circuit_definition(
         inner: CircuitDefinition,
-    ) -> "Instruction": ...
+    ) -> Instruction: ...
     @staticmethod
-    def from_convert(inner: Convert) -> "Instruction": ...
+    def from_convert(inner: Convert) -> Instruction: ...
     @staticmethod
-    def from_comparison(inner: Comparison) -> "Instruction": ...
+    def from_comparison(inner: Comparison) -> Instruction: ...
     @staticmethod
-    def from_declaration(inner: Declaration) -> "Instruction": ...
+    def from_declaration(inner: Declaration) -> Instruction: ...
     @staticmethod
-    def from_delay(inner: Delay) -> "Instruction": ...
+    def from_delay(inner: Delay) -> Instruction: ...
     @staticmethod
-    def from_exchange(inner: Exchange) -> "Instruction": ...
+    def from_exchange(inner: Exchange) -> Instruction: ...
     @staticmethod
-    def from_fence(inner: Fence) -> "Instruction": ...
+    def from_fence(inner: Fence) -> Instruction: ...
     @staticmethod
-    def from_frame_definition(inner: FrameDefinition) -> "Instruction": ...
+    def from_frame_definition(inner: FrameDefinition) -> Instruction: ...
     @staticmethod
-    def from_gate(inner: Gate) -> "Instruction": ...
+    def from_gate(inner: Gate) -> Instruction: ...
     @staticmethod
-    def from_gate_definition(inner: GateDefinition) -> "Instruction": ...
+    def from_gate_definition(inner: GateDefinition) -> Instruction: ...
     @staticmethod
-    def from_include(inner: Include) -> "Instruction": ...
+    def from_include(inner: Include) -> Instruction: ...
     @staticmethod
-    def from_jump(inner: Jump) -> "Instruction": ...
+    def from_jump(inner: Jump) -> Instruction: ...
     @staticmethod
-    def from_jump_when(inner: JumpWhen) -> "Instruction": ...
+    def from_jump_when(inner: JumpWhen) -> Instruction: ...
     @staticmethod
-    def from_jump_unless(inner: JumpUnless) -> "Instruction": ...
+    def from_jump_unless(inner: JumpUnless) -> Instruction: ...
     @staticmethod
-    def from_label(inner: Label) -> "Instruction": ...
+    def from_label(inner: Label) -> Instruction: ...
     @staticmethod
-    def from_load(inner: Load) -> "Instruction": ...
+    def from_load(inner: Load) -> Instruction: ...
     @staticmethod
     def from_measure_calibration_definition(
         inner: MeasureCalibrationDefinition,
-    ) -> "Instruction": ...
+    ) -> Instruction: ...
     @staticmethod
     def from_measurement(
         inner: Measurement,
-    ) -> "Instruction": ...
+    ) -> Instruction: ...
     @staticmethod
-    def from_move(inner: Move) -> "Instruction": ...
+    def from_move(inner: Move) -> Instruction: ...
     @staticmethod
-    def from_pragma(inner: Pragma) -> "Instruction": ...
+    def from_pragma(inner: Pragma) -> Instruction: ...
     @staticmethod
-    def from_pulse(inner: Pulse) -> "Instruction": ...
+    def from_pulse(inner: Pulse) -> Instruction: ...
     @staticmethod
-    def from_raw_capture(inner: RawCapture) -> "Instruction": ...
+    def from_raw_capture(inner: RawCapture) -> Instruction: ...
     @staticmethod
-    def from_set_frequency(inner: SetFrequency) -> "Instruction": ...
+    def from_set_frequency(inner: SetFrequency) -> Instruction: ...
     @staticmethod
-    def from_set_phase(inner: SetPhase) -> "Instruction": ...
+    def from_set_phase(inner: SetPhase) -> Instruction: ...
     @staticmethod
-    def from_set_scale(inner: SetScale) -> "Instruction": ...
+    def from_set_scale(inner: SetScale) -> Instruction: ...
     @staticmethod
-    def from_shift_frequency(inner: ShiftFrequency) -> "Instruction": ...
+    def from_shift_frequency(inner: ShiftFrequency) -> Instruction: ...
     @staticmethod
-    def from_shift_phase(inner: ShiftPhase) -> "Instruction": ...
+    def from_shift_phase(inner: ShiftPhase) -> Instruction: ...
     @staticmethod
-    def from_unary_logic(inner: UnaryLogic) -> "Instruction": ...
+    def from_unary_logic(inner: UnaryLogic) -> Instruction: ...
     @staticmethod
-    def from_store(inner: Store) -> "Instruction": ...
+    def from_store(inner: Store) -> Instruction: ...
     @staticmethod
-    def from_swap_phases(inner: SwapPhases) -> "Instruction": ...
+    def from_swap_phases(inner: SwapPhases) -> Instruction: ...
     @staticmethod
-    def from_reset(inner: Reset) -> "Instruction": ...
+    def from_reset(inner: Reset) -> Instruction: ...
     @staticmethod
     def from_waveform_definition(
         inner: WaveformDefinition,
-    ) -> "Instruction": ...
+    ) -> Instruction: ...
     def as_arithmetic(self) -> Optional[Arithmetic]: ...
     def to_arithmetic(self) -> Arithmetic: ...
     def as_binary_logic(self) -> Optional[BinaryLogic]: ...
@@ -367,25 +361,26 @@ class Instruction:
     def as_waveform_definition(self) -> Optional[WaveformDefinition]: ...
     def to_waveform_definition(self) -> WaveformDefinition: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
-        """
+        """Attempt to convert the instruction to a valid Quil string. Raises an exception if the instruction can't be converted to valid Quil."""
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 @final
 class ArithmeticOperand:
-    """
-    A Quil arithmetic operand.
+    """A Quil arithmetic operand.
 
     # Variants:
     - ``literal_integer``: An integer literal.
@@ -400,9 +395,7 @@ class ArithmeticOperand:
     """
 
     def inner(self) -> Union[int, float, MemoryReference]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_literal_integer(self) -> bool: ...
     def is_literal_real(self) -> bool: ...
@@ -414,23 +407,23 @@ class ArithmeticOperand:
     def to_literal_real(self) -> float: ...
     def to_memory_reference(self) -> MemoryReference: ...
     @staticmethod
-    def from_literal_integer(inner: int) -> "ArithmeticOperand": ...
+    def from_literal_integer(inner: int) -> ArithmeticOperand: ...
     @staticmethod
-    def from_literal_real(inner: float) -> "ArithmeticOperand": ...
+    def from_literal_real(inner: float) -> ArithmeticOperand: ...
     @staticmethod
     def from_memory_reference(
         inner: MemoryReference,
-    ) -> "ArithmeticOperand": ...
+    ) -> ArithmeticOperand: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 @final
@@ -440,15 +433,15 @@ class ArithmeticOperator(Enum):
     Divide = "Divide"
     Multiply = "Multiply"
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Arithmetic:
@@ -471,25 +464,28 @@ class Arithmetic:
     @source.setter
     def source(self, operand: ArithmeticOperand) -> None: ...
     def to_quil(self) -> str:
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
-        """
-        ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original. Should be used by passing
+        an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 @final
 class BinaryOperand:
-    """
-    A Quil binary operand.
+    """A Quil binary operand.
 
     # Variants:
     - ``literal_integer``: An integer literal.
@@ -503,9 +499,7 @@ class BinaryOperand:
     """
 
     def inner(self) -> Union[int, MemoryReference]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_literal_integer(self) -> bool: ...
     def is_memory_reference(self) -> bool: ...
@@ -514,21 +508,20 @@ class BinaryOperand:
     def to_literal_integer(self) -> int: ...
     def to_memory_reference(self) -> MemoryReference: ...
     @staticmethod
-    def from_literal_integer(inner: int) -> "BinaryOperand": ...
+    def from_literal_integer(inner: int) -> BinaryOperand: ...
     @staticmethod
     def from_memory_reference(
         inner: MemoryReference,
-    ) -> "BinaryOperand": ...
+    ) -> BinaryOperand: ...
     def to_quil(self) -> str:
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
-        """
-        ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 @final
@@ -537,15 +530,14 @@ class BinaryOperator(Enum):
     Ior = "IOR"
     Xor = "XOR"
     def to_quil(self) -> str:
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
-        """
-        ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class BinaryOperands:
@@ -578,18 +570,23 @@ class BinaryLogic:
     @operands.setter
     def operands(self, operands: BinaryOperands) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -604,18 +601,23 @@ class Convert:
     @source.setter
     def source(self, source: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -630,18 +632,23 @@ class Move:
     @source.setter
     def source(self, source: ArithmeticOperand) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -656,25 +663,29 @@ class Exchange:
     @right.setter
     def right(self, right: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 @final
 class ComparisonOperand:
-    """
-    A Quil binary operand.
+    """A Quil binary operand.
 
     # Variants:
     - ``literal_integer``: An integer literal.
@@ -689,9 +700,7 @@ class ComparisonOperand:
     """
 
     def inner(self) -> Union[int, float, MemoryReference]:
-        """
-        Returns the inner value of the variant.
-        """
+        """Returns the inner value of the variant."""
         ...
     def is_literal_integer(self) -> bool: ...
     def is_literal_real(self) -> bool: ...
@@ -703,23 +712,23 @@ class ComparisonOperand:
     def to_literal_real(self) -> float: ...
     def to_memory_reference(self) -> MemoryReference: ...
     @staticmethod
-    def from_literal_integer(inner: int) -> "ComparisonOperand": ...
+    def from_literal_integer(inner: int) -> ComparisonOperand: ...
     @staticmethod
-    def from_literal_real(inner: float) -> "ComparisonOperand": ...
+    def from_literal_real(inner: float) -> ComparisonOperand: ...
     @staticmethod
     def from_memory_reference(
         inner: MemoryReference,
-    ) -> "ComparisonOperand": ...
+    ) -> ComparisonOperand: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 @final
@@ -747,18 +756,23 @@ class Comparison:
     @operands.setter
     def operands(self, operands: Tuple[MemoryReference, MemoryReference, ComparisonOperand]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -767,15 +781,15 @@ class UnaryOperator(Enum):
     Neg = "NEG"
     Not = "NOT"
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class UnaryLogic:
@@ -789,18 +803,23 @@ class UnaryLogic:
     @operand.setter
     def operand(self, operand: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -834,18 +853,23 @@ class Calibration:
     @modifiers.setter
     def modifiers(self, modifiers: Sequence[GateModifier]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -869,18 +893,23 @@ class MeasureCalibrationDefinition:
     @instructions.setter
     def instructions(self, instructions: Sequence[Instruction]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -909,18 +938,23 @@ class CircuitDefinition:
     @instructions.setter
     def instructions(self, instructions: Sequence[Instruction]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -939,15 +973,15 @@ class Offset:
     @data_type.setter
     def data_type(self, data_type: ScalarType) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Sharing:
@@ -980,18 +1014,23 @@ class Declaration:
     @sharing.setter
     def sharing(self, sharing: Optional[Sharing]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1006,15 +1045,15 @@ class Vector:
     @length.setter
     def length(self, data_type: int) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 @final
@@ -1024,21 +1063,20 @@ class ScalarType(Enum):
     Octet = "OCTET"
     Real = "REAL"
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 @final
 class AttributeValue:
-    """
-    A frame attribute value.
+    """A frame attribute value.
 
     # Variants:
     - ``string``: A string attribute containing a ``str``.
@@ -1052,30 +1090,28 @@ class AttributeValue:
     """
 
     def inner(self) -> Union[str, Expression]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_string(self) -> bool: ...
     def is_expression(self) -> bool: ...
     @staticmethod
-    def from_string(inner: str) -> "AttributeValue": ...
+    def from_string(inner: str) -> AttributeValue: ...
     @staticmethod
-    def from_expression(inner: Expression) -> "AttributeValue": ...
+    def from_expression(inner: Expression) -> AttributeValue: ...
     def as_string(self) -> Optional[str]: ...
     def to_string(self) -> str: ...
     def as_expression(self) -> Optional[Expression]: ...
     def to_expression(self) -> Expression: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class FrameDefinition:
@@ -1093,18 +1129,23 @@ class FrameDefinition:
     @attributes.setter
     def attributes(self, identifier: Dict[str, AttributeValue]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1119,15 +1160,15 @@ class FrameIdentifier:
     @qubits.setter
     def qubits(self, qubits: Sequence[Qubit]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Capture:
@@ -1155,18 +1196,23 @@ class Capture:
     @waveform.setter
     def waveform(self, waveform: WaveformInvocation) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1190,18 +1236,23 @@ class Pulse:
     @waveform.setter
     def waveform(self, waveform: WaveformInvocation) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1230,18 +1281,23 @@ class RawCapture:
     @memory_reference.setter
     def memory_reference(self, memory_reference: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1256,18 +1312,23 @@ class SetFrequency:
     @frequency.setter
     def frequency(self, frequency: Expression) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1282,18 +1343,23 @@ class SetPhase:
     @phase.setter
     def phase(self, phase: Expression) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1308,18 +1374,23 @@ class SetScale:
     @scale.setter
     def scale(self, scale: Expression) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1334,18 +1405,23 @@ class ShiftFrequency:
     @frequency.setter
     def frequency(self, frequency: Expression) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1360,18 +1436,23 @@ class ShiftPhase:
     @phase.setter
     def phase(self, phase: Expression) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1386,23 +1467,28 @@ class SwapPhases:
     @frame_2.setter
     def frame_2(self, frame_2: FrameIdentifier) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 class GateError(ValueError):
-    """An error that may occur when performing operations on a ``Gate``"""
+    """An error that may occur when performing operations on a ``Gate``."""
 
     ...
 
@@ -1412,15 +1498,15 @@ class GateModifier(Enum):
     Dagger = "DAGGER"
     Forked = "FORKED"
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Gate:
@@ -1448,25 +1534,19 @@ class Gate:
     @modifiers.setter
     def modifiers(self, modifiers: Sequence[GateModifier]) -> None: ...
     def dagger(self) -> Self:
-        """
-        Returns a copy of the gate with the ``DAGGER`` modifier added to it.
-        """
+        """Returns a copy of the gate with the ``DAGGER`` modifier added to it."""
         ...
     def controlled(self, control_qubit: Qubit) -> Self:
-        """
-        Returns a copy of the gate with the ``CONTROLLED`` modifier added to it.
-        """
+        """Returns a copy of the gate with the ``CONTROLLED`` modifier added to it."""
     def forked(self, fork_qubit: Qubit, alt_params: Sequence[Expression]) -> Self:
-        """
-        Returns a copy of the gate with the ``FORKED`` modifier added to it.
+        """Returns a copy of the gate with the ``FORKED`` modifier added to it.
 
         Raises a ``GateError`` if the number of provided alternate parameters don't
         equal the number of existing parameters.
         """
         ...
     def to_unitary_mut(self, n_qubits: int) -> NDArray[np.complex_]:
-        """
-        Lift a Gate to the full `n_qubits`-qubit Hilbert space.
+        """Lift a Gate to the full `n_qubits`-qubit Hilbert space.
 
         Returns a ``GateError` if any of the parameters of this gate are
         non-constant, if any of the qubits are variable, if the name of this
@@ -1474,18 +1554,23 @@ class Gate:
         """
         ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1496,11 +1581,8 @@ class PauliGate(Enum):
     Y = "Y"
     Z = "Z"
     @staticmethod
-    def parse(input: str) -> "PauliGate":
-        """
-        Parses a ``PauliGate`` from a string. Raises a ``ParseEnumError`` if the
-        string isn't a valid Pauli word.
-        """
+    def parse(input: str) -> PauliGate:
+        """Parses a ``PauliGate`` from a string. Raises a ``ParseEnumError`` if the string isn't a valid Pauli word."""
         ...
 
 class PauliTerm:
@@ -1531,11 +1613,10 @@ class PauliSum:
 
 @final
 class GateSpecification:
-    """
-    A specification for a gate definition.
+    """A specification for a gate definition.
 
     # Variants:
-    - ``matrix``: A gate specificied by a matrix of ``Expression``s representing a unitary operation.
+    - ``matrix``: A gate specified by a matrix of ``Expression``s representing a unitary operation.
     - ``permutation``: A gate specified by a vector of integers that defines a permutation.
 
     Methods (for each variant):
@@ -1546,9 +1627,7 @@ class GateSpecification:
     """
 
     def inner(self) -> Union[List[List[Expression]], List[int], PauliSum]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_matrix(self) -> bool: ...
     def is_permutation(self) -> bool: ...
@@ -1560,21 +1639,21 @@ class GateSpecification:
     def as_pauli_sum(self) -> Optional[PauliSum]: ...
     def to_pauli_sum(self) -> PauliSum: ...
     @staticmethod
-    def from_matrix(inner: Sequence[Sequence[Expression]]) -> "GateSpecification": ...
+    def from_matrix(inner: Sequence[Sequence[Expression]]) -> GateSpecification: ...
     @staticmethod
-    def from_permutation(inner: Sequence[int]) -> "GateSpecification": ...
+    def from_permutation(inner: Sequence[int]) -> GateSpecification: ...
     @staticmethod
-    def from_pauli_sum(inner: PauliSum) -> "GateSpecification": ...
+    def from_pauli_sum(inner: PauliSum) -> GateSpecification: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class GateDefinition:
@@ -1597,25 +1676,29 @@ class GateDefinition:
     @specification.setter
     def specification(self, specification: GateSpecification) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 @final
 class Qubit:
-    """
-    A Qubit
+    """A Qubit.
 
     # Variants:
     - ``fixed``: A qubit represented as a fixed integer index.
@@ -1629,9 +1712,7 @@ class Qubit:
     """
 
     def inner(self) -> Union[int, str]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_fixed(self) -> bool: ...
     def is_variable(self) -> bool: ...
@@ -1643,27 +1724,27 @@ class Qubit:
     def as_placeholder(self) -> Optional[QubitPlaceholder]: ...
     def to_placeholder(self) -> QubitPlaceholder: ...
     @staticmethod
-    def from_fixed(inner: int) -> "Qubit": ...
+    def from_fixed(inner: int) -> Qubit: ...
     @staticmethod
-    def from_variable(inner: str) -> "Qubit": ...
+    def from_variable(inner: str) -> Qubit: ...
     @staticmethod
-    def from_placeholder(inner: QubitPlaceholder) -> "Qubit": ...
+    def from_placeholder(inner: QubitPlaceholder) -> Qubit: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class QubitPlaceholder:
-    """
-    A qubit that can be used as a placeholder. Must be resolved before converting
-    a program to valid Quil. See ``quil.program.Program#resolve_placeholders``.
+    """A qubit that can be used as a placeholder.
+
+    Placeholders must be resolved before converting a program to valid Quil. See ``quil.program.Program#resolve_placeholders``.
     """
 
     def __new__(cls) -> Self: ...
@@ -1676,18 +1757,23 @@ class Reset:
     @qubit.setter
     def qubit(self, qubit: Optional[Qubit]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1706,18 +1792,23 @@ class Delay:
     @qubits.setter
     def qubits(self, qubits: Sequence[Qubit]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1728,26 +1819,31 @@ class Fence:
     @qubits.setter
     def qubits(self, qubits: Sequence[Qubit]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 @final
 class PragmaArgument:
-    """
+    """A PRAGMA argument.
 
-    # Variants:
+    Variants:
     - ``identifier``: A Pragma argument defined by a Quil identifier
     - ``integer``: A Pragma argument defined by an integer
 
@@ -1759,9 +1855,7 @@ class PragmaArgument:
     """
 
     def inner(self) -> Union[str, int]:
-        """
-        Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist.
-        """
+        """Returns the inner value of the variant. Raises a ``RuntimeError`` if inner data doesn't exist."""
         ...
     def is_identifier(self) -> bool: ...
     def is_integer(self) -> bool: ...
@@ -1770,19 +1864,19 @@ class PragmaArgument:
     def to_identifier(self) -> str: ...
     def to_integer(self) -> int: ...
     @staticmethod
-    def from_identifier(inner: str) -> "PragmaArgument": ...
+    def from_identifier(inner: str) -> PragmaArgument: ...
     @staticmethod
-    def from_integer(inner: int) -> "PragmaArgument": ...
+    def from_integer(inner: int) -> PragmaArgument: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Include:
@@ -1792,18 +1886,23 @@ class Include:
     @filename.setter
     def filename(self, filename: str) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1822,18 +1921,23 @@ class Pragma:
     @data.setter
     def data(self, data: Optional[str]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1848,31 +1952,36 @@ class Measurement:
     @target.setter
     def target(self, target: Optional[MemoryReference]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 class ParseMemoryReferenceError(ValueError):
-    """Errors that may occur while parsing a ``MemoryReference``"""
+    """Errors that may occur while parsing a ``MemoryReference``."""
 
 class MemoryReference:
     def __new__(cls, name: str, index: int) -> Self: ...
     @staticmethod
-    def parse(input: str) -> "MemoryReference":
-        """
-        Parses a ``MemoryReference`` from a string. Raises a ``ParseMemoryReference`` error if the
-        string isn't a valid Quil memory reference.
+    def parse(input: str) -> MemoryReference:
+        """Parses a ``MemoryReference`` from a string.
+
+        Raises a ``ParseMemoryReference`` error if the string isn't a valid Quil memory reference.
         """
         ...
     @property
@@ -1884,15 +1993,15 @@ class MemoryReference:
     @index.setter
     def index(self, index: int) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Load:
@@ -1910,18 +2019,23 @@ class Load:
     @offset.setter
     def offset(self, offset: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1940,18 +2054,23 @@ class Store:
     @source.setter
     def source(self, source: ArithmeticOperand) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -1977,18 +2096,23 @@ class WaveformDefinition:
     @definition.setter
     def definition(self, definition: Waveform) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -2003,15 +2127,15 @@ class WaveformInvocation:
     @parameters.setter
     def parameters(self, parameters: Dict[str, Expression]) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class Label:
@@ -2021,25 +2145,29 @@ class Label:
     @target.setter
     def target(self, target: Target) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
 @final
 class Target:
-    """
-    Represents a Quil target.
+    """Represents a Quil target.
 
     # Variants:
     - ``fixed``: A fixed target defined by a Quil identifier
@@ -2052,11 +2180,11 @@ class Target:
     - ``from_*``: Creates a new ``PragmaArgument`` using an instance of the inner type for the variant.
     """
 
-    def __new__(cls, inner: Union[str, TargetPlaceholder]) -> "Target": ...
+    def __new__(cls, inner: Union[str, TargetPlaceholder]) -> Target: ...
     @staticmethod
-    def from_fixed(inner: str) -> "Target": ...
+    def from_fixed(inner: str) -> Target: ...
     @staticmethod
-    def from_placeholder(inner: TargetPlaceholder) -> "Target": ...
+    def from_placeholder(inner: TargetPlaceholder) -> Target: ...
     def is_fixed(self) -> bool: ...
     def is_placeholder(self) -> bool: ...
     def as_fixed(self) -> Optional[str]: ...
@@ -2065,21 +2193,19 @@ class Target:
     def to_placeholder(self) -> TargetPlaceholder: ...
     def inner(self) -> Union[str, TargetPlaceholder]: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
 
 class TargetPlaceholder:
-    """
-    A placeholder target that must be assigned a fixed name before creating a program
-    with valid quil.
+    """A placeholder target that must be assigned a fixed name before creating a program with valid quil.
 
     See ``quil.program.Program#resolve_placeholders`` for more information.
     """
@@ -2095,18 +2221,23 @@ class Jump:
     @target.setter
     def target(self, target: Target) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -2121,18 +2252,23 @@ class JumpWhen:
     @condition.setter
     def condition(self, condition: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
 
@@ -2147,17 +2283,22 @@ class JumpUnless:
     @condition.setter
     def condition(self, condition: MemoryReference) -> None: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def __deepcopy__(self, _: Dict) -> Self:
-        """Creates and returns a deep copy of the class. If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with new placeholders so resolving them in the copy will not resolve them in the original.  Should be used by passing an instance of the class to ``copy.deepcopy``"""
+        """Creates and returns a deep copy of the class.
+
+        If the instruction contains any ``QubitPlaceholder`` or ``TargetPlaceholder``, then they will be replaced with
+        new placeholders so resolving them in the copy will not resolve them in the original.
+        Should be used by passing an instance of the class to ``copy.deepcopy``
+        """
     def __copy__(self) -> Self:
         """Returns a shallow copy of the class."""
diff --git a/quil-py/quil/program/__init__.py b/quil-py/quil/program/__init__.py
index 2a4642c3..bbf0cda4 100644
--- a/quil-py/quil/program/__init__.py
+++ b/quil-py/quil/program/__init__.py
@@ -1,5 +1,3 @@
-"""
-The `quil.program` module contains classes for constructing and representing a 
-Quil program.
-"""
+"""The `quil.program` module contains classes for constructing and representing a Quil program."""
+
 from quil.program import *
diff --git a/quil-py/quil/program/__init__.pyi b/quil-py/quil/program/__init__.pyi
index d51c66b7..39784b4f 100644
--- a/quil-py/quil/program/__init__.pyi
+++ b/quil-py/quil/program/__init__.pyi
@@ -1,7 +1,9 @@
-from typing import Dict, FrozenSet, Set, final, List, Optional, Sequence, Callable
+from typing import Callable, Dict, FrozenSet, List, Optional, Sequence, Set, final
 
 import numpy as np
 from numpy.typing import NDArray
+from typing_extensions import Self
+
 from quil.instructions import (
     AttributeValue,
     Calibration,
@@ -14,12 +16,12 @@ from quil.instructions import (
     Measurement,
     MemoryReference,
     Qubit,
+    QubitPlaceholder,
     Sharing,
     Target,
+    TargetPlaceholder,
     Vector,
     Waveform,
-    TargetPlaceholder,
-    QubitPlaceholder,
 )
 
 @final
@@ -51,24 +53,20 @@ class Program:
     @property
     def declarations(self) -> Dict[str, Declaration]: ...
     def dagger(self) -> "Program":
-        """
-        Creates a new conjugate transpose of the ``Program`` by reversing the order of gate
-        instructions and applying the DAGGER modifier to each.
+        """Creates a new conjugate transpose of the ``Program`` by reversing the order of gate instructions and applying the DAGGER modifier to each.
 
         Raises a ``GateError`` if any of the instructions in the program are not a ``Gate`
         """
         ...
     def expand_calibrations(self) -> "Program":
-        """
-        Expand any instructions in the program which have a matching calibration, leaving the others
-        unchanged. Recurses though each instruction while ensuring there is no cycle in the expansion
-        graph (i.e. no calibration expands directly or indirectly into itself)
+        """Expand any instructions in the program which have a matching calibration, leaving the others unchanged.
+
+        Recurses though each instruction while ensuring there is no cycle in the expansion graph (i.e. no calibration
+        expands directly or indirectly into itself)
         """
         ...
     def into_simplified(self) -> "Program":
-        """
-        Simplify this program into a new [`Program`] which contains only instructions
-        and definitions which are executed; effectively, perform dead code removal.
+        """Simplify this program into a new `Program` which contains only instructions and definitions which are executed; effectively, perform dead code removal.
 
         Removes:
         - All calibrations, following calibration expansion
@@ -79,59 +77,46 @@ class Program:
         """
         ...
     def get_used_qubits(self) -> Set[Qubit]:
-        """
-        Returns a set consisting of every Qubit that is used in the program.
-        """
+        """Returns a set consisting of every Qubit that is used in the program."""
         ...
     def add_instruction(self, instruction: Instruction):
-        """
-        Add an instruction to the end of the program.
-        """
+        """Add an instruction to the end of the program."""
         ...
     def add_instructions(self, instructions: Sequence[Instruction]):
-        """
-        Add a list of instructions to the end of the program.
-        """
+        """Add a list of instructions to the end of the program."""
         ...
     @staticmethod
     def parse(input: str) -> "Program":
-        """
-        Parses the given Quil string and returns a new ``Program``.
+        """Parses the given Quil string and returns a new ``Program``.
+
         Raises a ``ProgramError`` if the given string isn't valid Quil.
         """
     def to_instructions(self) -> Sequence[Instruction]: ...
     def to_unitary(self, n_qubits: int) -> NDArray[np.complex_]: ...
     def copy(self) -> "Program":
-        """
-        Creates a clone of this ``Program``.
-        """
+        """Creates a clone of this ``Program``."""
         ...
     def clone_without_body_instructions(self) -> "Program":
-        """
-        Creates a clone of this ``Program`` with an empty body instructions list.
-        """
+        """Creates a clone of this ``Program`` with an empty body instructions list."""
     def __add__(self, rhs: Program) -> Program: ...
     def to_quil(self) -> str:
-        """
-        Attempt to convert the instruction to a valid Quil string. Raises
-        an exception if the instruction can't be converted to valid Quil.
+        """Attempt to convert the instruction to a valid Quil string.
+
+        Raises an exception if the instruction can't be converted to valid Quil.
         """
         ...
     def to_quil_or_debug(self) -> str:
-        """
-        Convert the instruction to a Quil string. If any part of the instruction can't
-        be converted to valid Quil, it will be printed in a human-readable debug format.
+        """Convert the instruction to a Quil string.
+
+        If any part of the instruction can't be converted to valid Quil, it will be printed in a human-readable debug format.
         """
     def filter_instructions(self, predicate: Callable[[Instruction], bool]) -> "Program":
-        """
-        Return a new ``Program`` containing only the instructions for which ``predicate`` returns ``True``.
-        """
+        """Return a new ``Program`` containing only the instructions for which ``predicate`` returns ``True``."""
         ...
     def wrap_in_loop(
         self, loop_count_reference: MemoryReference, start_target: Target, end_target: Target, iterations: int
     ) -> "Program":
-        """
-        Return a copy of the `Program` wrapped in a loop that repeats ``iterations`` times.
+        """Return a copy of the `Program` wrapped in a loop that repeats ``iterations`` times.
 
         The loop is constructed by wrapping the body of the program in classical Quil instructions.
         The given ``loop_count_reference`` must refer to an INTEGER memory region. The value at the
@@ -149,8 +134,7 @@ class Program:
         """
         ...
     def resolve_placeholders(self) -> None:
-        """
-        Resolve ``TargetPlaceholder``s and ``QubitPlaceholder``s within the program using default resolvers.
+        """Resolve ``TargetPlaceholder``s and ``QubitPlaceholder``s within the program using default resolvers.
 
         The default resolver will be used to generate a unique value for that placeholder within the scope of
         the program using an auto-incrementing value (for qubit) or suffix (for target)
@@ -163,9 +147,9 @@ class Program:
         target_resolver: Optional[Callable[[TargetPlaceholder], Optional[str]]] = None,
         qubit_resolver: Optional[Callable[[QubitPlaceholder], Optional[int]]] = None,
     ):
-        """
-        Resolve ``TargetPlaceholder``s and ``QubitPlaceholder``s within the program such that the resolved values
-        will remain unique to that placeholder within the scope of the program.
+        """Resolve ``TargetPlaceholder``s and ``QubitPlaceholder``s within the program.
+
+        The resolved values will remain unique to that placeholder within the scope of the program.
 
         If you provide ``target_resolver`` and/or ``qubit_resolver``, those will be used to resolve those values respectively.
         If your resolver returns `None` for a particular placeholder, it will not be replaced but will be left as a placeholder.
@@ -176,19 +160,17 @@ class Program:
         """
         ...
     def control_flow_graph(self) -> "ControlFlowGraph":
-        """
-        Return the `control flow graph`_ of the program.
+        """Return the `control flow graph`_ of the program.
 
         .. _control flow graph: https://en.wikipedia.org/wiki/Control-flow_graph
         """
 
-@final
 class BasicBlock:
-    def as_schedule_seconds(self, program: Program) -> ScheduleSeconds:
-        """
-        Return the ``ScheduleSeconds`` representing the timing of the instructions within the block.
+    def __new__(cls, instance: "BasicBlock") -> Self:
+        """Create a new instance of a `BasicBlock` (or a subclass) using an existing instance."""
 
-        This schedule is computed by:
+    def as_schedule_seconds(self, program: Program) -> ScheduleSeconds:
+        """Return the ``ScheduleSeconds`` representing the timing of the instructions within the block.
 
         * Expanding each instruction within the block using the program's calibration definitions
         * Resolving the `ScheduleSeconds` of the expanded instructions
@@ -257,25 +239,19 @@ class BasicBlock:
         This may be unexpected if the user expects to see only the timing of the inner `PULSE`.
         """
     def gate_depth(self, gate_minimum_qubit_count: int) -> int:
-        """
-        Returns the length of the longest path from an initial instruction (one with no prerequisite instructions) to a final
-        instruction (one with no dependent instructions), where the length of a path is the number of gate instructions in the path.
+        """Returns the length of the longest path from an initial instruction (one with no prerequisite instructions) to a final instruction (one with no dependent instructions), where the length of a path is the number of gate instructions in the path.
 
         :param gate_minimum_qubit_count: The minimum number of qubits in a gate for it to be counted in the depth.
         """
     def label(self) -> Optional[Target]:
-        """
-        Return the label of the block, if any. This is used to target this block in control flow.
-        """
+        """Return the label of the block, if any. This is used to target this block in control flow."""
     def instructions(self) -> List[Instruction]:
-        """
-        Return a list of the instructions in the block, in order of definition.
+        """Return a list of the instructions in the block, in order of definition.
 
         This does not include the label or terminator instructions.
         """
     def terminator(self) -> Optional[Instruction]:
-        """
-        Return the control flow terminator instruction of the block, if any.
+        """Return the control flow terminator instruction of the block, if any.
 
         If this is ``None``, the implicit behavior is to "continue" to the subsequent block.
         """
@@ -293,22 +269,18 @@ class CalibrationSet:
     @property
     def measure_calibrations(self) -> List[MeasureCalibrationDefinition]: ...
     def expand(self, instruction: Instruction, previous_calibrations: Sequence[Instruction]) -> List[Instruction]:
-        """
-        Given an instruction, return the instructions to which it is expanded if there is a match.
+        """Given an instruction, return the instructions to which it is expanded if there is a match.
+
         Recursively calibrate instructions, returning an error if a calibration directly or indirectly
         expands into itself.
         """
     ...
 
     def get_match_for_measurement(self, measurement: Measurement) -> Optional[MeasureCalibrationDefinition]:
-        """
-        Returns the last-specified ``MeasureCalibrationDefinition`` that matches the target
-        qubit (if any), or otherwise the last-specified one that specified no qubit.
-        """
+        """Returns the last-specified ``MeasureCalibrationDefinition`` that matches the target qubit (if any), or otherwise the last-specified one that specified no qubit."""
         ...
     def get_match_for_gate(self, gate: Gate) -> Optional[Calibration]:
-        """
-        Return the final calibration which matches the gate per the QuilT specification:
+        """Return the final calibration which matches the gate per the QuilT specification.
 
         A calibration matches a gate if:
         1. It has the same name
@@ -323,105 +295,80 @@ class CalibrationSet:
         """Returns ``True`` if the ``CalibrationSet`` contains no data."""
         ...
     def insert_calibration(self, calibration: Calibration) -> Optional[Calibration]:
-        """
-        Insert another ``Calibration`` (`DEFCAL`) to the set.
+        """Insert another ``Calibration`` (`DEFCAL`) to the set.
 
         If a calibration with the same name already exists, it is overwritten and this
         function returns the previous calibration. Otherwise, None is returned.
         """
         ...
-    def insert_measurement_calibration(self, calibration: MeasureCalibrationDefinition) -> Optional[MeasureCalibrationDefinition]:
-        """
-        Add another ``MeasureCalibrationDefinition`` (`DEFCAL MEASURE`) to the set
+    def insert_measurement_calibration(
+        self, calibration: MeasureCalibrationDefinition
+    ) -> Optional[MeasureCalibrationDefinition]:
+        """Add another ``MeasureCalibrationDefinition`` (`DEFCAL MEASURE`) to the set.
 
         If a calibration with the same name already exists, it is overwritten and this
         function returns the previous calibration. Otherwise, None is returned.
         """
     def extend(self, other: CalibrationSet):
-        """
-        Append another [`CalibrationSet`] onto this one
-        """
+        """Append another [`CalibrationSet`] onto this one."""
         ...
     def to_instructions(self):
-        """
-        Return the Quil instructions which describe the contained calibrations
-        """
+        """Return the Quil instructions which describe the contained calibrations."""
         ...
 
-
-@final
 class ScheduleSecondsItem:
-    """
-    A single item within a fixed schedule, representing a single instruction within a basic block.
-    """
+    """A single item within a fixed schedule, representing a single instruction within a basic block."""
+
     @property
     def instruction_index(self) -> int:
-        """
-        The index of the instruction within the basic block.
-        """
+        """The index of the instruction within the basic block."""
     @property
     def time_span(self) -> TimeSpanSeconds:
-        """
-        The time span during which the instruction is scheduled.
-        """
-
+        """The time span during which the instruction is scheduled."""
 
-@final
 class ControlFlowGraph:
-    """
-    Representation of a control flow graph (CFG) for a Quil program.
+    """Representation of a control flow graph (CFG) for a Quil program.
 
     The CFG is a directed graph where each node is a basic block and each edge is a control flow
     transition between two basic blocks.
     """
+    def __new__(cls, instance: "ControlFlowGraph") -> Self:
+        """Create a new instance of a `ControlFlowGraph` (or a subclass) using an existing instance."""
 
-    def has_dynamic_control_flow(self) -> bool: 
-        """
-        Return ``True`` if the program has dynamic control flow, i.e. contains a conditional branch instruction.
+    def has_dynamic_control_flow(self) -> bool:
+        """Return ``True`` if the program has dynamic control flow, i.e. contains a conditional branch instruction.
 
         ``False`` does not imply that there is only one basic block in the program. Multiple basic blocks may have
         non-conditional control flow among them, in which the execution order is deterministic and does not depend
         on program state. This may be a sequence of basic blocks with fixed `JUMP`s or without explicit terminators.
         """
-    def basic_blocks(self) -> List["BasicBlock"]: 
-        """
-        Return a list of all the basic blocks in the control flow graph, in order of definition.
-        """
+    def basic_blocks(self) -> List["BasicBlock"]:
+        """Return a list of all the basic blocks in the control flow graph, in order of definition."""
 
-@final
 class ScheduleSeconds:
     def items(self) -> List[ScheduleSecondsItem]:
-        """
-        All the items in the schedule, in unspecified order.
-        """
+        """All the items in the schedule, in unspecified order."""
     def duration(self) -> float:
-        """
-        The duration of the schedule, in seconds.
+        """The duration of the schedule, in seconds.
 
         This is the maximum of the end time of all the items.
         """
 
-@final
 class TimeSpanSeconds:
-    """
-    Representation of a time span in seconds.
-    """
+    """Representation of a time span in seconds."""
+
     @property
     def start(self) -> float:
-        """
-        The start time of the time span, in seconds.
+        """The start time of the time span, in seconds.
 
         This is relative to the start of the scheduling context (such as the basic block).
         """
     @property
     def duration(self) -> float:
-        """
-        The duration of the time span, in seconds.
-        """
+        """The duration of the time span, in seconds."""
     @property
     def end(self) -> float:
-        """
-        The end time of the time span, in seconds.
+        """The end time of the time span, in seconds.
 
         This is the sum of the start time and duration.
         """
@@ -431,38 +378,24 @@ class FrameSet:
     @staticmethod
     def __new__(cls) -> "FrameSet": ...
     def get(self, identifier: FrameIdentifier) -> Optional[Dict[str, AttributeValue]]:
-        """
-        Retrieve the attributes of a frame by its identifier
-        """
+        """Retrieve the attributes of a frame by its identifier."""
         ...
     def get_keys(self) -> List[FrameIdentifier]:
-        """
-        Return a list of all ``FrameIdentifier``s described by this ``FrameSet``
-        """
+        """Return a list of all ``FrameIdentifier``s described by this ``FrameSet``."""
         ...
     def insert(self, identifier: FrameIdentifier, attributes: Dict[str, AttributeValue]):
-        """
-        Insert a new ``FrameIdentifier``, overwriting any existing one.
-        """
+        """Insert a new ``FrameIdentifier``, overwriting any existing one."""
         ...
     def merge(self, other: FrameSet):
-        """
-        Merge another ``FrameSet`` into this one, overwriting any existing keys.
-        """
+        """Merge another ``FrameSet`` into this one, overwriting any existing keys."""
     def intersection(self, identifiers: FrozenSet[FrameIdentifier]) -> "FrameSet":
-        """
-        Return a new ``FrameSet`` which describes only the given ``FrameIdentifier``s
-        """
+        """Return a new ``FrameSet`` which describes only the given ``FrameIdentifier``s."""
         ...
     def is_empty(self) -> bool:
-        """
-        Returns ``True`` if this ``FrameSet`` defines no frames.
-        """
+        """Returns ``True`` if this ``FrameSet`` defines no frames."""
         ...
     def to_instructions(self) -> List[Instruction]:
-        """
-        Return the Quil instructions which define the contained frames.
-        """
+        """Return the Quil instructions which define the contained frames."""
         ...
     def get_all_frames(self) -> Dict[FrameIdentifier, Dict[str, AttributeValue]]: ...
 
diff --git a/quil-py/quil/validation/__init__.py b/quil-py/quil/validation/__init__.py
index bec07569..9a7d29a9 100644
--- a/quil-py/quil/validation/__init__.py
+++ b/quil-py/quil/validation/__init__.py
@@ -1,5 +1,3 @@
-"""
-The `quil.validation` module contains classes and functions that can validate
-components of a Quil program or instruction.
-"""
+"""The `quil.validation` module contains classes and functions that can validate components of a Quil program or instruction."""
+
 from quil.validation import *
diff --git a/quil-py/quil/validation/identifier.pyi b/quil-py/quil/validation/identifier.pyi
index 28ff38c7..16950278 100644
--- a/quil-py/quil/validation/identifier.pyi
+++ b/quil-py/quil/validation/identifier.pyi
@@ -4,13 +4,9 @@ class IdentifierValidationError(ValueError):
     ...
 
 def validate_identifier(ident: str):
-    """
-    Raises an ``IdentifierValidationError` if ident isn't a valid Quil identifier.
-    """
+    """Raises an ``IdentifierValidationError` if ident isn't a valid Quil identifier."""
     ...
 
 def validate_user_identifier(ident: str):
-    """
-    Raises an ``IdentifierValidationError` if ident is reserved keyword or isn't a valid Quil identifier.
-    """
+    """Raises an ``IdentifierValidationError` if ident is reserved keyword or isn't a valid Quil identifier."""
     ...
diff --git a/quil-py/src/program/analysis.rs b/quil-py/src/program/analysis.rs
index 547f294f..edb655f0 100644
--- a/quil-py/src/program/analysis.rs
+++ b/quil-py/src/program/analysis.rs
@@ -1,4 +1,4 @@
-use pyo3::exceptions::PyValueError;
+use pyo3::{exceptions::PyValueError, types::PyType};
 use quil_rs::program::analysis::{
     BasicBlock, BasicBlockOwned, BasicBlockScheduleError, ControlFlowGraph, ControlFlowGraphOwned,
     QubitGraph, QubitGraphError,
@@ -12,6 +12,7 @@ use crate::instruction::{PyInstruction, PyTarget};
 use super::{scheduling::PyScheduleSeconds, PyProgram};
 
 py_wrap_type! {
+    #[pyo3(subclass)]
     PyControlFlowGraph(ControlFlowGraphOwned) as "ControlFlowGraph"
 }
 
@@ -19,6 +20,12 @@ impl_repr!(PyControlFlowGraph);
 
 #[pymethods]
 impl PyControlFlowGraph {
+    #[new]
+    #[classmethod]
+    pub fn new(_: Py<PyType>, instance: Self) -> Self {
+        instance
+    }
+
     pub fn has_dynamic_control_flow(&self) -> bool {
         ControlFlowGraph::from(self.as_inner()).has_dynamic_control_flow()
     }
@@ -34,6 +41,7 @@ impl PyControlFlowGraph {
 }
 
 py_wrap_type! {
+    #[pyo3(subclass)]
     PyBasicBlock(BasicBlockOwned) as "BasicBlock"
 }
 impl_repr!(PyBasicBlock);
@@ -51,6 +59,12 @@ py_wrap_error!(quil, RustQubitGraphError, PyQubitGraphError, PyValueError);
 
 #[pymethods]
 impl PyBasicBlock {
+    #[new]
+    #[classmethod]
+    pub fn new(_: Py<PyType>, instance: Self) -> Self {
+        instance
+    }
+
     pub fn as_schedule_seconds(&self, program: &PyProgram) -> PyResult<PyScheduleSeconds> {
         BasicBlock::from(self.as_inner())
             .as_schedule_seconds(program.as_inner())
diff --git a/quil-py/src/program/scheduling.rs b/quil-py/src/program/scheduling.rs
index 7970a576..7b7ffc5a 100644
--- a/quil-py/src/program/scheduling.rs
+++ b/quil-py/src/program/scheduling.rs
@@ -6,6 +6,8 @@ use rigetti_pyo3::{
     impl_repr, py_wrap_error, py_wrap_type, pyo3::prelude::*, wrap_error, PyWrapper,
 };
 
+use crate::impl_eq;
+
 wrap_error!(RustComputedScheduleError(ComputedScheduleError));
 py_wrap_error!(
     quil,
@@ -14,10 +16,13 @@ py_wrap_error!(
     PyValueError
 );
 py_wrap_type! {
+    #[pyo3(subclass)]
+    #[derive(Debug, PartialEq)]
     PyScheduleSeconds(ScheduleSeconds) as "ScheduleSeconds"
 }
 
 impl_repr!(PyScheduleSeconds);
+impl_eq!(PyScheduleSeconds);
 
 #[pymethods]
 impl PyScheduleSeconds {
@@ -35,10 +40,13 @@ impl PyScheduleSeconds {
 }
 
 py_wrap_type! {
+    #[derive(Debug, PartialEq)]
+    #[pyo3(subclass)]
     PyScheduleSecondsItem(ComputedScheduleItem<Seconds>) as "ScheduleSecondsItem"
 }
 
 impl_repr!(PyScheduleSecondsItem);
+impl_eq!(PyScheduleSecondsItem);
 
 #[pymethods]
 impl PyScheduleSecondsItem {
@@ -54,10 +62,13 @@ impl PyScheduleSecondsItem {
 }
 
 py_wrap_type! {
+    #[derive(Debug, PartialEq)]
+    #[pyo3(subclass)]
     PyTimeSpanSeconds(TimeSpan<Seconds>) as "TimeSpanSeconds"
 }
 
 impl_repr!(PyTimeSpanSeconds);
+impl_eq!(PyTimeSpanSeconds);
 
 #[pymethods]
 impl PyTimeSpanSeconds {


Test patch:
diff --git a/quil-py/test/instructions/test_copy.py b/quil-py/test/instructions/test_copy.py
index 6fe6a4f8..e43ed78b 100644
--- a/quil-py/test/instructions/test_copy.py
+++ b/quil-py/test/instructions/test_copy.py
@@ -1,7 +1,17 @@
 from copy import copy, deepcopy
 
 from quil.expression import Expression
-from quil.instructions import Qubit, QubitPlaceholder, FrameIdentifier, Pulse, WaveformInvocation, Instruction, Calibration, Delay
+from quil.instructions import (
+    Calibration,
+    Delay,
+    FrameIdentifier,
+    Instruction,
+    Pulse,
+    Qubit,
+    QubitPlaceholder,
+    WaveformInvocation,
+)
+
 
 def test_instruction_with_qubit():
     frame_identifier = FrameIdentifier("frame", [Qubit.from_placeholder(QubitPlaceholder())])
@@ -18,7 +28,7 @@ def test_instruction_with_qubit():
     assert pulse_deepcopy.waveform == pulse.waveform
     assert pulse_deepcopy.frame.name == pulse.frame.name
     assert pulse_deepcopy.frame.qubits != pulse.frame.qubits
-    
+
     instruction = Instruction(pulse)
     instruction_deepcopy = deepcopy(instruction)
     assert instruction_deepcopy != instruction
@@ -28,15 +38,12 @@ def test_instruction_with_duplicate_placeholders():
     placeholder = Qubit.from_placeholder(QubitPlaceholder())
 
     calibration = Calibration(
-            "MYCAL",
-            [],
-            [placeholder],
-            [
-                Instruction.from_delay(
-                    Delay(Expression.from_number(complex(0.5)), [], [placeholder])
-                )
-            ],
-            [])
+        "MYCAL",
+        [],
+        [placeholder],
+        [Instruction.from_delay(Delay(Expression.from_number(complex(0.5)), [], [placeholder]))],
+        [],
+    )
 
     calibration_copy = copy(calibration)
     assert calibration_copy == calibration
diff --git a/quil-py/test/instructions/test_gate.py b/quil-py/test/instructions/test_gate.py
index bad69343..358fc5d0 100644
--- a/quil-py/test/instructions/test_gate.py
+++ b/quil-py/test/instructions/test_gate.py
@@ -1,5 +1,5 @@
 from quil.expression import Expression
-from quil.instructions import PauliTerm, PauliGate
+from quil.instructions import PauliGate, PauliTerm
 
 
 class TestPauliTerm:
diff --git a/quil-py/test/program/test_program.py b/quil-py/test/program/test_program.py
index ac541bfb..86f81179 100644
--- a/quil-py/test/program/test_program.py
+++ b/quil-py/test/program/test_program.py
@@ -1,11 +1,11 @@
 import pickle
-import pytest
 from typing import Optional
 
+import pytest
 from syrupy.assertion import SnapshotAssertion
 
+from quil.instructions import Gate, Instruction, Jump, Qubit, QubitPlaceholder, Target, TargetPlaceholder
 from quil.program import Program
-from quil.instructions import Instruction, QubitPlaceholder, TargetPlaceholder, Gate, Qubit, Jump, Target
 
 
 def test_pickle():
@@ -52,6 +52,7 @@ def target_resolver(target: TargetPlaceholder) -> Optional[str]:
 
     assert program.to_quil() == "H 9\nJUMP @test\n"
 
+
 def test_single_block_control_flow_analysis():
     program = Program.parse(
         """
@@ -60,19 +61,24 @@ def test_single_block_control_flow_analysis():
 CNOT 0 1
 MEASURE 0 ro[0]
 MEASURE 1 ro[1]
-""")
+"""
+    )
     assert program.get_used_qubits() == {Qubit.from_fixed(0), Qubit.from_fixed(1)}
     cfg = program.control_flow_graph()
     blocks = cfg.basic_blocks()
     assert len(blocks) == 1
-    assert blocks[0].terminator() == None
+    assert blocks[0].terminator() is None
     block_program = Program()
     block_program.add_instructions(blocks[0].instructions())
-    assert block_program.to_quil() == """H 0
+    assert (
+        block_program.to_quil()
+        == """H 0
 CNOT 0 1
 MEASURE 0 ro[0]
 MEASURE 1 ro[1]
 """
+    )
+
 
 def test_multi_block_control_flow_analysis():
     program = Program.parse(
@@ -85,7 +91,8 @@ def test_multi_block_control_flow_analysis():
 JUMP @start
 LABEL @end
 HALT
-""")
+"""
+    )
     assert program.get_used_qubits() == {Qubit.from_fixed(0)}
     cfg = program.control_flow_graph()
 
@@ -94,11 +101,9 @@ def test_multi_block_control_flow_analysis():
     blocks = cfg.basic_blocks()
     assert len(blocks) == 3
 
-def test_basic_block_fixed_schedule():
-    """
-    Test that a simple, realistic program can be scheduled as expected.
-    """
 
+def test_basic_block_fixed_schedule():
+    """Test that a simple, realistic program can be scheduled as expected."""
     program = Program.parse(
         """DEFFRAME 0 "flux_tx_cz":
     TEST: 1
@@ -138,7 +143,8 @@ def test_basic_block_fixed_schedule():
 CZ 0 1
 CZ 2 3
 CZ 0 2
-""")
+"""
+    )
     cfg = program.control_flow_graph()
     blocks = cfg.basic_blocks()
     assert len(blocks) == 1
@@ -150,7 +156,7 @@ def test_basic_block_fixed_schedule():
     # One for each CZ
     assert len(items) == 3
 
-    items = { item.instruction_index: item for item in items }
+    items = {item.instruction_index: item for item in items}
 
     # The first CZ should start at 0
     assert items[0].time_span.start == 0.0
@@ -163,6 +169,7 @@ def test_basic_block_fixed_schedule():
     assert items[0].time_span.start + items[0].time_span.duration == items[2].time_span.start
     assert items[0].time_span.duration == items[2].time_span.duration
 
+
 def test_filter_instructions(snapshot: SnapshotAssertion):
     input = """DECLARE foo REAL[1]
 DEFFRAME 1 "rx":
diff --git a/quil-py/test/test_eq.py b/quil-py/test/test_eq.py
index a02c2357..9f8f8a61 100644
--- a/quil-py/test/test_eq.py
+++ b/quil-py/test/test_eq.py
@@ -2,10 +2,11 @@
 
 import numpy as np
 
-from quil.instructions import Instruction, Gate, Qubit
 from quil.expression import Expression
+from quil.instructions import Gate, Instruction, Qubit
 from quil.program import Program
 
+
 def test_instruction_eq():
     pi_expr = Expression.from_number(complex(np.pi, 0))
 
@@ -25,6 +26,7 @@ def test_instruction_eq():
     assert rx_inst != ry_inst
     assert not (rx_inst == ry_inst)
 
+
 def test_program_eq():
     p1 = Program.parse("DECLARE ro BIT\nRX(pi) 0")
     p1_copy = deepcopy(p1)