Fix pycroscope findings - #83
Merged
Merged
Conversation
Tighten typing around applicator helpers, protocol fixtures, lint helpers, and ADT fields so the current pycroscope main branch checks the taxonomy package cleanly. Also fix duplicate detection for parameterless classification-entry tags and add a regression test.
JelleZijlstra
commented
Aug 13, 2026
| model: type[BaseModel], values: Mapping[str, object] | ||
| ) -> BaseModel: | ||
| obj = model.virtual(**values) | ||
| obj = cast(Location, model.virtual(**values)) |
Owner
Author
There was a problem hiding this comment.
This cast seems wrong, should this be refactored to always only return a Location, or maybe do an isinstance check before appending to created?
| model: type[BaseModel], values: Mapping[str, object] | ||
| ) -> BaseModel: | ||
| obj = model.virtual(**values) | ||
| obj = cast(Location, model.virtual(**values)) |
| def test_take_over_name_issue_uses_explicit_fields_and_tag_removal() -> None: | ||
| citation = SimpleNamespace( | ||
| parent=None, author_tags=("Author",), year="1900", issupplement=lambda: False | ||
| citation = cast( |
Owner
Author
There was a problem hiding this comment.
Can this use a virtual Article object instead of SimpleNamespace?
Use runtime narrowing in the generic applicator tests, replace the dynamic article fixture with a virtual model, and link the two upstream pycroscope issues from their narrow workarounds.
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.
Summary
TypeVaridentities to the same class type parameterAuxiliaryNameandOriginalCitationADT tags, whose constructors are singleton values rather than classesRoot cause
Most findings came from dynamic
SimpleNamespacefixtures or runtime invariants that were not made explicit to the checker. The duplicate-tag bug was separate:check_tags()countstype(tag), but looked up the two parameterless ADT variants by singleton value, so their duplicate counts always appeared as zero.Validation
taxonomy/tree checks cleanly with the pycroscope PR headThe PR's pycroscope and lint workflows now pass. The test workflow still reproduces the missing-configuration failures already present on
masterat the base commit.