Skip to content

refactor: ruff formatting and docs - #1

Closed
DaoyiC wants to merge 6 commits into
mainfrom
dchen/ruff
Closed

DaoyiC wants to merge 6 commits into
mainfrom
dchen/ruff

Conversation

@DaoyiC

@DaoyiC DaoyiC commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

ruff format and some extra docs

DaoyiC added 4 commits July 22, 2026 10:39
- Updated type hints across multiple files to replace `List`, `Dict`, and `Tuple` with their built-in equivalents `list`, `dict`, and `tuple`.
- Cleaned up unnecessary imports and whitespace in `schedule_solver.py`, `stim_to_shatter_url.py`, `basis.py`, `cli.py`, `visualiser.py`, and various example scripts.
- Ensured consistency in type hinting for function signatures and variable declarations.
…fficiency and readability; remove obsolete visualisation file.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR primarily applies Ruff-driven formatting/type-modernization across the Python codebase and adds/adjusts documentation/comments, while also making a few small refactors in scheduling/visualisation and example CLIs.

Changes:

  • Modernize type annotations to built-in generics (e.g., list[...], dict[...]) and reformat code for consistency.
  • Tidy imports/structure and add/adjust docstrings/comments across several modules.
  • Minor refactors in tableau visualisation, memory experiment building, pruning, and surface/colour code builders (mostly readability/consistency).

Reviewed changes

Copilot reviewed 69 out of 69 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pyproject.toml Adds Ruff as a dependency; adjusts setuptools package discovery path.
examples/surface_unrotated_hex.py Reformats and modernizes typing in example CLI.
examples/surface_unrotated_grid.py Reformats and modernizes typing in example CLI.
examples/colour_square_superdense.py Reformats and modernizes typing in example CLI.
examples/colour_square_deg4.py Reformats and modernizes typing in example CLI.
examples/colour_hex_d3.py Reformats and modernizes typing in example CLI.
examples/bb144_deg5_tableau.py Reformats CLI and avoids unused variables.
examples/bb_288_hex.py Reformats and modernizes typing in example CLI.
examples/bb_288_deg5.py Reformats and modernizes typing in example CLI.
examples/bb_144_hex.py Reformats and adds a few clarifying comments.
examples/bb_144_deg5.py Reformats and modernizes typing in example CLI.
ACID/src/acid/tableau_visualiser/visualiser.py Type-modernization and formatting of tableau visualiser implementation.
ACID/src/acid/tableau_visualiser/cli.py Type-modernization and formatting of tableau visualiser CLI.
ACID/src/acid/tableau_visualiser/basis.py Type-modernization and formatting of basis helpers.
ACID/src/acid/tableau_visualiser/init.py Removes trailing whitespace/blank line.
ACID/src/acid/stim_to_shatter_url.py Import order + formatting tweaks.
ACID/src/acid/solver/prune.py Type-modernization and formatting of pruning logic.
ACID/src/acid/solver/init.py Removes trailing whitespace/blank line.
ACID/src/acid/scheduling/template_factory.py Type-modernization and formatting of template factory.
ACID/src/acid/scheduling/enumeration.py Type-modernization and import cleanup for enumeration.
ACID/src/acid/scheduling/init.py Removes trailing whitespace/blank line.
ACID/src/acid/pauli.py Type-modernization and small formatting refactors.
ACID/src/acid/memory_experiment/single_detectors.py Type-modernization and formatting of detector planning.
ACID/src/acid/memory_experiment/schedule_index.py Type-modernization and formatting of schedule indexing.
ACID/src/acid/memory_experiment/registry.py Type-modernization and formatting of detector registry.
ACID/src/acid/memory_experiment/rec_log.py Type-modernization and formatting of measurement log.
ACID/src/acid/memory_experiment/observables.py Type-modernization and formatting of observable planning.
ACID/src/acid/memory_experiment/noise.py Type-modernization and small no-op return cleanups.
ACID/src/acid/memory_experiment/experiment.py Refactors builder variable naming + type-modernization/formatting.
ACID/src/acid/memory_experiment/embedding_utils.py Type-modernization and small formatting refactors.
ACID/src/acid/memory_experiment/builder.py Type-modernization and formatting of Stim builder.
ACID/src/acid/memory_experiment/init.py Reorders exports and formatting.
ACID/src/acid/gf2_utils.py Type-modernization and formatting; updates helper naming/comments.
ACID/src/acid/gap_distance.py Type-modernization and formatting of GAP interaction.
ACID/src/acid/embedding.py Type-modernization and adds docstring to embedding class.
ACID/src/acid/device.py Type-modernization and formatting of device visualisation helpers.
ACID/src/acid/defects/quasi.py Type-modernization and adds docstring to QuasiStabiliser.
ACID/src/acid/defects/init.py Removes trailing whitespace/blank line.
ACID/src/acid/codes/toric/builder.py Type-modernization and formatting of toric builder.
ACID/src/acid/codes/toric/init.py Removes trailing whitespace/blank line.
ACID/src/acid/codes/surface/unrotated_hex.py Type-modernization, formatting, and minor logic cleanup.
ACID/src/acid/codes/surface/unrotated_grid.py Type-modernization and formatting of grid builder.
ACID/src/acid/codes/surface/unrotated_grid_square_edges.py Type-modernization and formatting of square-edges builder.
ACID/src/acid/codes/surface/init.py Removes trailing whitespace/blank line.
ACID/src/acid/codes/colour/square.py Type-modernization and formatting of colour-square builder.
ACID/src/acid/codes/colour/hex.py Type-modernization and formatting of colour-hex builder.
ACID/src/acid/codes/colour/init.py Reorders imports/exports and formatting.
ACID/src/acid/codes/bb/midcycle.py Type-modernization and added docstrings/comments.
ACID/src/acid/codes/bb/builder_deg5.py Type-modernization and formatting of deg5 builder.
ACID/src/acid/codes/bb/algebra.py Type-modernization and added docstring.
ACID/src/acid/codes/bb/init.py Removes trailing whitespace/blank line.
ACID/src/acid/base_code.py Type-modernization and formatting of base code dataclasses.
ACID/src/acid/analysis/schedule.py Type-modernization and formatting of schedule analysis.
ACID/src/acid/analysis/report.py Type-modernization and formatting of report writer.
ACID/src/acid/analysis/gauge_fix_nkd.py Type-modernization and formatting of gauge-fix analysis.
ACID/src/acid/analysis/init.py Removes trailing whitespace/blank line.
ACID/src/acid/init.py Reorders __all__ entries and formatting.
Comments suppressed due to low confidence (1)

pyproject.toml:21

  • ruff is a formatter/linter and typically not a runtime dependency of the acid package. Keeping it in [project].dependencies forces all consumers to install it even when they don't need formatting tooling; consider moving it to an optional "dev" extra (or removing it from runtime dependencies entirely).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +137 to +139
sections: list[
tuple[CommutingPauliBasis, AntiCommutingPauliBasis], list[int]
] = []
Comment thread ACID/src/acid/codes/colour/hex.py
Comment thread ACID/src/acid/device.py Outdated
Comment thread ACID/src/acid/codes/bb/algebra.py Outdated
Comment thread ACID/src/acid/memory_experiment/single_detectors.py Outdated
@DaoyiC DaoyiC closed this Jul 30, 2026
@DaoyiC
DaoyiC deleted the dchen/ruff branch July 30, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants