From 7fdfb9622015243e213e708450bffe03d610b962 Mon Sep 17 00:00:00 2001 From: Lumen <2166510752@qq.com> Date: Fri, 25 Sep 2026 17:05:22 +0800 Subject: [PATCH] Fix two files that do not parse Both were found while reading through the code base and trying to bring the package up so the inference path could be followed end to end: `import ffn.inference.inference` failed with an IndentationError. Two files on master do not compile, and between them they make most of the package unimportable. ffn/training/tracker.py: 9af8e87 wrapped the font used to annotate the eval image summaries in a try/except, but the call in the try body was left commented out, so the block ended up empty. Anything that imports this file fails, which reaches the inference core through inference -> movement -> training.examples -> training.tracker. ffn/input/volume.py: 8c7fcb6 renamed config.sampling.bbox to config.sampling.bounding_boxes without re-indenting the block, leaving the `if` with no body. For tracker.py, the except clause catches (IOError, ValueError), which is the documented exception contract of PIL.ImageFont.truetype (OSError: the font file could not be read; ValueError: the size is not positive), so the line that was commented out loaded a specific font file. Neither that file nor its size can be recovered from the repository, which ships no font, so the fallback the except branch already used is kept. ImageDraw.text falls back to the same load_default() when handed no font, so rendering is unchanged. --- ffn/input/volume.py | 2 +- ffn/training/tracker.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ffn/input/volume.py b/ffn/input/volume.py index c6d0539..c51ed94 100644 --- a/ffn/input/volume.py +++ b/ffn/input/volume.py @@ -280,7 +280,7 @@ def sample_coordinates( 'coord': [1, 3] XYZ int64 array 'volname': [1] string array """ - if config.sampling.bounding_boxes: + if config.sampling.bounding_boxes: boxes_cfg = [] volume_names = [] # Compile boxes and volumes strings. diff --git a/ffn/training/tracker.py b/ffn/training/tracker.py index 648b671..ec6b9d7 100644 --- a/ffn/training/tracker.py +++ b/ffn/training/tracker.py @@ -232,11 +232,7 @@ def slice_image( text += f'\n{volume_name}' - try: - - # font = PIL.ImageFont.load_default() - except (IOError, ValueError): - font = PIL.ImageFont.load_default() + font = PIL.ImageFont.load_default() draw.text((1, 1), text, fill='rgb(255,64,64)', font=font) del draw