From e1afa45b669d65da75e250a0d270ce3c42fd04c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 7 Jan 2026 17:09:06 +0000 Subject: [PATCH] Address code review feedback: remove unused code and fix imports Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com> --- .../tests/test_warsaw_districts_anki.py | 5 +--- .../warsaw_districts/warsaw_districts_anki.py | 23 ------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/python_pkg/warsaw_districts/tests/test_warsaw_districts_anki.py b/python_pkg/warsaw_districts/tests/test_warsaw_districts_anki.py index 156073b..9a276d5 100644 --- a/python_pkg/warsaw_districts/tests/test_warsaw_districts_anki.py +++ b/python_pkg/warsaw_districts/tests/test_warsaw_districts_anki.py @@ -4,6 +4,7 @@ from __future__ import annotations from pathlib import Path +import matplotlib.pyplot as plt import pytest try: @@ -71,14 +72,10 @@ class TestCreateDistrictMap: fig = create_district_map(district) assert fig is not None # Clean up - import matplotlib.pyplot as plt - plt.close(fig) def test_creates_figure_for_all_districts(self) -> None: """Test that we can create maps for all districts.""" - import matplotlib.pyplot as plt - for district in WARSAW_DISTRICTS: fig = create_district_map(district) assert fig is not None diff --git a/python_pkg/warsaw_districts/warsaw_districts_anki.py b/python_pkg/warsaw_districts/warsaw_districts_anki.py index af3a279..2b0a120 100755 --- a/python_pkg/warsaw_districts/warsaw_districts_anki.py +++ b/python_pkg/warsaw_districts/warsaw_districts_anki.py @@ -22,8 +22,6 @@ Output: from __future__ import annotations import argparse -import base64 -from io import BytesIO from pathlib import Path import sys from typing import TYPE_CHECKING, NamedTuple @@ -136,27 +134,6 @@ def create_district_map(district: District, *, highlight_only: bool = True) -> F return fig -def generate_district_image_base64(district: District) -> str: - """Generate a base64-encoded PNG image of the district map. - - Args: - district: The district to visualize. - - Returns: - Base64-encoded PNG image string. - """ - fig = create_district_map(district) - - # Save to bytes buffer - buf = BytesIO() - fig.savefig(buf, format="png", bbox_inches="tight", dpi=150) - plt.close(fig) - buf.seek(0) - - # Encode to base64 - return base64.b64encode(buf.read()).decode("utf-8") - - def save_district_image(district: District, output_dir: Path) -> Path: """Save a district map image to a file.