Make Data.__dtype__ delegate to Data.__clstype__#1526
Open
daniel-locatelli wants to merge 2 commits into
Open
Conversation
Both computed the identical dtype string with duplicated format expressions. __clstype__ is now the single source of truth; the instance-level property delegates to it (a classmethod accessed via an instance binds type(self), so subclasses resolve correctly). Facade classes (Brep, NurbsCurve, NurbsSurface) keep their own __dtype__ overrides, which shadow the base property, so backend-pinning behaviour is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Data.__dtype__(property) andData.__clstype__(classmethod) computed the identical dtype string with two duplicated format expressions. This makes__clstype__the single source of truth and lets the instance-level property delegate to it:No behavior change — a classmethod accessed through an instance binds
type(self), so subclasses resolve exactly as before.Why it is safe for the plugin facades
Brep,NurbsCurve, andNurbsSurfaceoverride__dtype__to pin the facade dtype (so backend instances likeRhinoBrep/OCCBrepnever leakcompas_rhino/compas_occinto serialized files). Those overrides shadow the base property through the MRO, so the delegation inDatais never consulted for them. Verified on real backend instances in both Rhino 8 (ScriptEditor + Rhino.Inside:RhinoBrep,RhinoNurbsCurve) and OCC (conda pythonocc-core 7.9.3:OCCBrep,OCCNurbsCurve) — dtypes stay pinned and round-trips re-materialize the backend classes.Verification
invoke test): green on Windows/CPython 3.12 (the twotests/compas/rpctests pass once the venv has acompas_bootstrapper.py; see note below).ironpython.ymlCI job replicated locally): 834 passed, 0 failed.Notes
no changeloglabel applied (or to add an entry if preferred).pip install -edev venv on Windows,compas._os.select_python()resolves to the global interpreter (nocompas_bootstrapper.py), which makes the RPC tests fail out of the box. Can open a separate issue if there is interest.🤖 Generated with Claude Code