From b919927ee34164280bbfeaf44f2721c1318207dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Apr 2022 11:49:10 +0000 Subject: [PATCH 1/2] Bump rich from 12.0.0 to 12.2.0 Bumps [rich](https://github.com/willmcgugan/rich) from 12.0.0 to 12.2.0. - [Release notes](https://github.com/willmcgugan/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/willmcgugan/rich/compare/v12.0.0...v12.2.0) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index 1e695d1e78..645075fcf4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -20,7 +20,7 @@ pyshp==2.2.0 raven==6.10.0 requests==2.27.1 retry==0.9.2 -rich==12.0.0 +rich==12.2.0 rtree==0.9.7 boto==2.49.0 boto3==1.21.38 From d00df3ee7d35a463d12825a4dc8b7306f5944ad0 Mon Sep 17 00:00:00 2001 From: GeoWill Date: Wed, 13 Apr 2022 12:53:31 +0100 Subject: [PATCH 2/2] Adapt to change in rich.console.capture behaviour --- polling_stations/apps/data_importers/base_importers.py | 6 +----- .../apps/data_importers/data_quality_report.py | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/polling_stations/apps/data_importers/base_importers.py b/polling_stations/apps/data_importers/base_importers.py index b37b128da1..decc20a207 100644 --- a/polling_stations/apps/data_importers/base_importers.py +++ b/polling_stations/apps/data_importers/base_importers.py @@ -166,16 +166,12 @@ def report(self): # save a static copy in the DB that we can serve up on the website record = DataQuality.objects.get_or_create(council_id=self.council.pk) - record[0].report = report.generate_string_report() record[0].num_stations = station_report.get_stations_imported() record[0].num_districts = district_report.get_districts_imported() record[0].num_addresses = address_report.get_addresses_with_station_id() - + record[0].report = report.generate_string_report() record[0].save() - # output to console - report.output_console_report() - @property def data_path(self): if getattr(settings, "PRIVATE_DATA_PATH", None): diff --git a/polling_stations/apps/data_importers/data_quality_report.py b/polling_stations/apps/data_importers/data_quality_report.py index 65e14260ef..ee0c8100ba 100644 --- a/polling_stations/apps/data_importers/data_quality_report.py +++ b/polling_stations/apps/data_importers/data_quality_report.py @@ -484,12 +484,7 @@ def build_report(self): self.report.add_row(self.build_station_report()) self.report.add_row(self.build_address_report()) - def output_console_report(self): - console = Console() - console.print(self.report) - def generate_string_report(self): recorder = Console(record=True) - with recorder.capture(): - recorder.print(self.report) + recorder.print(self.report) return recorder.export_text()