From 9a39e286a7f88d6d8ae944dda428e87ca2910451 Mon Sep 17 00:00:00 2001 From: Olivier Charvin Date: Wed, 18 Oct 2023 09:31:32 +0200 Subject: [PATCH 1/2] blocks2assets: debug filepath on reading unsupported blocks --- blender_asset_tracer/trace/blocks2assets.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blender_asset_tracer/trace/blocks2assets.py b/blender_asset_tracer/trace/blocks2assets.py index 3dd43c9..8dc1cef 100644 --- a/blender_asset_tracer/trace/blocks2assets.py +++ b/blender_asset_tracer/trace/blocks2assets.py @@ -45,7 +45,16 @@ def iter_assets(block: blendfile.BlendFileBlock) -> typing.Iterator[result.Block block_reader = _funcs_for_code[block.code] except KeyError: if block.code not in _warned_about_types: - log.debug("No reader implemented for block type %r", block.code.decode()) + blocktype = block.code.decode() + filepath = block.get(b"filepath", "", as_str=True) + if filepath: + log.debug( + "No reader implemented for block type %r: %s", + blocktype, + filepath, + ) + else: + log.debug("No reader implemented for block type %r", blocktype) _warned_about_types.add(block.code) return -- 2.30.2 From 589dbd67525a30410671933e56ea04e364581395 Mon Sep 17 00:00:00 2001 From: Olivier Charvin Date: Fri, 15 Dec 2023 10:05:05 +0100 Subject: [PATCH 2/2] reduce indentation --- blender_asset_tracer/trace/blocks2assets.py | 26 +++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/blender_asset_tracer/trace/blocks2assets.py b/blender_asset_tracer/trace/blocks2assets.py index 8dc1cef..be20258 100644 --- a/blender_asset_tracer/trace/blocks2assets.py +++ b/blender_asset_tracer/trace/blocks2assets.py @@ -44,18 +44,20 @@ def iter_assets(block: blendfile.BlendFileBlock) -> typing.Iterator[result.Block try: block_reader = _funcs_for_code[block.code] except KeyError: - if block.code not in _warned_about_types: - blocktype = block.code.decode() - filepath = block.get(b"filepath", "", as_str=True) - if filepath: - log.debug( - "No reader implemented for block type %r: %s", - blocktype, - filepath, - ) - else: - log.debug("No reader implemented for block type %r", blocktype) - _warned_about_types.add(block.code) + if block.code in _warned_about_types: + return + + blocktype = block.code.decode() + filepath = block.get(b"filepath", "", as_str=True) + if filepath: + log.debug( + "No reader implemented for block type %r (filepath=%r)", + blocktype, + filepath, + ) + else: + log.debug("No reader implemented for block type %r", blocktype) + _warned_about_types.add(block.code) return log.debug("Tracing block %r", block) -- 2.30.2