Skip to content

Commit 080fd27

Browse files
committed
Ruff fix
1 parent 068abc8 commit 080fd27

7 files changed

Lines changed: 14 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- **API cleanup:** Streamlined and modernized the API by removing redundant and obsolete arguments, leading to a simpler and more intuitive interface.
12+
- **Codebase optimization:** Optimized internal logic and removed dead code for improved performance and maintainability.
13+
14+
### Documentation
15+
- **Improved docs:** Updated and clarified documentation throughout the project to better reflect the current API and usage patterns.
16+
17+
1018
## [1.5.0] — 2026-04-03
1119

1220
### Added

examples/demo_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def format_joined_names(values: tuple[str, ...]) -> str:
270270
def auto_save_path(*, engine: str, example: str) -> Path:
271271
return Path(".tmp") / "examples" / engine / f"{example}.png"
272272

273+
273274
def demo_runs_headless(args: ExampleCliArgs | argparse.Namespace) -> bool:
274275
return bool(getattr(args, "no_show", False) or getattr(args, "save", None) is not None)
275276

src/tensor_network_viz/_core/draw/graph_pipeline.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,7 @@ def _bundle_scheme_entries_2d(
196196
def _bundle_scheme_entries_3d(
197197
bundle: _ContractionSchemeBundle,
198198
) -> tuple[tuple[tuple[float, float, float, float, float, float], str, Any], ...]:
199-
if (
200-
bundle.artists_by_step is None
201-
or bundle.tooltips is None
202-
or bundle.scheme_aabb is None
203-
):
199+
if bundle.artists_by_step is None or bundle.tooltips is None or bundle.scheme_aabb is None:
204200
return ()
205201
out: list[tuple[tuple[float, float, float, float, float, float], str, Any]] = []
206202
for index, artist in enumerate(bundle.artists_by_step):

src/tensor_network_viz/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,5 @@ class PlotConfig:
116116
contraction_playback: bool = False
117117
contraction_scheme_cost_hover: bool = False
118118

119+
119120
__all__ = ["EngineName", "PlotConfig", "TensorLabelRefinement", "ViewName"]

src/tensor_network_viz/contraction_viewer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def _safe_set_linewidth(artist: Artist, lw: float) -> None:
168168
with suppress(AttributeError, TypeError, ValueError):
169169
setter2(lw)
170170

171+
171172
def _snapshot_style(artist: Artist) -> dict[str, Any]:
172173
snap: dict[str, Any] = {}
173174
for attr, key in (

src/tensor_network_viz/interactive_viewer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
_INTERACTIVE_CHECK_MARK_PROPS: dict[str, float] = {"s": 34.0, "linewidth": 1.0}
5555
_INTERACTIVE_RADIO_PROPS: dict[str, float] = {"s": 38.0, "linewidth": 0.9}
5656

57+
5758
@dataclass
5859
class _ViewCache:
5960
ax: RenderedAxes | None = None
@@ -65,6 +66,7 @@ def _set_artist_visible(artist: Artist, visible: bool) -> None:
6566
if callable(setter):
6667
setter(bool(visible))
6768

69+
6870
def _scene_from_axes(ax: RenderedAxes | None) -> _InteractiveSceneState | None:
6971
if ax is None:
7072
return None

tests/test_demo_cli_scheme.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
sys.path.insert(0, str(_EXAMPLES))
1313

1414
from demo_cli import ( # noqa: E402
15-
ExampleCliArgs,
1615
auto_save_path,
1716
cubic_peps_tensor_names,
1817
cumulative_prefix_contraction_scheme,

0 commit comments

Comments
 (0)