gdsfactory / gplugins

gdsfactory plugins
https://gdsfactory.github.io/gplugins/
MIT License
37 stars 30 forks source link

Update gdsfactory #495

Closed joamatab closed 2 days ago

joamatab commented 2 days ago

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:

sourcery-ai[bot] commented 2 days ago

Reviewer's Guide by Sourcery

This 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.py

classDiagram
    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.py

classDiagram
    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.py

classDiagram
    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.py

classDiagram
    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

Change Details Files
Updated type hints throughout the codebase to use the new Python syntax
  • Changed Optional[Type] to Type
None
  • Added return type annotations to functions
  • Updated list type hints to use list[Type] instead of List[Type]
  • Added missing type hints to class methods
  • gplugins/sentaurus/sprocess.py
    gplugins/spice/spice_to_yaml.py
    gplugins/vlsir/export_netlist.py
    gplugins/path_length_analysis/path_length_analysis.py
    Improved docstring formatting and documentation
    • Removed redundant empty lines after docstrings
    • Fixed docstring formatting to follow Google style
    • Changed 'TODO' to 'Todo' in docstrings
    • Removed redundant quotes in docstrings
    • Added missing parameter descriptions
    gplugins/tidy3d/component.py
    gplugins/sax/build_model.py
    gplugins/gmeep/write_sparameters_meep.py
    gplugins/klayout/get_density.py
    Updated string formatting to use f-strings with !s for string conversion
    • Replaced str() calls in f-strings with !s format specifier
    • Updated string concatenation to use f-strings
    gplugins/sentaurus/sprocess.py
    gplugins/sentaurus/svisual.py

    Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).