Skip to content

dmsh_entry.py: fix the two lint findings that fail lint-python on main - #2395

Open
SanteeMarcel wants to merge 1 commit into
seedds:mainfrom
SanteeMarcel:fix-dmsh-entry-lint
Open

SanteeMarcel wants to merge 1 commit into
seedds:mainfrom
SanteeMarcel:fix-dmsh-entry-lint

Conversation

@SanteeMarcel

Copy link
Copy Markdown

What

lint-python fails on main, and so on every pull request, with two new findings, both in dm/gfx/tools/dmsh_entry.py:

dm/gfx/tools/dmsh_entry.py:7:   ruff F401: `dmsh_fetch` imported but unused
dm/gfx/tools/dmsh_entry.py:167: pyright reportOptionalSubscript: Object of type "None" is not subscriptable
  • Line 7: the import's only use, dmsh_fetch.unguard, was removed in e45694b. The import is now import dmsh_side.
  • Line 167 (added in ccd834e): bits is a list of re.fullmatch results, and all(bits) doesn't narrow its items for pyright. The generator is now for b in bits if b. The filter is always true at that point, so the output doesn't change.

Shader chain

dmsh_entry.py is in dmsh_chain.FILES, so the chain version moves from d24f05cf9d78 to dce4e9cb5054 (dmsh_chain.py --header, committed). Each game's shaders rebuild at its next build, and the MSL comes out the same. If you'd rather fold this into your next chain change to avoid a separate rebuild, feel free to close this.

Checked

  • lint_python.py --against main with the pinned ruff 0.17.2 and pyright 1.1.414: 321 findings, all in the baseline, 0 new
  • test_nsp_chain, test_dmsh_code_fp, test_shader_rewrites, test_dmsh_layer_out, test_dmsh_abi, test_dmsh_meshstage, test_discard, test_dmsh_geometry, test_dmsh_blend_zero, test_usage

Not run

  • test_dmsh_fetch, test_dmsh_pairs, test_pso_offline: they need xcrun, and fail the same way on unmodified main on Linux
  • A shader build and regress.py: no output changes (one import removed, one always-true filter)

…h_fetch import that e45694b left unused is gone, and the float-bits walk that ccd834e added skips a missing match that all(bits) already ruled out, so pyright sees the match is not None

lint_python.py found two new findings on main, both in dmsh_entry.py: ruff F401 (`dmsh_fetch` imported but unused: its one use, dmsh_fetch.unguard, went with e45694b) and pyright reportOptionalSubscript at kinds' `b[1]` (re.fullmatch returns Optional, and all(bits) does not narrow the list's items). Every pull request's lint-python job failed on them. Now the import is `import dmsh_side` and the generator is `for b in bits if b`, a filter that is always true there. dmsh_entry.py is in dmsh_chain.FILES, so the chain version moves: d24f05cf9d78 → dce4e9cb5054 (dmsh_chain.py --header), and each game's shaders are rebuilt at its next build, with the same MSL.

Checked: lint_python.py --against main with the pinned ruff 0.17.2 and pyright 1.1.414 (321 findings, all in the baseline, 0 new); test_nsp_chain, test_dmsh_code_fp, test_shader_rewrites, test_dmsh_layer_out, test_dmsh_abi, test_dmsh_meshstage, test_discard, test_dmsh_geometry, test_dmsh_blend_zero, test_usage. Not run: test_dmsh_fetch, test_dmsh_pairs and test_pso_offline need xcrun (they fail the same way on main on Linux), a shader build, regress.py (no output changes: one import, one filter that is always true)
@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders labels Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant