mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1553] character_textures: fix None/zero/dict-param classification, unknown_slots count, and atomic I/O (CHARACTER-TEXTURES-CLASSIFICATION-AND-IO) #1578
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1578
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1553
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/character-textures-classification-io📝 Commits (1)
896fe7acharacter_textures: fix None/zero/dict-param classification, unknown_slots count, and atomic I/O📊 Changes
2 files changed (+113 additions, -16 deletions)
View changed files
📝
tests/test_character_textures.py(+63 -0)📝
tools/character_textures.py(+50 -16)📄 Description
What
Fix four classification/summary bugs and harden
--json/--csvI/O intools/character_textures.py:"None"(_texture_name):Noneentry),_first(...)returnedNoneand_texture_name(None)ranstr(None)->"None"instead of"-". Return"-"whenvalue is None.0discarded (classify_material):_first()explicitly preserves0andFalseas values, not gaps, but_first(material, MATERIAL_NAME_KEYS) or f"material[{index}]"discarded0and renamed it to"material[0]". Checkis not Nonebefore falling back.Texturesclobbered explicit lowercaseparam/slot/hash(texture_bindings):binding.setdefault("Param", slot)inserted"Param"(which precedes"param"/"slot"/"hash"inPARAM_KEYS) even when the entry dict already carried a lowercase slot key, overwriting the entry's own slot with the outer dict key. Only set"Param"when_first(binding, PARAM_KEYS) is None.summary["unknown_slots"]missed bindings without a validParam(build_report):b["role"].startswith("unknown 0x")skipped bindings with missing/malformedParam(role == "unknown"). Count both"unknown"and"unknown 0x...".--json/--csvvalidation & atomic writes (write_json,write_csv,main):--json/--csvpaths viaparser.error(...)instead of silently ignoring""or creating a whitespace-named file (" ").allow_nan=False, trailing"\n") and CSV (newline="") atomically through sibling temp files withfile_mode.published_modeandreplace_retry.replace, preserving existing files on failure.argv=Noneinmain(argv=None).Claimed in the coordination issue as
CHARACTER-TEXTURES-CLASSIFICATION-AND-IO— verified 0 open PRs and 0 prior claims; unable to post a comment on#14because GitHub disabled commenting once#14reached its 2,500-comment cap (and no successor"Coordinating who works on what"issue is open yet).Testing
python3 -I -W error tests/test_character_textures.py -v: 18/18 OK (including 3 new regression tests).python3 -I tests/test_text_write_line_endings.py: 3/3 OK.python3 -I scripts/check_no_game_data.py tools/character_textures.py tests/test_character_textures.py: clean.python3 -m compileall -q tools/character_textures.py tests/test_character_textures.py: clean.Mutation check against unpatched
main:tools/character_textures.py: all 3 new tests fail onmain(FAILED (failures=6, errors=1)).AI-assisted: yes
GPUs tested: none (CPU-only JSON/CSV texture classification tests on macOS; no GPU or game files needed)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.