-
Notifications
You must be signed in to change notification settings - Fork 30
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
Update gdsfactory #495
Update gdsfactory #495
Conversation
Reviewer's Guide by SourceryThis pull request updates the codebase to be compatible with the latest version of gdsfactory. The main changes focus on improving type hints, docstring formatting, and code style to align with modern Python practices and the latest gdsfactory requirements. Updated class diagram for sprocess.pyclassDiagram
class Sprocess {
+initialize_sprocess(component, waferstack, layermap, xsection_bounds: tuple[tuple[float, float], tuple[float, float]] | None, u_offset: float, round_tol: int, simplify_tol: float, initial_z_resolutions: Dict, initial_xy_resolution: float | None, extra_resolution_str: str | None)
+write_sprocess(component, waferstack, layermap, process, xsection_bounds: tuple[tuple[float, float], tuple[float, float]] | None, u_offset: float, init_tdr: str | None, save_directory: Path | None, execution_directory: Path | None, filename: str, struct_prefix: str, structout: str | None, split_steps: bool, init_lines: str, initial_z_resolutions: Dict, initial_xy_resolution: float | None, extra_resolution_str: str | None, global_process_remeshing_str: str, global_device_remeshing_str: str, num_threads: int, contact_str: str, device_remesh: bool) -> None
}
Updated class diagram for spice_to_yaml.pyclassDiagram
class SpiceToYaml {
+spice_to_yaml(netlist_path: str, mapping_path: str, picyaml_path: str, pdk: str, mode: str) -> None
+cli(netlist_path: str, mode: str, picyaml_path: str) -> None
+get_netlists(netlist_path: str, mapping_path: str, pdk: str, ignore_electrical: bool, map_flag: str, ignored_info: tuple[str, ...]) -> list
}
Updated class diagram for uz_xsection_mesh.pyclassDiagram
class UzXsectionMesh {
+get_u_bounds_polygons(polygons, xsection_bounds: tuple[tuple[float, float], tuple[float, float]], u_offset: float)
+get_u_bounds_layers(layer_polygons_dict: dict[tuple(str, str, str), MultiPolygon], xsection_bounds: tuple[tuple[float, float], tuple[float, float]])
+get_uz_bounds_layers(layer_polygons_dict, xsection_bounds: tuple[tuple[float, float], tuple[float, float]], layer_stack: LayerStack, u_offset: float, z_bounds: tuple[float, float] | None)
}
Updated class diagram for xyz_mesh.pyclassDiagram
class XyzMesh {
+define_prisms(layer_polygons_dict: dict, layer_stack: LayerStack, model: Model, resolutions: dict, scale_factor: float)
+xyz_mesh(component, layer_stack, layer_physical_map, layer_meshbool_map, resolutions, default_characteristic_length: float, background_tag: str, background_padding: tuple, background_mesh_order: int, global_scaling: float, global_scaling_premesh: float, global_2D_algorithm: str, global_3D_algorithm: str, filename: str, verbosity: int, round_tol: int, simplify_tol: float, n_threads: int, port_names: list[str] | None, edge_ports: list[str] | None, gmsh_version: float | None, layer_port_delimiter: str | None, background_remeshing_file: Path | None, optimization_flags: tuple[tuple[str, int]] | None) -> bool
}
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.
@@ -130,8 +129,7 @@ def report_pathlengths( | |||
|
|||
|
|||
def get_paths(pathlength_graph: nx.Graph) -> list[dict[str, Any]]: |
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.
issue (code-quality): Low code quality found in get_paths - 10% (low-code-quality
)
Explanation
The quality score for this function is below the quality threshold of 25%.This score is a combination of the method length, cognitive complexity and working memory.
How can you solve this?
It might be worth refactoring this function to make it shorter and more readable.
- Reduce the function length by extracting pieces of functionality out into
their own functions. This is the most important thing you can do - ideally a
function should be less than 10 lines. - Reduce nesting, perhaps by introducing guard clauses to return early.
- Ensure that variables are tightly scoped, so that code using related concepts
sits together within the function rather than being scattered.
@@ -34,7 +34,7 @@ def initialize_sde( | |||
component, |
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.
issue (code-quality): We've found these issues:
- Move assignment closer to its usage within a block (
move-assign-in-block
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
) - Replace assignment and augmented assignment with single assignment (
merge-assign-and-aug-assign
)
@@ -661,7 +655,7 @@ def get_var_name(string: str): | |||
|
|||
|
|||
def group_instance_str(netlist: str) -> list: | |||
"""Group instance SPICE strings if they are extended by '+' and filter away lines that do not have params | |||
"""Group instance SPICE strings if they are extended by '+' and filter away lines that do not have params. |
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.
issue (code-quality): We've found these issues:
- Replace assignment with augmented assignment [×2] (
aug-assign
) - Convert for loop into list comprehension (
list-comprehension
) - Inline variable that is immediately returned (
inline-immediately-returned-variable
)
make it compatible with latest gdsfactory
Summary by Sourcery
Enhance codebase by updating type annotations, refactoring string formatting, and improving docstring consistency. Update pre-commit hooks to latest versions for better linting and notebook handling.
Enhancements:
Build: