From 932283be65d16bb78fe65d305ddfa2e71360ae5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 27 Jul 2021 16:38:07 +0200 Subject: [PATCH] Warn when expander yields blocks that are known to be ignored This is just a debugging tool, if this warning occurs it's an indication of a bug in BAT. --- blender_asset_tracer/trace/expanders.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/blender_asset_tracer/trace/expanders.py b/blender_asset_tracer/trace/expanders.py index 922a10a..bce34c0 100644 --- a/blender_asset_tracer/trace/expanders.py +++ b/blender_asset_tracer/trace/expanders.py @@ -49,9 +49,17 @@ def expand_block( return log.debug("Expanding block %r", block) - # Filter out falsy blocks, i.e. None values. - # Allowing expanders to yield None makes them more consise. - yield from filter(None, expander(block)) + for dependency in expander(block): + if not dependency: + # Filter out falsy blocks, i.e. None values. + # Allowing expanders to yield None makes them more consise. + continue + if dependency.code == b"DATA": + log.warn( + "expander yielded block %s which will be ignored in later iteration", + dependency, + ) + yield dependency def dna_code(block_code: str):