Skip to content
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

🔧 Fix multiple ports bug #19

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

![logo](https://i.imgur.com/cN1ZWq8.png)

> **⚠️ Deprecation Warning:**
> **⚠️ Deprecation Warning:**
> This version of gdsfactory will only have bug fixes and minor updates. Please see [https://github.com/gdsfactory/gdsfactory](https://github.com/gdsfactory/gdsfactory) for the latest version.

gdsfactory: An open source platform for end to-end chip design and validation.
Expand Down
9 changes: 8 additions & 1 deletion gdsfactory/get_netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
get_instance_name: Callable[..., str] = get_instance_name_from_alias,
allow_multiple: bool = False,
merge_info: bool = False,
extend_recursive_port_names: bool = False,
) -> dict[str, Any]:
"""Returns instances, connections and placements from :class:`Component` as a dict.

Expand Down Expand Up @@ -144,6 +145,7 @@
allow_multiple: False to raise an error if more than two ports share the same connection. \
if True, will return key: [value] pairs with [value] a list of all connected instances.
merge_info: True to merge info and settings into the same dict.
extend_recursive_port_names: Compatibility with recursive get_netlist port name identifiers.

Returns:
Dictionary containing the following:
Expand Down Expand Up @@ -236,7 +238,12 @@
# a bit of a hack... get the top-level port for the
# ComponentArray, by our known naming convention. I hope no one
# renames these ports!
parent_port = component[top_name]
if extend_recursive_port_names:
parent_port = component[

Check warning on line 242 in gdsfactory/get_netlist.py

View check run for this annotation

Codecov / codecov/patch

gdsfactory/get_netlist.py#L242

Added line #L242 was not covered by tests
parent_port_name
] # otherwise links to non existent component ports
else:
parent_port = component[top_name]
name2port[lower_name] = parent_port
top_ports_list.add(top_name)
ports_by_type[parent_port.port_type].append(lower_name)
Expand Down
Loading