-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a function for get_component
#625
Conversation
Reviewer's Guide by SourceryThis pull request introduces a new Updated class diagram for KCLayout with get_component functionclassDiagram
class KCLayout {
+get_component(spec: KCellSpec, output_type: type[K], cell_kwargs: Any) K
+get_component(spec: int) KCell
+get_component(spec: str, cell_kwargs: Any) ProtoTKCell[Any]
+get_component(spec: Callable[..., K], cell_kwargs: Any) K
+get_component(spec: K) K
}
class KCellSpecDict {
+component: str
+settings: dict[str, Any]
}
class ProtoTKCell {
<<interface>>
}
KCLayout --> ProtoTKCell
KCLayout --> KCellSpecDict
KCellSpec : int | str | KCellSpecDict | ProtoTKCell[Any] | Callable[..., ProtoTKCell[Any]]
KCLayout : KCellSpec
Updated class diagram for KCellSpec and related typesclassDiagram
class KCellSpec {
<<TypeAlias>>
int | str | KCellSpecDict | ProtoTKCell[Any] | Callable[..., ProtoTKCell[Any]]
}
class KCellSpecDict {
+component: str
+settings: NotRequired[dict[str, Any]]
}
class ProtoTKCell {
<<interface>>
}
KCellSpec --> KCellSpecDict
KCellSpec --> ProtoTKCell
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
==========================================
+ Coverage 65.89% 65.97% +0.08%
==========================================
Files 64 64
Lines 9713 9732 +19
Branches 1811 1816 +5
==========================================
+ Hits 6400 6421 +21
Misses 2782 2782
+ Partials 531 529 -2 ☔ View full report in Codecov by Sentry. |
…into add-get-component
Adds a very similar to gdsfactory's
get_component
function toKCLayout
. This will look in the factories or return accordingly either a KCell (in case of int or whatever the functions wants).Also allows direct casting to other classes based on
ProtoTKCell[Any]
.@joamatab does gdsfactory's
get_component
have a different function for the all angle functions or how is that handled?\cc @flaport
Summary by Sourcery
Add a
get_component
function toKCLayout
to retrieve components using various specifications and support direct casting to other classes. Include tests to validate the function's behavior and error handling.New Features:
get_component
function inKCLayout
that retrieves components based on various specifications, including integers, strings, callable functions, and dictionaries.Enhancements:
ProtoTKCell[Any]
within theget_component
function.Tests:
get_component
function to verify its behavior with different input types and ensure it raises errors appropriately.