From d27ab2d6b9b99b9926291b3aa37f8b0fcf030452 Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 02:50:47 +0200 Subject: [PATCH 1/7] refactor(optimizer): replace with utilo code --- letty/optimizer.py | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/letty/optimizer.py b/letty/optimizer.py index 0981af22..bb14c9d1 100644 --- a/letty/optimizer.py +++ b/letty/optimizer.py @@ -10,7 +10,6 @@ import collections import concurrent import itertools -import math import os import sys @@ -99,10 +98,10 @@ def strategy( lines: int = 1, boxes: int = 1, ): - boxes_flow = ranges(0.5, 1.0, boxes) - char_margin = ranges(0.5, 20.0, chars) - line_margin = ranges(0.01, 5.0, lines) - word_margin = ranges(1.5, 5.0, words) + boxes_flow = utilo.ranged_exp(0.5, 1.0, boxes) + char_margin = utilo.ranged_exp(0.5, 20.0, chars) + line_margin = utilo.ranged_exp(0.01, 5.0, lines) + word_margin = utilo.ranged_exp(1.5, 5.0, words) result = [] for char, word, box, line, in itertools.product( char_margin, @@ -117,22 +116,3 @@ def strategy( 'line_margin': line, }) return result - - -# TODO: REPLACE WITH utilo CODE -def ranges(mini: float, maxi: float, steps: int = 15): - """Compute parameter. - - >>> utilo.roundme(ranges(0.1, 100, steps=10)) - [0.1, 0.12, 0.18, 0.34, 0.76, 1.92, 5.06, 13.61, 36.84, 99.99] - >>> utilo.roundme(ranges(0.1, 20, steps=5)) - [0.1, 0.73, 2.43, 7.06, 19.64] - """ - func = math.exp - maxed = func(steps - 1) / (maxi - mini) - result = [] - for index in range(steps): - value = mini + (math.exp(index) - 1) / maxed - value = utilo.roundme(value, digits=5) # pylint:disable=R0204 - result.append(value) - return result From 19915dabd9c2c265a0e32c26bb97e14a6ec24ccc Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 02:52:42 +0200 Subject: [PATCH 2/7] refactor(cli): replace with utilo code --- rawmaker/cli_automate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rawmaker/cli_automate.py b/rawmaker/cli_automate.py index f3b62dc4..da6752f6 100644 --- a/rawmaker/cli_automate.py +++ b/rawmaker/cli_automate.py @@ -12,7 +12,6 @@ import sys import utilo -import utilotest DESCRIPTION = """\ Collect pdf files of defined folders and use them to run rawmaker. @@ -60,7 +59,7 @@ def run(inpath: str, outpath: str, cores: int = 1): _, name = os.path.split(item) # use quotation marks to encapsulate file path white spaces item = f'"{item}"' if ' ' in str(item) else item - name = utilotest.simple(name) # TODO: REPLACE WITH utilo CODE + name = utilo.simple(name) out = os.path.join(outpath, name) cmd = f'rawmaker -i {item} -o {out} -j4' cmds.append(cmd) From 6d047716522a35136b4b41509c3aa88b91385f2c Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 02:54:19 +0200 Subject: [PATCH 3/7] refactor(reader): replace with utilo code --- rawmaker/reader.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rawmaker/reader.py b/rawmaker/reader.py index 6bd6b8ed..0f696c24 100644 --- a/rawmaker/reader.py +++ b/rawmaker/reader.py @@ -44,9 +44,8 @@ def read(path: str, password: str = None, verify: bool = True) -> PDFDocument: if verify: header = open(path, 'rb').read(5) if header != b'%PDF-': - # TODO: MOVE TO def before() method after upgrading utilo - utilo.error('invalid pdf header') - sys.exit(1) + # TODO: MOVE TO def before() method after upgrading utilo ? + utilo.exitx('invalid pdf header') with open(path, 'rb') as fp: # Create a PDF parser object associated with the file object. parser = PDFParser(fp) From a1c980c44254b94f31b33d4e2763d51e706d22df Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 03:02:17 +0200 Subject: [PATCH 4/7] refactor(test): replace with utilo code --- tests/spacestation_/test_worddist.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/spacestation_/test_worddist.py b/tests/spacestation_/test_worddist.py index 98dc730b..40dbe023 100644 --- a/tests/spacestation_/test_worddist.py +++ b/tests/spacestation_/test_worddist.py @@ -30,5 +30,4 @@ def test_worddist(source, pages, expected, td, mp): loaded = serializeraw.load_document_worddist(td.tmpdir) # verify fontsize, chardist = expected - # TODO: REPLACE WITH VERY NEAR assert utilo.near(loaded.mean[fontsize], chardist, diff=0.01), str(loaded) From 10da4057ff3b31f2706255682f998569926d6882 Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 03:07:33 +0200 Subject: [PATCH 5/7] refactor(test): simplify code --- tests/test_horizontals.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_horizontals.py b/tests/test_horizontals.py index c6c77682..2d06bbfb 100644 --- a/tests/test_horizontals.py +++ b/tests/test_horizontals.py @@ -88,9 +88,7 @@ def test_lines_master099c(td, mp): cmd = f'-i {hoverpower.MASTER099C_PDF} --pages=7,8,9,10,80,81,82 --line --horizontals' tests.run(cmd, mp=mp) lines = serializeraw.load_horizontals(td.tmpdir) - boundings = [] - for page in lines: - boundings.append((page.page, page.content[0].box[3])) + boundings = [(page.page, page.content[0].box[3]) for page in lines] # page, horizontal y1 bounding expected = [ (7, 618.6), From 57bbc47dee423483b1d714d362fbf00b77424e2c Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 16:00:42 +0200 Subject: [PATCH 6/7] chore(requirements): upgrade pyproject.toml --- pyproject.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1b0e5f70..b8ddbb7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,10 +8,10 @@ authors = [ ] dependencies = [ "pdfminer.six>=20260107,<20270000", - "pillow>=12.2.0,<13.0.0", - "utilo>=2.105.0,<3.0.0", + "pillow>=12.3.0,<13.0.0", + "utilo>=2.109.0,<3.0.0", "configos>=1.0.4,<2.0.0", - "iamraw>=4.91.0,<5.0.0", + "iamraw>=4.91.7,<5.0.0", "protoerror>=3.20.2,<4.0.0", "ughost>=1.0.1,<2.0.0", "pdflog>=1.0.2,<2.0.0", @@ -33,10 +33,10 @@ content-type = "text/markdown" [project.optional-dependencies] dev = [ - "hoverpower>=1.1.0,<2.0.0", - "jamer>=1.0.1,<2.0.0", - "utilotest>=1.0.2,<2.0.0", - "gennex>=1.0.1,<2.0.0", + "hoverpower>=1.5.1,<2.0.0", + "jamer>=1.0.2,<2.0.0", + "utilotest>=1.0.4,<2.0.0", + "gennex>=1.0.3,<2.0.0", "yamlfix>=1.19.1,<2.0.0", ] table = [ From ea0d0c253f85d657347754b32747aeb01e5790ff Mon Sep 17 00:00:00 2001 From: Helmut Konrad Schewe Date: Thu, 2 Jul 2026 23:15:32 +0200 Subject: [PATCH 7/7] chore(release): skip release if already done --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 558551d2..b16b0493 100644 --- a/Makefile +++ b/Makefile @@ -56,8 +56,12 @@ docker-decrypt: docker-build "powerdownload && powerdecrypt" docker-release: docker-build - docker run\ - -v $(CURDIR):/var/workdir\ - -e GH_TOKEN=$(GH_TOKEN)\ - $(IMAGE_NAME)\ - "baw release --no_test --no_linter" + @if git describe --exact-match --tags HEAD >/dev/null 2>&1; then\ + echo "Current commit is already tagged. Skipping release.";\ + else \ + docker run\ + -v $(CURDIR):/var/workdir\ + -e GH_TOKEN=$(GH_TOKEN)\ + $(IMAGE)\ + "baw release --no_test --no_linter";\ + fi