Repository navigation
Python: count decorators into the function hit_vector (struct_decorators) (#8857) - #8920
Merged
Merged
Conversation
…ors) (#8857) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
Contributor
|
No description provided. |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
|
No description provided. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8857
What changed
A Python function's
hit_vectoris bisected from the spatial map between thedefand the end of the body, so the@decoratorlines above thedefwere never counted:struct_decoratorswas 0 for every Python function whiledecorated_bywas filled. Thedecorator_edgespass (Python, embedded_python) already finds the decorator lines; it now also writeshit_vector["decorators"] = len(decorators)(key only when non-empty).keyword_densityis unchanged.Tests:
tests/extraction/languages/test_python_decorators.py(single,property, stacked and multi-line call, undecorated has no key, embedded_python).Why the golden output changed
Function archetype distribution moves because
log_density_struct_decoratorsis now non-zero for decorated Python functions: "Annotated & Test Methods" 892 -> 1566 functions, with small shifts in neighbouring archetypes and file composition. Per-file Python hit vectors and the repository fingerprint move accordingly. Both fixtures re-blessed withgolden-lock.sh crucible_check.py --update --yes.Class sweep
Class: a function's hit_vector misses decorator/annotation lines that sit above the function start offset.
@Input() f()in a class gives nodecoratorshit); JavaScript and the other languages with adecoratorsrule were not probed. No burned estate needs it.Gates
audit_check.pyall clear;ruff format/ruff checkclean on changed lines; python/embedded_python/tools_recorders tests 808 passed. No regex changed, so no new regex CPU cost. Rosetta not run locally.🤖 Generated with Claude Code