rework factories, enclosure, and cross section registration#987
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #987 +/- ##
==========================================
+ Coverage 70.96% 71.00% +0.03%
==========================================
Files 72 72
Lines 14423 14526 +103
Branches 2795 2817 +22
==========================================
+ Hits 10236 10314 +78
- Misses 3337 3347 +10
- Partials 850 865 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
1.
generic_factories— register arbitrary functions as factorieslayout.py: newKCLayout.generic_factories: dict[str, Callable[..., ProtoTKCell[Any]] | Callable[..., VKCell]], plus a@kcl.generic_factorydecorator (usable bare, withname=, or as a direct call) that registers a cell-producing function and wraps it with aguardrail raising if the returned cell's
.kclisn't this layout.tests/test_generic_factories.py: registration/delegation, the foreign-kclguardrail, custom name, and independence fromfactories/virtual_factories.2. Cross-section / enclosure rework (the bulk)
CrossSectionModelnow holds onecross_sections: dict[str, SymmetricalCrossSection | AsymmetricalCrossSection](dropped the separateasymmetrical_cross_sectionsdict). One unified_register; cross-kind name uniqueness is automatic.auto_name()and, when named, its explicit name. Existence is a singleget(auto_name()). Unnamed entries resolve to a structurally-identical named one; registering a name promotes an unnamedcanonical; a second name for one signature raises.
bbox_sectionsremoved as aSymmetricalCrossSectionfield; now a read-only property delegating to the enclosure. The enclosure's structural hash now folds inbbox_sections, soauto_name()is a complete key. Asymmetricauto_name()is now aSHA1 over its geometry.
auto_name(),__eq__, and__hash__. Re-registering the same profile with a different radius raises (override radius at routing time instead).__eq__: cross-kind comparisons returnFalse; wrapper (CrossSection/DCrossSection/asymmetric) comparisons compare bases.CrossSectionNamingConflictErrorinexceptions.py.symmetricalkwarg:get_cross_section/get_icross_section/get_dcross_sectiongainedsymmetrical: bool | None = None(replacing the oldkindliteral) —None= either kind,True= symmetric (raise otherwise),False= asymmetric (raise otherwise),via overloads.
layout.py(one loop, de-aliased viaset()),session_cache.py(split into two pkls on dump, load both back),utils/difftest.py,schematic.py(iterates all kinds; map type widened),kcell.py.3. Type / lint hygiene
decorators.py:@finalonWrappedKCellFunc/WrappedVKCellFuncsoisinstancenarrowing is clean (fixed theschematic_drivendiagnostics, removed redundant# ty: ignores).Factories.get: key widened toobjectto satisfyMapping.get's LSP contract.sym_encfactory fixture, etc.).