From 0980875aaf5cf89c4030ec9aab23e80fb068c170 Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Tue, 20 May 2025 14:13:44 +0200 Subject: [PATCH 1/9] chore: Introduce ruff config, remove flake8, update pre-commit-config (no formatting), enforce I(sort) rule --- .flake8 | 7 ----- .pre-commit-config.yaml | 22 ++------------- pyproject.toml | 28 +++++++++++++------ src/pyedb/configuration/cfg_components.py | 2 +- src/pyedb/configuration/cfg_padstacks.py | 4 --- src/pyedb/configuration/cfg_ports_sources.py | 2 -- src/pyedb/dotnet/database/Variables.py | 6 ++-- src/pyedb/dotnet/edb.py | 2 +- src/pyedb/grpc/database/components.py | 6 ++-- .../grpc/database/definition/materials.py | 2 +- .../grpc/database/definition/package_def.py | 2 +- .../grpc/database/definition/padstack_def.py | 7 ++--- src/pyedb/grpc/database/hfss.py | 4 --- .../grpc/database/hierarchy/component.py | 5 ++-- src/pyedb/grpc/database/layers/layer.py | 3 +- .../grpc/database/layers/stackup_layer.py | 3 +- src/pyedb/grpc/database/modeler.py | 5 ++-- src/pyedb/grpc/database/padstacks.py | 10 +------ src/pyedb/grpc/database/primitive/bondwire.py | 4 +-- src/pyedb/grpc/database/primitive/path.py | 3 +- .../grpc/database/primitive/rectangle.py | 2 +- .../simulation_setup/hfss_general_settings.py | 2 -- .../simulation_setup/hfss_settings_options.py | 4 --- .../database/simulation_setup/sweep_data.py | 4 +-- src/pyedb/grpc/database/siwave.py | 4 +-- src/pyedb/grpc/database/source_excitations.py | 3 +- src/pyedb/grpc/database/stackup.py | 7 ++--- .../grpc/database/terminal/bundle_terminal.py | 2 +- src/pyedb/grpc/database/terminal/terminal.py | 8 ++++-- .../grpc/database/utility/hfss_extent_info.py | 4 +-- src/pyedb/grpc/edb.py | 3 +- 31 files changed, 61 insertions(+), 109 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 6827ce59b0..0000000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -exclude = venv, __init__.py, doc/_build, doc/source/examples -select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403 -count = True -max-complexity = 10 -max-line-length = 120 -statistics = True \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd516c8b39..98bcabcfdf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,12 +10,10 @@ ci: repos: -- repo: https://github.com/psf/black - rev: 23.10.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!! +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.9 hooks: - - id: black - args: - - --line-length=120 + - id: ruff - repo: https://github.com/adamchainz/blacken-docs rev: 1.16.0 @@ -23,20 +21,6 @@ repos: - id: blacken-docs additional_dependencies: [black==23.10.1] -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - -- repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - args: [ - --max-line-length, "120", - ansys, codegen, doc, examples, tests - ] - - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 54945f5152..23c437d290 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,14 +89,26 @@ Source = "https://github.com/ansys/pyedb" Discussions = "https://github.com/ansys/pyedb/discussions" Releases = "https://github.com/ansys/pyedb/releases" -[tool.black] -line-length = 88 - -[tool.isort] -profile = "black" -force_sort_within_sections = true -default_section = "THIRDPARTY" -src_paths = ["doc", "src", "tests"] +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = [ + "I" # isort, see https://docs.astral.sh/ruff/rules/#isort-i +] +ignore = [] + +[tool.ruff.lint.pydocstyle] +# Use Numpy-style docstrings. +convention = "numpy" + +[tool.ruff.lint.isort] +force-sort-within-sections = true +known-first-party = ["doc", "src", "tests"] +combine-as-imports = true + +[tool.ruff.lint.mccabe] +max-complexity = 10 [tool.codespell] skip = '*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,*.a3dcomp,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,*.cdb,*.CDB,build,./factory/*,PKG-INFO,*.mypy_cache/*,./_unused/*,pyproject.toml' diff --git a/src/pyedb/configuration/cfg_components.py b/src/pyedb/configuration/cfg_components.py index df5e35b2d4..6abbc2c68b 100644 --- a/src/pyedb/configuration/cfg_components.py +++ b/src/pyedb/configuration/cfg_components.py @@ -145,8 +145,8 @@ def _retrieve_ic_die_properties_from_edb(self): def _set_ic_die_properties_to_edb(self): from ansys.edb.core.definition.die_property import ( DieOrientation as GrpcDieOrientation, + DieType as GrpcDieType, ) - from ansys.edb.core.definition.die_property import DieType as GrpcDieType from ansys.edb.core.utility.value import Value as GrpcValue cp = self.pyedb_obj.component_property diff --git a/src/pyedb/configuration/cfg_padstacks.py b/src/pyedb/configuration/cfg_padstacks.py index 35cb846bc2..4ab53a3b23 100644 --- a/src/pyedb/configuration/cfg_padstacks.py +++ b/src/pyedb/configuration/cfg_padstacks.py @@ -103,8 +103,6 @@ def __init__(self, parent): def get_solder_ball_definition(self): from ansys.edb.core.definition.solder_ball_property import ( SolderballPlacement as GrpcSolderballPlacement, - ) - from ansys.edb.core.definition.solder_ball_property import ( SolderballShape as GrpcSolderballShape, ) @@ -256,8 +254,6 @@ def get_pad_parameters_from_edb(self): def set_pad_parameters_to_edb(self, param): from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, - ) - from ansys.edb.core.definition.padstack_def_data import ( PadType as GrpcPadType, ) from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/configuration/cfg_ports_sources.py b/src/pyedb/configuration/cfg_ports_sources.py index afc5197a2f..68ee72eff0 100644 --- a/src/pyedb/configuration/cfg_ports_sources.py +++ b/src/pyedb/configuration/cfg_ports_sources.py @@ -776,8 +776,6 @@ def set_parameters_to_edb(self, edb_primitives): from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.terminal.edge_terminal import ( EdgeTerminal as GrpcEdgeTerminal, - ) - from ansys.edb.core.terminal.edge_terminal import ( PrimitiveEdge as GrpcPrimitiveEdge, ) from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/dotnet/database/Variables.py b/src/pyedb/dotnet/database/Variables.py index 59a9ccc909..fb5aa916ff 100644 --- a/src/pyedb/dotnet/database/Variables.py +++ b/src/pyedb/dotnet/database/Variables.py @@ -35,8 +35,10 @@ """ -from __future__ import absolute_import # noreorder -from __future__ import division +from __future__ import ( + absolute_import, # noreorder + division, +) import os import re diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index c24154535b..457eb2548b 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -42,7 +42,6 @@ from pyedb.configuration.configuration import Configuration import pyedb.dotnet -from pyedb.dotnet.database.Variables import decompose_variable_value from pyedb.dotnet.database.cell.layout import Layout from pyedb.dotnet.database.cell.terminal.terminal import Terminal from pyedb.dotnet.database.components import Components @@ -92,6 +91,7 @@ SiwaveDCSimulationSetup, SiwaveSimulationSetup, ) +from pyedb.dotnet.database.Variables import decompose_variable_value from pyedb.generic.constants import AEDT_UNITS, SolverType, unit_converter from pyedb.generic.general_methods import ( generate_unique_name, diff --git a/src/pyedb/grpc/database/components.py b/src/pyedb/grpc/database/components.py index 0156a5fde7..1d1f18d2c8 100644 --- a/src/pyedb/grpc/database/components.py +++ b/src/pyedb/grpc/database/components.py @@ -30,8 +30,7 @@ import re import warnings -from ansys.edb.core.definition.die_property import DieOrientation as GrpDieOrientation -from ansys.edb.core.definition.die_property import DieType as GrpcDieType +from ansys.edb.core.definition.die_property import DieOrientation as GrpDieOrientation, DieType as GrpcDieType from ansys.edb.core.definition.solder_ball_property import ( SolderballShape as GrpcSolderballShape, ) @@ -1080,8 +1079,7 @@ def _is_top_component(self, cmp): def _get_component_definition(self, name, pins): component_definition = ComponentDef.find(self._db, name) if component_definition.is_null: - from ansys.edb.core.layout.cell import Cell as GrpcCell - from ansys.edb.core.layout.cell import CellType as GrpcCellType + from ansys.edb.core.layout.cell import Cell as GrpcCell, CellType as GrpcCellType foot_print_cell = GrpcCell.create(self._pedb.active_db, GrpcCellType.FOOTPRINT_CELL, name) component_definition = ComponentDef.create(self._db, name, fp=foot_print_cell) diff --git a/src/pyedb/grpc/database/definition/materials.py b/src/pyedb/grpc/database/definition/materials.py index 4d8ea2f9f7..730d1d9834 100644 --- a/src/pyedb/grpc/database/definition/materials.py +++ b/src/pyedb/grpc/database/definition/materials.py @@ -34,9 +34,9 @@ DjordjecvicSarkarModel as GrpcDjordjecvicSarkarModel, ) from ansys.edb.core.definition.material_def import ( + MaterialDef as GrpcMaterialDef, MaterialProperty as GrpcMaterialProperty, ) -from ansys.edb.core.definition.material_def import MaterialDef as GrpcMaterialDef from ansys.edb.core.definition.multipole_debye_model import ( MultipoleDebyeModel as GrpcMultipoleDebyeModel, ) diff --git a/src/pyedb/grpc/database/definition/package_def.py b/src/pyedb/grpc/database/definition/package_def.py index a317233e4f..e2243b8a51 100644 --- a/src/pyedb/grpc/database/definition/package_def.py +++ b/src/pyedb/grpc/database/definition/package_def.py @@ -222,9 +222,9 @@ def set_heatsink(self, fin_base_height, fin_height, fin_orientation, fin_spacing Fin thickness. """ from ansys.edb.core.utility.heat_sink import ( + HeatSink as GrpcHeatSink, HeatSinkFinOrientation as GrpcHeatSinkFinOrientation, ) - from ansys.edb.core.utility.heat_sink import HeatSink as GrpcHeatSink if fin_orientation == "x_oriented": fin_orientation = GrpcHeatSinkFinOrientation.X_ORIENTED diff --git a/src/pyedb/grpc/database/definition/padstack_def.py b/src/pyedb/grpc/database/definition/padstack_def.py index bc72622759..5719dab5b2 100644 --- a/src/pyedb/grpc/database/definition/padstack_def.py +++ b/src/pyedb/grpc/database/definition/padstack_def.py @@ -25,15 +25,12 @@ from ansys.edb.core.definition.padstack_def import PadstackDef as GrpcPadstackDef from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, -) -from ansys.edb.core.definition.padstack_def_data import ( PadstackHoleRange as GrpcPadstackHoleRange, + PadType as GrpcPadType, ) -from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType import ansys.edb.core.geometry.polygon_data from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure -from ansys.edb.core.hierarchy.structure3d import Structure3D as GrpcStructure3D +from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure, Structure3D as GrpcStructure3D from ansys.edb.core.primitive.circle import Circle as GrpcCircle from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/database/hfss.py b/src/pyedb/grpc/database/hfss.py index dc0e5d6395..4bcdfce15e 100644 --- a/src/pyedb/grpc/database/hfss.py +++ b/src/pyedb/grpc/database/hfss.py @@ -1242,11 +1242,7 @@ def add_setup( ) from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, - ) - from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, - ) - from ansys.edb.core.simulation_setup.simulation_setup import ( SweepData as GrpcSweepData, ) diff --git a/src/pyedb/grpc/database/hierarchy/component.py b/src/pyedb/grpc/database/hierarchy/component.py index e81956d6e3..398e683864 100644 --- a/src/pyedb/grpc/database/hierarchy/component.py +++ b/src/pyedb/grpc/database/hierarchy/component.py @@ -28,14 +28,13 @@ from ansys.edb.core.definition.component_model import ( NPortComponentModel as GrpcNPortComponentModel, ) -from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation -from ansys.edb.core.definition.die_property import DieType as GrpcDieType +from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation, DieType as GrpcDieType from ansys.edb.core.definition.solder_ball_property import SolderballShape from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.component_group import ( ComponentGroup as GrpcComponentGroup, + ComponentType as GrpcComponentType, ) -from ansys.edb.core.hierarchy.component_group import ComponentType as GrpcComponentType from ansys.edb.core.hierarchy.netlist_model import NetlistModel as GrpcNetlistModel from ansys.edb.core.hierarchy.pin_pair_model import PinPairModel as GrpcPinPairModel from ansys.edb.core.hierarchy.sparameter_model import ( diff --git a/src/pyedb/grpc/database/layers/layer.py b/src/pyedb/grpc/database/layers/layer.py index 234c2c2a8c..db8f072351 100644 --- a/src/pyedb/grpc/database/layers/layer.py +++ b/src/pyedb/grpc/database/layers/layer.py @@ -6,8 +6,7 @@ from __future__ import absolute_import -from ansys.edb.core.layer.layer import Layer as GrpcLayer -from ansys.edb.core.layer.layer import LayerType as GrpcLayerType +from ansys.edb.core.layer.layer import Layer as GrpcLayer, LayerType as GrpcLayerType class Layer(GrpcLayer): diff --git a/src/pyedb/grpc/database/layers/stackup_layer.py b/src/pyedb/grpc/database/layers/stackup_layer.py index aadfd6ca4c..e5d5c4aeca 100644 --- a/src/pyedb/grpc/database/layers/stackup_layer.py +++ b/src/pyedb/grpc/database/layers/stackup_layer.py @@ -23,8 +23,7 @@ from __future__ import absolute_import from ansys.edb.core.layer.layer import LayerType as GrpcLayerType -from ansys.edb.core.layer.stackup_layer import RoughnessRegion as GrpcRoughnessRegion -from ansys.edb.core.layer.stackup_layer import StackupLayer as GrpcStackupLayer +from ansys.edb.core.layer.stackup_layer import RoughnessRegion as GrpcRoughnessRegion, StackupLayer as GrpcStackupLayer from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/database/modeler.py b/src/pyedb/grpc/database/modeler.py index 2b3e9f97ef..59a0c21992 100644 --- a/src/pyedb/grpc/database/modeler.py +++ b/src/pyedb/grpc/database/modeler.py @@ -28,14 +28,13 @@ from ansys.edb.core.geometry.arc_data import ArcData as GrpcArcData from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import ( + PolygonData as GrpcPolygonData, PolygonSenseType as GrpcPolygonSenseType, ) -from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.pin_group import PinGroup as GrpcPinGroup from ansys.edb.core.inner.exceptions import InvalidArgumentException from ansys.edb.core.primitive.bondwire import BondwireType as GrpcBondwireType -from ansys.edb.core.primitive.path import PathCornerType as GrpcPathCornerType -from ansys.edb.core.primitive.path import PathEndCapType as GrpcPathEndCapType +from ansys.edb.core.primitive.path import PathCornerType as GrpcPathCornerType, PathEndCapType as GrpcPathEndCapType from ansys.edb.core.primitive.rectangle import ( RectangleRepresentationType as GrpcRectangleRepresentationType, ) diff --git a/src/pyedb/grpc/database/padstacks.py b/src/pyedb/grpc/database/padstacks.py index 9911090494..784fa34c2b 100644 --- a/src/pyedb/grpc/database/padstacks.py +++ b/src/pyedb/grpc/database/padstacks.py @@ -28,20 +28,12 @@ from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, -) -from ansys.edb.core.definition.padstack_def_data import ( PadstackDefData as GrpcPadstackDefData, -) -from ansys.edb.core.definition.padstack_def_data import ( PadstackHoleRange as GrpcPadstackHoleRange, -) -from ansys.edb.core.definition.padstack_def_data import ( + PadType as GrpcPadType, SolderballPlacement as GrpcSolderballPlacement, -) -from ansys.edb.core.definition.padstack_def_data import ( SolderballShape as GrpcSolderballShape, ) -from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/database/primitive/bondwire.py b/src/pyedb/grpc/database/primitive/bondwire.py index b638f2d336..6b314ab3bf 100644 --- a/src/pyedb/grpc/database/primitive/bondwire.py +++ b/src/pyedb/grpc/database/primitive/bondwire.py @@ -21,10 +21,10 @@ # SOFTWARE. from ansys.edb.core.primitive.bondwire import ( + Bondwire as GrpcBondWire, BondwireCrossSectionType as GrpcBondwireCrossSectionType, + BondwireType as GrpcBondWireType, ) -from ansys.edb.core.primitive.bondwire import Bondwire as GrpcBondWire -from ansys.edb.core.primitive.bondwire import BondwireType as GrpcBondWireType from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/database/primitive/path.py b/src/pyedb/grpc/database/primitive/path.py index d19ee77448..d18bca86eb 100644 --- a/src/pyedb/grpc/database/primitive/path.py +++ b/src/pyedb/grpc/database/primitive/path.py @@ -22,8 +22,7 @@ import math from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.primitive.path import Path as GrpcPath -from ansys.edb.core.primitive.path import PathCornerType as GrpcPatCornerType +from ansys.edb.core.primitive.path import Path as GrpcPath, PathCornerType as GrpcPatCornerType from ansys.edb.core.utility.value import Value as GrpcValue from pyedb.grpc.database.primitive.primitive import Primitive diff --git a/src/pyedb/grpc/database/primitive/rectangle.py b/src/pyedb/grpc/database/primitive/rectangle.py index c15d9c9ed2..b6bf091ed1 100644 --- a/src/pyedb/grpc/database/primitive/rectangle.py +++ b/src/pyedb/grpc/database/primitive/rectangle.py @@ -22,9 +22,9 @@ from ansys.edb.core.primitive.rectangle import ( + Rectangle as GrpcRectangle, RectangleRepresentationType as GrpcRectangleRepresentationType, ) -from ansys.edb.core.primitive.rectangle import Rectangle as GrpcRectangle from ansys.edb.core.utility.value import Value as GrpcValue from pyedb.grpc.database.primitive.primitive import Primitive diff --git a/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py b/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py index 1bd2ba7ed4..bf70f0d0d5 100644 --- a/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py +++ b/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py @@ -23,8 +23,6 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( AdaptType as GrpcAdaptType, -) -from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( HFSSGeneralSettings as GrpcHFSSGeneralSettings, ) diff --git a/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py b/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py index 16eb49985f..d56a813bcd 100644 --- a/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py +++ b/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py @@ -23,11 +23,7 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( BasisFunctionOrder as GrpcBasisFunctionOrder, -) -from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( HFSSSettingsOptions as GrpcHFSSSettingsOptions, -) -from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( SolverType as GrpcSolverType, ) diff --git a/src/pyedb/grpc/database/simulation_setup/sweep_data.py b/src/pyedb/grpc/database/simulation_setup/sweep_data.py index 4a3a587b03..c94a54aeba 100644 --- a/src/pyedb/grpc/database/simulation_setup/sweep_data.py +++ b/src/pyedb/grpc/database/simulation_setup/sweep_data.py @@ -22,11 +22,9 @@ from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, -) -from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, + SweepData as GrpcSweepData, ) -from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData class SweepData(GrpcSweepData): diff --git a/src/pyedb/grpc/database/siwave.py b/src/pyedb/grpc/database/siwave.py index abde5b031f..077ea1590a 100644 --- a/src/pyedb/grpc/database/siwave.py +++ b/src/pyedb/grpc/database/siwave.py @@ -30,11 +30,9 @@ from ansys.edb.core.database import ProductIdType as GrpcProductIdType from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, -) -from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, + SweepData as GrpcSweepData, ) -from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData from pyedb.misc.siw_feature_config.xtalk_scan.scan_config import SiwaveScanConfig diff --git a/src/pyedb/grpc/database/source_excitations.py b/src/pyedb/grpc/database/source_excitations.py index dc8c4271d4..3c1db9ba5e 100644 --- a/src/pyedb/grpc/database/source_excitations.py +++ b/src/pyedb/grpc/database/source_excitations.py @@ -25,8 +25,7 @@ from ansys.edb.core.database import ProductIdType as GrpcProductIdType from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTerminal -from ansys.edb.core.terminal.edge_terminal import PrimitiveEdge as GrpcPrimitiveEdge +from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTerminal, PrimitiveEdge as GrpcPrimitiveEdge from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType from ansys.edb.core.utility.rlc import Rlc as GrpcRlc from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/database/stackup.py b/src/pyedb/grpc/database/stackup.py index 67e124b28a..e541b3fc25 100644 --- a/src/pyedb/grpc/database/stackup.py +++ b/src/pyedb/grpc/database/stackup.py @@ -40,13 +40,12 @@ from ansys.edb.core.geometry.point3d_data import Point3DData as GrpcPoint3DData from ansys.edb.core.hierarchy.cell_instance import CellInstance as GrpcCellInstance from ansys.edb.core.hierarchy.component_group import ComponentType as GrpcComponentType -from ansys.edb.core.layer.layer import LayerType as GrpcLayerType -from ansys.edb.core.layer.layer import TopBottomAssociation as GrpcTopBottomAssociation +from ansys.edb.core.layer.layer import LayerType as GrpcLayerType, TopBottomAssociation as GrpcTopBottomAssociation from ansys.edb.core.layer.layer_collection import ( + LayerCollection as GrpcLayerCollection, LayerCollectionMode as GrpcLayerCollectionMode, + LayerTypeSet as GrpcLayerTypeSet, ) -from ansys.edb.core.layer.layer_collection import LayerCollection as GrpcLayerCollection -from ansys.edb.core.layer.layer_collection import LayerTypeSet as GrpcLayerTypeSet from ansys.edb.core.layer.stackup_layer import StackupLayer as GrpcStackupLayer from ansys.edb.core.layout.mcad_model import McadModel as GrpcMcadModel from ansys.edb.core.utility.transform3d import Transform3D as GrpcTransform3D diff --git a/src/pyedb/grpc/database/terminal/bundle_terminal.py b/src/pyedb/grpc/database/terminal/bundle_terminal.py index c8dfd9d6eb..455e103c9c 100644 --- a/src/pyedb/grpc/database/terminal/bundle_terminal.py +++ b/src/pyedb/grpc/database/terminal/bundle_terminal.py @@ -22,9 +22,9 @@ from ansys.edb.core.terminal.bundle_terminal import BundleTerminal as GrpcBundleTerminal from ansys.edb.core.terminal.terminal import ( + HfssPIType as GrpcHfssPIType, SourceTermToGroundType as GrpcSourceTermToGroundType, ) -from ansys.edb.core.terminal.terminal import HfssPIType as GrpcHfssPIType from ansys.edb.core.utility.value import Value as GrpcValue from pyedb.grpc.database.hierarchy.component import Component diff --git a/src/pyedb/grpc/database/terminal/terminal.py b/src/pyedb/grpc/database/terminal/terminal.py index 94d87d9267..ada0a28615 100644 --- a/src/pyedb/grpc/database/terminal/terminal.py +++ b/src/pyedb/grpc/database/terminal/terminal.py @@ -23,9 +23,11 @@ import re from ansys.edb.core.terminal.edge_terminal import EdgeType as GrpcEdgeType -from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType -from ansys.edb.core.terminal.terminal import Terminal as GrpcTerminal -from ansys.edb.core.terminal.terminal import TerminalType as GrpcTerminalType +from ansys.edb.core.terminal.terminal import ( + BoundaryType as GrpcBoundaryType, + Terminal as GrpcTerminal, + TerminalType as GrpcTerminalType, +) from ansys.edb.core.utility.value import Value as GrpcValue from pyedb.dotnet.database.edb_data.padstacks_data import EDBPadstackInstance diff --git a/src/pyedb/grpc/database/utility/hfss_extent_info.py b/src/pyedb/grpc/database/utility/hfss_extent_info.py index 6aa2e1ad85..f25b192325 100644 --- a/src/pyedb/grpc/database/utility/hfss_extent_info.py +++ b/src/pyedb/grpc/database/utility/hfss_extent_info.py @@ -21,10 +21,10 @@ # SOFTWARE. from ansys.edb.core.utility.hfss_extent_info import ( + HfssExtentInfo as GrpcHfssExtentInfo, HFSSExtentInfoType as GrpcHfssExtentInfoType, + OpenRegionType as GrpcOpenRegionType, ) -from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo as GrpcHfssExtentInfo -from ansys.edb.core.utility.hfss_extent_info import OpenRegionType as GrpcOpenRegionType from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/edb.py b/src/pyedb/grpc/edb.py index d3275728b1..dba745140b 100644 --- a/src/pyedb/grpc/edb.py +++ b/src/pyedb/grpc/edb.py @@ -633,8 +633,7 @@ def create_edb(self, restart_rpc_server=False, kill_all_instances=False): ------- bool: `True` when succeed `False` if failed. """ - from ansys.edb.core.layout.cell import Cell as GrpcCell - from ansys.edb.core.layout.cell import CellType as GrpcCellType + from ansys.edb.core.layout.cell import Cell as GrpcCell, CellType as GrpcCellType self.standalone = self.standalone n_try = 10 From 4b989ab4bec90760c4e57a393c288d4de8407ee3 Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Tue, 20 May 2025 14:33:59 +0200 Subject: [PATCH 2/9] chore: Update revs for blacken-docs pre-commit hook --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 98bcabcfdf..50ffe6bf4e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,10 +16,10 @@ repos: - id: ruff - repo: https://github.com/adamchainz/blacken-docs - rev: 1.16.0 + rev: 1.19.1 hooks: - id: blacken-docs - additional_dependencies: [black==23.10.1] + additional_dependencies: [black==25.1.0] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 From fdca38a56146f5ff181a8eaa05c941810439a813 Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Tue, 20 May 2025 14:47:42 +0200 Subject: [PATCH 3/9] chore: Apply ruff formatting, add corresponding hook to pre-commit-config and update files accordingly --- .pre-commit-config.yaml | 1 + doc/print_errors.py | 1 + pyproject.toml | 5 ++ src/pyedb/dotnet/clr_module.py | 3 +- src/pyedb/dotnet/database/Variables.py | 41 ++++++----- src/pyedb/dotnet/database/cell/layout.py | 1 + .../database/cell/primitive/primitive.py | 4 +- src/pyedb/dotnet/database/components.py | 30 ++++---- src/pyedb/dotnet/database/dotnet/database.py | 1 + .../dotnet/database/edb_data/nets_data.py | 6 +- .../database/edb_data/primitives_data.py | 6 +- .../raptor_x_simulation_setup_data.py | 37 +++++----- .../edb_data/simulation_configuration.py | 6 +- src/pyedb/dotnet/database/hfss.py | 17 ++--- .../dotnet/database/layout_validation.py | 2 +- src/pyedb/dotnet/database/materials.py | 4 +- src/pyedb/dotnet/database/modeler.py | 3 +- src/pyedb/dotnet/database/nets.py | 6 +- src/pyedb/dotnet/database/padstack.py | 6 +- src/pyedb/dotnet/database/siwave.py | 7 +- src/pyedb/dotnet/database/stackup.py | 69 ++++++++++++------- .../dotnet/database/utilities/heatsink.py | 1 - .../database/utilities/simulation_setup.py | 12 ++-- src/pyedb/dotnet/edb.py | 56 +++++++-------- src/pyedb/exceptions.py | 3 +- src/pyedb/generic/data_handlers.py | 16 ++--- src/pyedb/generic/design_types.py | 14 ++-- src/pyedb/grpc/database/components.py | 30 ++++---- .../grpc/database/definition/padstack_def.py | 2 +- src/pyedb/grpc/database/hfss.py | 13 ++-- .../grpc/database/hierarchy/component.py | 2 +- src/pyedb/grpc/database/layout/layout.py | 1 + src/pyedb/grpc/database/layout_validation.py | 2 +- src/pyedb/grpc/database/modeler.py | 5 +- src/pyedb/grpc/database/net/net.py | 4 +- src/pyedb/grpc/database/nets.py | 4 +- src/pyedb/grpc/database/padstacks.py | 3 +- .../grpc/database/primitive/primitive.py | 4 +- src/pyedb/grpc/database/siwave.py | 3 +- src/pyedb/grpc/database/source_excitations.py | 14 ++-- src/pyedb/grpc/database/stackup.py | 69 ++++++++++++------- src/pyedb/grpc/database/utility/heat_sink.py | 1 - .../utility/simulation_configuration.py | 6 +- src/pyedb/grpc/edb.py | 47 ++++++------- src/pyedb/grpc/edb_init.py | 1 + src/pyedb/ipc2581/ipc2581.py | 12 ++-- src/pyedb/misc/downloads.py | 1 + src/pyedb/misc/misc.py | 1 + src/pyedb/misc/utilities.py | 1 - src/pyedb/modeler/geometry_operators.py | 7 +- tests/grpc/system/conftest.py | 3 +- tests/grpc/system/test_edb.py | 3 +- tests/grpc/system/test_edb_components.py | 4 +- tests/grpc/system/test_edb_definition.py | 4 +- .../system/test_edb_differential_pairs.py | 3 +- tests/grpc/system/test_edb_extended_nets.py | 3 +- .../system/test_edb_future_features_242.py | 3 +- tests/grpc/system/test_edb_ipc.py | 3 +- tests/grpc/system/test_edb_materials.py | 3 +- tests/grpc/system/test_edb_modeler.py | 3 +- tests/grpc/system/test_edb_net_classes.py | 3 +- tests/grpc/system/test_edb_nets.py | 3 +- tests/grpc/system/test_edb_padstacks.py | 4 +- tests/grpc/system/test_edb_stackup.py | 3 +- tests/grpc/system/test_emi_scanner.py | 3 +- tests/grpc/system/test_siwave_features.py | 3 +- tests/grpc/unit/conftest.py | 3 +- tests/legacy/system/conftest.py | 3 +- tests/legacy/system/test_edb_components.py | 4 +- tests/legacy/system/test_edb_definition.py | 4 +- .../system/test_edb_differential_pairs.py | 3 +- tests/legacy/system/test_edb_extended_nets.py | 3 +- .../system/test_edb_future_features_242.py | 3 +- tests/legacy/system/test_edb_ipc.py | 3 +- tests/legacy/system/test_edb_materials.py | 3 +- tests/legacy/system/test_edb_modeler.py | 3 +- tests/legacy/system/test_edb_net_classes.py | 3 +- tests/legacy/system/test_edb_nets.py | 3 +- tests/legacy/system/test_edb_padstacks.py | 7 +- tests/legacy/system/test_edb_stackup.py | 3 +- tests/legacy/system/test_emi_scanner.py | 3 +- tests/legacy/system/test_siwave_features.py | 3 +- tests/legacy/unit/conftest.py | 3 +- 83 files changed, 367 insertions(+), 332 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 50ffe6bf4e..98f29499a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,7 @@ repos: rev: v0.11.9 hooks: - id: ruff + - id: ruff-format - repo: https://github.com/adamchainz/blacken-docs rev: 1.19.1 diff --git a/doc/print_errors.py b/doc/print_errors.py index 81209d557e..ba1c3c0a37 100644 --- a/doc/print_errors.py +++ b/doc/print_errors.py @@ -1,4 +1,5 @@ """Read errors output from a Sphinx build and remove duplicate groups.""" + import os import pathlib import sys diff --git a/pyproject.toml b/pyproject.toml index 23c437d290..8a5f5f2fd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,11 @@ Discussions = "https://github.com/ansys/pyedb/discussions" [tool.ruff] line-length = 120 +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +docstring-code-format = true + [tool.ruff.lint] select = [ "I" # isort, see https://docs.astral.sh/ruff/rules/#isort-i diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index be541c5dd3..fcd7558482 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -50,8 +50,7 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non # TODO: Fall backing to dotnetcore2 should be removed in a near future. except Exception: warnings.warn( - "Unable to set .NET root and locate the runtime configuration file. " - "Falling back to using dotnetcore2." + "Unable to set .NET root and locate the runtime configuration file. Falling back to using dotnetcore2." ) warnings.warn(LINUX_WARNING) diff --git a/src/pyedb/dotnet/database/Variables.py b/src/pyedb/dotnet/database/Variables.py index fb5aa916ff..535cddd26f 100644 --- a/src/pyedb/dotnet/database/Variables.py +++ b/src/pyedb/dotnet/database/Variables.py @@ -492,13 +492,13 @@ def decompose(self, variable_value): # pragma: no cover -------- >>> hfss = Hfss() >>> print(hfss.variable_manager.decompose("5mm")) - >>> (5.0, 'mm') + >>> (5.0, "mm") >>> hfss["v1"] = "3N" >>> print(hfss.variable_manager.decompose("v1")) - >>> (3.0, 'N') + >>> (3.0, "N") >>> hfss["v2"] = "2*v1" >>> print(hfss.variable_manager.decompose("v2")) - >>> (6.0, 'N') + >>> (6.0, "N") """ if variable_value in self.independent_variable_names: val, unit = decompose_variable_value(self[variable_value].expression) @@ -1008,8 +1008,13 @@ def set_variable( creating the property if it does not already exist. Also make it read-only and hidden and add a description. - >>> aedtapp.variable_manager.set_variable(variable_name="p2", expression="10mm", readonly=True, hidden=True, - ... description="This is the description of this variable.") + >>> aedtapp.variable_manager.set_variable( + ... variable_name="p2", + ... expression="10mm", + ... readonly=True, + ... hidden=True, + ... description="This is the description of this variable.", + ... ) Set the value of the project variable ``$p1`` to ``"30mm"``, creating the variable if it does not exist. @@ -1706,7 +1711,7 @@ def decompose(self): # pragma: no cover >>> hfss = Hfss() >>> hfss["v1"] = "3N" >>> print(hfss.variable_manager["v1"].decompose("v1")) - >>> (3.0, 'N') + >>> (3.0, "N") """ return decompose_variable_value(self.evaluated_value) @@ -1732,9 +1737,9 @@ def rescale_to(self, units): # pragma: no cover """ new_unit_system = unit_system(units) - assert ( - new_unit_system == self.unit_system - ), "New unit system {0} is inconsistent with the current unit system {1}." + assert new_unit_system == self.unit_system, ( + "New unit system {0} is inconsistent with the current unit system {1}." + ) self._units = units return self @@ -1757,9 +1762,9 @@ def format(self, format): # pragma: no cover >>> from pyedb.dotnet.database.Variables import Variable >>> v = Variable("10W") - >>> assert v.format("f") == '10.000000W' - >>> assert v.format("06.2f") == '010.00W' - >>> assert v.format("6.2f") == ' 10.00W' + >>> assert v.format("f") == "10.000000W" + >>> assert v.format("06.2f") == "010.00W" + >>> assert v.format("6.2f") == " 10.00W" """ return ("{0:" + format + "}{1}").format(self.numeric_value, self._units) @@ -1850,9 +1855,9 @@ def __add__(self, other): # pragma: no cover """ assert isinstance(other, Variable), "You can only add a variable with another variable." - assert ( - self.unit_system == other.unit_system - ), "Only ``Variable`` objects with the same unit system can be added." + assert self.unit_system == other.unit_system, ( + "Only ``Variable`` objects with the same unit system can be added." + ) result_value = self.value + other.value result_units = SI_UNITS[self.unit_system] # If the units of the two operands are different, return SI-Units @@ -1891,9 +1896,9 @@ def __sub__(self, other): # pragma: no cover """ assert isinstance(other, Variable), "You can only subtract a variable from another variable." - assert ( - self.unit_system == other.unit_system - ), "Only ``Variable`` objects with the same unit system can be subtracted." + assert self.unit_system == other.unit_system, ( + "Only ``Variable`` objects with the same unit system can be subtracted." + ) result_value = self.value - other.value result_units = SI_UNITS[self.unit_system] # If the units of the two operands are different, return SI-Units diff --git a/src/pyedb/dotnet/database/cell/layout.py b/src/pyedb/dotnet/database/cell/layout.py index 72dd09ca45..c756fb463f 100644 --- a/src/pyedb/dotnet/database/cell/layout.py +++ b/src/pyedb/dotnet/database/cell/layout.py @@ -23,6 +23,7 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + from typing import Union from pyedb.dotnet.database.cell.hierarchy.component import EDBComponent diff --git a/src/pyedb/dotnet/database/cell/primitive/primitive.py b/src/pyedb/dotnet/database/cell/primitive/primitive.py index b309a8b11b..0057ea00fd 100644 --- a/src/pyedb/dotnet/database/cell/primitive/primitive.py +++ b/src/pyedb/dotnet/database/cell/primitive/primitive.py @@ -37,8 +37,8 @@ class Primitive(Connectable): >>> from pyedb import Edb >>> edb = Edb(myedb, edbversion="2021.2") >>> edb_prim = edb.modeler.primitives[0] - >>> edb_prim.is_void # Class Property - >>> edb_prim.IsVoid() # EDB Object Property + >>> edb_prim.is_void # Class Property + >>> edb_prim.IsVoid() # EDB Object Property """ def __init__(self, pedb, edb_object): diff --git a/src/pyedb/dotnet/database/components.py b/src/pyedb/dotnet/database/components.py index ce8c054dd8..26f4779b52 100644 --- a/src/pyedb/dotnet/database/components.py +++ b/src/pyedb/dotnet/database/components.py @@ -20,9 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""This module contains the `Components` class. +"""This module contains the `Components` class.""" -""" import codecs import json import math @@ -541,16 +540,17 @@ def get_component_placement_vector( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") >>> vector, rotation, solder_ball_height = edb1.components.get_component_placement_vector( - ... mounted_component=mounted_cmp, - ... hosting_component=hosting_cmp, - ... mounted_component_pin1="A12", - ... mounted_component_pin2="A14", - ... hosting_component_pin1="A12", - ... hosting_component_pin2="A14") + ... mounted_component=mounted_cmp, + ... hosting_component=hosting_cmp, + ... mounted_component_pin1="A12", + ... mounted_component_pin2="A14", + ... hosting_component_pin1="A12", + ... hosting_component_pin2="A14", + ... ) """ m_pin1_pos = [0.0, 0.0] m_pin2_pos = [0.0, 0.0] @@ -1255,7 +1255,7 @@ def deactivate_rlc_component(self, component=None, create_circuit_port=False, pe Examples -------- >>> from pyedb import Edb - >>> edb_file = r'C:\my_edb_file.aedb' + >>> edb_file = r"C:\my_edb_file.aedb" >>> edb = Edb(edb_file) >>> for cmp in list(edb.components.instances.keys()): >>> edb.components.deactivate_rlc_component(component=cmp, create_circuit_port=False) @@ -1729,9 +1729,9 @@ def set_component_model(self, componentname, model_type="Spice", modelpath=None, >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder") - >>> edbapp.components.set_component_model("A1", model_type="Spice", - ... modelpath="pathtospfile", - ... modelname="spicemodelname") + >>> edbapp.components.set_component_model( + ... "A1", model_type="Spice", modelpath="pathtospfile", modelname="spicemodelname" + ... ) """ if not modelname: @@ -2131,9 +2131,7 @@ def set_component_rlc( >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder") - >>> edbapp.components.set_component_rlc( - ... "R1", res_value=50, ind_value=1e-9, cap_value=1e-12, isparallel=False - ... ) + >>> edbapp.components.set_component_rlc("R1", res_value=50, ind_value=1e-9, cap_value=1e-12, isparallel=False) """ if res_value is None and ind_value is None and cap_value is None: diff --git a/src/pyedb/dotnet/database/dotnet/database.py b/src/pyedb/dotnet/database/dotnet/database.py index 512e667db3..7750d3d40d 100644 --- a/src/pyedb/dotnet/database/dotnet/database.py +++ b/src/pyedb/dotnet/database/dotnet/database.py @@ -21,6 +21,7 @@ # SOFTWARE. """Database.""" + import os import re import sys diff --git a/src/pyedb/dotnet/database/edb_data/nets_data.py b/src/pyedb/dotnet/database/edb_data/nets_data.py index efde838c2e..898eb517ac 100644 --- a/src/pyedb/dotnet/database/edb_data/nets_data.py +++ b/src/pyedb/dotnet/database/edb_data/nets_data.py @@ -37,8 +37,8 @@ class EDBNetsData(NetDotNet): >>> from pyedb import Edb >>> edb = Edb(myedb, edbversion="2021.2") >>> edb_net = edb.nets.nets["GND"] - >>> edb_net.name # Class Property - >>> edb_net.name # EDB Object Property + >>> edb_net.name # Class Property + >>> edb_net.name # EDB Object Property """ def __init__(self, raw_net, core_app): @@ -220,7 +220,7 @@ class EDBExtendedNetData(ExtendedNetDotNet): >>> from pyedb import Edb >>> edb = Edb(myedb, edbversion="2021.2") >>> edb_extended_net = edb.nets.extended_nets["GND"] - >>> edb_extended_net.name # Class Property + >>> edb_extended_net.name # Class Property """ def __init__(self, core_app, raw_extended_net=None): diff --git a/src/pyedb/dotnet/database/edb_data/primitives_data.py b/src/pyedb/dotnet/database/edb_data/primitives_data.py index 458781c2d6..e3edbff9af 100644 --- a/src/pyedb/dotnet/database/edb_data/primitives_data.py +++ b/src/pyedb/dotnet/database/edb_data/primitives_data.py @@ -358,9 +358,9 @@ class EDBArcs(object): >>> from pyedb import Edb >>> edb = Edb(myedb, edbversion="2021.2") >>> prim_arcs = edb.modeler.primitives[0].arcs - >>> prim_arcs.center # arc center - >>> prim_arcs.points # arc point list - >>> prim_arcs.mid_point # arc mid point + >>> prim_arcs.center # arc center + >>> prim_arcs.points # arc point list + >>> prim_arcs.mid_point # arc mid point """ def __init__(self, app, arc): diff --git a/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py b/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py index a8363fffd3..eb50089663 100644 --- a/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py +++ b/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py @@ -85,11 +85,13 @@ def add_frequency_sweep(self, name=None, frequency_sweep=None): Examples -------- >>> setup1 = edbapp.create_hfss_setup("setup1") - >>> setup1.add_frequency_sweep(frequency_sweep=[ - ... ["linear count", "0", "1kHz", 1], - ... ["log scale", "1kHz", "0.1GHz", 10], - ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], - ... ]) + >>> setup1.add_frequency_sweep( + ... frequency_sweep=[ + ... ["linear count", "0", "1kHz", 1], + ... ["log scale", "1kHz", "0.1GHz", 10], + ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], + ... ] + ... ) """ if name in self.frequency_sweeps: return False @@ -234,9 +236,7 @@ def net_settings_options(self, value): if isinstance(value, list): self._advanced_settings.NetSettingsOptions = convert_py_list_to_net_list(value) else: - self.logger.error( - f"RaptorX setup net_settings_options input setter must be a list. " f"Provided value {value}" - ) + self.logger.error(f"RaptorX setup net_settings_options input setter must be a list. Provided value {value}") @property def override_shrink_fac(self): @@ -276,7 +276,7 @@ def use_accelerate_via_extraction(self, value): self._advanced_settings.UseAccelerateViaExtraction = value else: self.logger.error( - "RaptorX setup use_accelerate_via_extraction setter input must be boolean." f"Provided value {value}" + f"RaptorX setup use_accelerate_via_extraction setter input must be boolean.Provided value {value}" ) @property @@ -290,7 +290,7 @@ def use_auto_removal_sliver_poly(self, value): self._advanced_settings.UseAutoRemovalSliverPoly = value else: self.logger.error( - f"RaptorX setup use_auto_removal_sliver_poly setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_auto_removal_sliver_poly setter must be a boolean. Provided value {value}" ) @property @@ -334,7 +334,7 @@ def use_eliminate_slit_per_holes(self, value): self._advanced_settings.UseEliminateSlitPerHoles = value else: self.logger.error( - f"RaptorX setup use_eliminate_slit_per_holes setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_eliminate_slit_per_holes setter must be a boolean. Provided value {value}" ) @property @@ -350,7 +350,7 @@ def use_enable_advanced_cap_effects(self, value): self._advanced_settings.UseEnableAdvancedCapEffects = value else: self.logger.error( - f"RaptorX setup use_enable_advanced_cap_effects setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_enable_advanced_cap_effects setter must be a boolean. Provided value {value}" ) @property @@ -366,7 +366,7 @@ def use_enable_etch_transform(self, value): self._advanced_settings.UseEnableEtchTransform = value else: self.logger.error( - f"RaptorX setup use_enable_etch_transform setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_enable_etch_transform setter must be a boolean. Provided value {value}" ) @property @@ -382,7 +382,7 @@ def use_enable_hybrid_extraction(self, value): self._advanced_settings.UseEnableHybridExtraction = value else: self.logger.error( - f"RaptorX setup use_enable_hybrid_extraction setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_enable_hybrid_extraction setter must be a boolean. Provided value {value}" ) @property @@ -414,7 +414,7 @@ def use_extract_floating_metals_dummy(self, value): self._advanced_settings.UseExtractFloatingMetalsDummy = value else: self.logger.error( - f"RaptorX setup use_extract_floating_metals_dummy setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_extract_floating_metals_dummy setter must be a boolean. Provided value {value}" ) @property @@ -430,8 +430,7 @@ def use_extract_floating_metals_floating(self, value): self._advanced_settings.UseExtractFloatingMetalsFloating = value else: self.logger.error( - f"RaptorX setup use_extract_floating_metals_floating setter must be a boolean. " - f"Provided value {value}" + f"RaptorX setup use_extract_floating_metals_floating setter must be a boolean. Provided value {value}" ) @property @@ -493,7 +492,7 @@ def use_plane_projection_factor(self, value): self._advanced_settings.UsePlaneProjectionFactor = value else: self.logger.error( - f"RaptorX setup use_plane_projection_factor setter must be a boolean. " f"Provided value {value}" + f"RaptorX setup use_plane_projection_factor setter must be a boolean. Provided value {value}" ) @property @@ -506,4 +505,4 @@ def use_relaxed_z_axis(self, value): if isinstance(value, bool): self._advanced_settings.UseRelaxedZAxis = value else: - self.logger.error(f"RaptorX setup use_relaxed_z_axis setter must be a boolean. " f"Provided value {value}") + self.logger.error(f"RaptorX setup use_relaxed_z_axis setter must be a boolean. Provided value {value}") diff --git a/src/pyedb/dotnet/database/edb_data/simulation_configuration.py b/src/pyedb/dotnet/database/edb_data/simulation_configuration.py index f907d1175b..102ff16e52 100644 --- a/src/pyedb/dotnet/database/edb_data/simulation_configuration.py +++ b/src/pyedb/dotnet/database/edb_data/simulation_configuration.py @@ -2132,7 +2132,7 @@ class SimulationConfiguration(object): Defined the radiation box type, Conformal, Bounding box and ConvexHull are supported (HFSS only). - >>> sim_setup.max_num_passes= 30 + >>> sim_setup.max_num_passes = 30 Default value is 30, specify the maximum number of adaptive passes (only HFSS). Reasonable high value is recommended to force the solver reaching the convergence criteria. @@ -2147,7 +2147,7 @@ class SimulationConfiguration(object): local minima. >>> from dotnet.generic.constants import BasisOrder - >>> sim_setup.basis_order = BasisOrder.Single + >>> sim_setup.basis_order = BasisOrder.Single Select the order basis (HFSS only), Zero, Single, Double and Mixed are supported. For Signal integrity Single or Mixed should be used. @@ -2229,7 +2229,7 @@ class SimulationConfiguration(object): Activate the loop resistance usage per pin when ``True`` - >>> sim_setup.dc_via_report_path = 'C:\\temp\\via_report_file' + >>> sim_setup.dc_via_report_path = "C:\\temp\\via_report_file" Define the via report path file. diff --git a/src/pyedb/dotnet/database/hfss.py b/src/pyedb/dotnet/database/hfss.py index d8032760c4..3fc3ade8e7 100644 --- a/src/pyedb/dotnet/database/hfss.py +++ b/src/pyedb/dotnet/database/hfss.py @@ -23,6 +23,7 @@ """ This module contains the ``EdbHfss`` class. """ + import math from pyedb.dotnet.database.edb_data.hfss_extent_info import HfssExtentInfo @@ -174,8 +175,8 @@ def create_circuit_port_on_pin(self, pos_pin, neg_pin, impedance=50, port_name=N >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_circuit_port_on_pin(pins[0], pins[1],50,"port_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_circuit_port_on_pin(pins[0], pins[1], 50, "port_name") Returns ------- @@ -211,8 +212,8 @@ def create_voltage_source_on_pin(self, pos_pin, neg_pin, voltage_value=3.3, phas >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_voltage_source_on_pin(pins[0], pins[1],50,"source_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_voltage_source_on_pin(pins[0], pins[1], 50, "source_name") """ return self._pedb.siwave.create_voltage_source_on_pin(pos_pin, neg_pin, voltage_value, phase_value, source_name) @@ -242,8 +243,8 @@ def create_current_source_on_pin(self, pos_pin, neg_pin, current_value=0.1, phas >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_current_source_on_pin(pins[0], pins[1],50,"source_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_current_source_on_pin(pins[0], pins[1], 50, "source_name") """ return self._pedb.siwave.create_current_source_on_pin(pos_pin, neg_pin, current_value, phase_value, source_name) @@ -272,8 +273,8 @@ def create_resistor_on_pin(self, pos_pin, neg_pin, rvalue=1, resistor_name=""): >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_resistor_on_pin(pins[0], pins[1],50,"res_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_resistor_on_pin(pins[0], pins[1], 50, "res_name") """ return self._pedb.siwave.create_resistor_on_pin(pos_pin, neg_pin, rvalue, resistor_name) diff --git a/src/pyedb/dotnet/database/layout_validation.py b/src/pyedb/dotnet/database/layout_validation.py index 50b394425c..8de63136d1 100644 --- a/src/pyedb/dotnet/database/layout_validation.py +++ b/src/pyedb/dotnet/database/layout_validation.py @@ -153,7 +153,7 @@ def disjoint_nets( Examples -------- - >>> renamed_nets = edb.layout_validation.disjoint_nets(["GND","Net2"]) + >>> renamed_nets = edb.layout_validation.disjoint_nets(["GND", "Net2"]) """ timer_start = self._pedb._logger.reset_timer() diff --git a/src/pyedb/dotnet/database/materials.py b/src/pyedb/dotnet/database/materials.py index b39574c283..c4d293d570 100644 --- a/src/pyedb/dotnet/database/materials.py +++ b/src/pyedb/dotnet/database/materials.py @@ -244,9 +244,7 @@ def dc_permittivity(self, value: Union[int, float]): if self.__dc_model and value: self.__dc_model.SetDCRelativePermitivity(value) else: - self.__edb.logger.error( - f"DC permittivity cannot be updated in material without DC model or value {value}." f"" - ) + self.__edb.logger.error(f"DC permittivity cannot be updated in material without DC model or value {value}.") @property def dielectric_model_frequency(self): diff --git a/src/pyedb/dotnet/database/modeler.py b/src/pyedb/dotnet/database/modeler.py index 33d8d99a1b..fa0b94ca23 100644 --- a/src/pyedb/dotnet/database/modeler.py +++ b/src/pyedb/dotnet/database/modeler.py @@ -23,6 +23,7 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + import math import warnings @@ -386,7 +387,7 @@ def get_polygon_points(self, polygon): -------- >>> poly = database.modeler.get_polygons_by_layer("GND") - >>> points = database.modeler.get_polygon_points(poly[0]) + >>> points = database.modeler.get_polygon_points(poly[0]) """ points = [] diff --git a/src/pyedb/dotnet/database/nets.py b/src/pyedb/dotnet/database/nets.py index df20282c99..af344f3e7d 100644 --- a/src/pyedb/dotnet/database/nets.py +++ b/src/pyedb/dotnet/database/nets.py @@ -574,7 +574,7 @@ def delete_nets(self, netlist): Examples -------- - >>> deleted_nets = database.nets.delete(["Net1","Net2"]) + >>> deleted_nets = database.nets.delete(["Net1", "Net2"]) """ warnings.warn("Use :func:`delete` method instead.", DeprecationWarning) return self.delete(netlist=netlist) @@ -595,7 +595,7 @@ def delete(self, netlist): Examples -------- - >>> deleted_nets = database.nets.delete(["Net1","Net2"]) + >>> deleted_nets = database.nets.delete(["Net1", "Net2"]) """ if isinstance(netlist, str): netlist = [netlist] @@ -736,7 +736,7 @@ def find_and_fix_disjoint_nets( Examples -------- - >>> renamed_nets = database.nets.find_and_fix_disjoint_nets(["GND","Net2"]) + >>> renamed_nets = database.nets.find_and_fix_disjoint_nets(["GND", "Net2"]) """ warnings.warn("Use new function :func:`edb.layout_validation.disjoint_nets` instead.", DeprecationWarning) return self._pedb.layout_validation.disjoint_nets( diff --git a/src/pyedb/dotnet/database/padstack.py b/src/pyedb/dotnet/database/padstack.py index 2ea281b541..d8cbaa501d 100644 --- a/src/pyedb/dotnet/database/padstack.py +++ b/src/pyedb/dotnet/database/padstack.py @@ -23,6 +23,7 @@ """ This module contains the `EdbPadstacks` class. """ + import math import warnings @@ -704,8 +705,9 @@ def set_all_antipad_value(self, value): ) else: # pragma no cover self._logger.error( - "Failed to reassign anti-pad value {} on Pads-stack definition {}," - " layer{}".format(str(value), padstack.edb_padstack.GetName(), layer) + "Failed to reassign anti-pad value {} on Pads-stack definition {}, layer{}".format( + str(value), padstack.edb_padstack.GetName(), layer + ) ) all_succeed = False padstack.edb_padstack.SetData(cloned_padstack_data) diff --git a/src/pyedb/dotnet/database/siwave.py b/src/pyedb/dotnet/database/siwave.py index 4cc5f6c7bf..12b56bd933 100644 --- a/src/pyedb/dotnet/database/siwave.py +++ b/src/pyedb/dotnet/database/siwave.py @@ -24,6 +24,7 @@ This module contains these classes: ``CircuitPort``, ``CurrentSource``, ``EdbSiwave``, ``PinGroup``, ``ResistorSource``, ``Source``, ``SourceType``, and ``VoltageSource``. """ + import os import time @@ -476,8 +477,8 @@ def create_resistor_on_pin(self, pos_pin, neg_pin, rvalue=1, resistor_name=""): >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.siwave.create_resistor_on_pin(pins[0], pins[1],50,"res_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.siwave.create_resistor_on_pin(pins[0], pins[1], 50, "res_name") """ resistor = ResistorSource() resistor.positive_node.net = pos_pin.GetNet().GetName() @@ -618,7 +619,7 @@ def create_voltage_source_on_net( >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> edb.siwave.create_voltage_source_on_net("U2A5","V1P5_S3","U2A5","GND",3.3,0,"source_name") + >>> edb.siwave.create_voltage_source_on_net("U2A5", "V1P5_S3", "U2A5", "GND", 3.3, 0, "source_name") """ if not negative_component_name: negative_component_name = positive_component_name diff --git a/src/pyedb/dotnet/database/stackup.py b/src/pyedb/dotnet/database/stackup.py index 6955facf21..9b0510bcff 100644 --- a/src/pyedb/dotnet/database/stackup.py +++ b/src/pyedb/dotnet/database/stackup.py @@ -1138,7 +1138,7 @@ def flip_design(self): Examples -------- - >>> edb = Edb(edbpath=targetfile, edbversion="2021.2") + >>> edb = Edb(edbpath=targetfile, edbversion="2021.2") >>> edb.stackup.flip_design() >>> edb.save() >>> edb.close_edb() @@ -1361,22 +1361,28 @@ def place_in_layout( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") >>> vector, rotation, solder_ball_height = edb1.components.get_component_placement_vector( - ... mounted_component=mounted_cmp, - ... hosting_component=hosting_cmp, - ... mounted_component_pin1="A12", - ... mounted_component_pin2="A14", - ... hosting_component_pin1="A12", - ... hosting_component_pin2="A14") - >>> edb2.stackup.place_in_layout(edb1.active_cell, angle=0.0, offset_x=vector[0], - ... offset_y=vector[1], flipped_stackup=False, place_on_top=True, - ... ) + ... mounted_component=mounted_cmp, + ... hosting_component=hosting_cmp, + ... mounted_component_pin1="A12", + ... mounted_component_pin2="A14", + ... hosting_component_pin1="A12", + ... hosting_component_pin2="A14", + ... ) + >>> edb2.stackup.place_in_layout( + ... edb1.active_cell, + ... angle=0.0, + ... offset_x=vector[0], + ... offset_y=vector[1], + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ # if flipped_stackup and place_on_top or (not flipped_stackup and not place_on_top): self.adjust_solder_dielectrics() @@ -1458,13 +1464,18 @@ def place_in_layout_3d_placement( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") - >>> edb2.stackup.place_in_layout(edb1.active_cell, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb2.stackup.place_in_layout( + ... edb1.active_cell, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ _angle = angle * math.pi / 180.0 @@ -1597,13 +1608,18 @@ def place_instance( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") - >>> edb1.stackup.place_instance(edb2, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb1.stackup.place_instance( + ... edb2, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ _angle = angle * math.pi / 180.0 @@ -1741,11 +1757,16 @@ def place_a3dcomp_3d_placement( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> a3dcomp_path = "connector.a3dcomp" - >>> edb1.stackup.place_a3dcomp_3d_placement(a3dcomp_path, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb1.stackup.place_a3dcomp_3d_placement( + ... a3dcomp_path, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ zero_data = self._edb_value(0.0) one_data = self._edb_value(1.0) @@ -1800,7 +1821,7 @@ def residual_copper_area_per_layer(self): Examples -------- - >>> edb = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb.stackup.residual_copper_area_per_layer() """ temp_data = {name: 0 for name, _ in self.signal_layers.items()} diff --git a/src/pyedb/dotnet/database/utilities/heatsink.py b/src/pyedb/dotnet/database/utilities/heatsink.py index b653faf652..df543e231b 100644 --- a/src/pyedb/dotnet/database/utilities/heatsink.py +++ b/src/pyedb/dotnet/database/utilities/heatsink.py @@ -1,5 +1,4 @@ class HeatSink: - """Heatsink model description. Parameters diff --git a/src/pyedb/dotnet/database/utilities/simulation_setup.py b/src/pyedb/dotnet/database/utilities/simulation_setup.py index 48ad455b13..6d80fee9d3 100644 --- a/src/pyedb/dotnet/database/utilities/simulation_setup.py +++ b/src/pyedb/dotnet/database/utilities/simulation_setup.py @@ -371,11 +371,13 @@ def add_frequency_sweep(self, name=None, frequency_sweep=None): Examples -------- >>> setup1 = edbapp.create_siwave_syz_setup("setup1") - >>> setup1.add_frequency_sweep(frequency_sweep=[ - ... ["linear count", "0", "1kHz", 1], - ... ["log scale", "1kHz", "0.1GHz", 10], - ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], - ... ]) + >>> setup1.add_frequency_sweep( + ... frequency_sweep=[ + ... ["linear count", "0", "1kHz", 1], + ... ["log scale", "1kHz", "0.1GHz", 10], + ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], + ... ] + ... ) """ warnings.warn("`create_component_from_pins` is deprecated. Use `add_sweep` method instead.", DeprecationWarning) return self.add_sweep(name, frequency_sweep) diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index 457eb2548b..1e2566f420 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -25,6 +25,7 @@ This module is implicitly loaded in HFSS 3D Layout when launched. """ + from itertools import combinations import os from pathlib import Path @@ -155,19 +156,19 @@ class Edb(Database): Add a new variable named "s1" to the ``Edb`` instance. - >>> app['s1'] = "0.25 mm" - >>> app['s1'].tofloat + >>> app["s1"] = "0.25 mm" + >>> app["s1"].tofloat >>> 0.00025 - >>> app['s1'].tostring + >>> app["s1"].tostring >>> "0.25mm" or add a new parameter with description: - >>> app['s2'] = ["20um", "Spacing between traces"] - >>> app['s2'].value + >>> app["s2"] = ["20um", "Spacing between traces"] + >>> app["s2"].value >>> 1.9999999999999998e-05 - >>> app['s2'].description - >>> 'Spacing between traces' + >>> app["s2"].description + >>> "Spacing between traces" Create an ``Edb`` object and open the specified project. @@ -1959,7 +1960,7 @@ def cutout( Examples -------- >>> from pyedb import Edb - >>> edb = Edb(r'C:\\test.aedb', edbversion="2022.2") + >>> edb = Edb(r"C:\\test.aedb", edbversion="2022.2") >>> edb.logger.info_timer("Edb Opening") >>> edb.logger.reset_timer() >>> start = time.time() @@ -1969,7 +1970,7 @@ def cutout( >>> signal_list.append(net) >>> power_list = ["PGND"] >>> edb.cutout(signal_list=signal_list, reference_list=power_list, extent_type="Conforming") - >>> end_time = str((time.time() - start)/60) + >>> end_time = str((time.time() - start) / 60) >>> edb.logger.info("Total legacy cutout time in min %s", end_time) >>> edb.nets.plot(signal_list, None, color_by_net=True) >>> edb.nets.plot(power_list, None, color_by_net=True) @@ -2619,7 +2620,7 @@ def create_cutout_multithread( Examples -------- >>> from pyedb import Edb - >>> edb = Edb(r'C:\\test.aedb', edbversion="2022.2") + >>> edb = Edb(r"C:\\test.aedb", edbversion="2022.2") >>> edb.logger.info_timer("Edb Opening") >>> edb.logger.reset_timer() >>> start = time.time() @@ -2629,7 +2630,7 @@ def create_cutout_multithread( >>> signal_list.append(net) >>> power_list = ["PGND"] >>> edb.create_cutout_multithread(signal_list=signal_list, reference_list=power_list, extent_type="Conforming") - >>> end_time = str((time.time() - start)/60) + >>> end_time = str((time.time() - start) / 60) >>> edb.logger.info("Total legacy cutout time in min %s", end_time) >>> edb.nets.plot(signal_list, None, color_by_net=True) >>> edb.nets.plot(power_list, None, color_by_net=True) @@ -3024,7 +3025,7 @@ def export_hfss( >>> from pyedb import Edb >>> edb = Edb(edbpath=r"C:\temp\myproject.aedb", edbversion="2023.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\temp", options_config) >>> edb.export_hfss(r"C:\temp") """ @@ -3066,7 +3067,7 @@ def export_q3d( >>> from pyedb import Edb >>> edb = Edb(edbpath=r"C:\temp\myproject.aedb", edbversion="2021.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\temp", options_config) >>> edb.export_q3d(r"C:\temp") """ @@ -3118,7 +3119,7 @@ def export_maxwell( >>> edb = Edb(edbpath=r"C:\temp\myproject.aedb", edbversion="2021.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\temp", options_config) >>> edb.export_maxwell(r"C:\temp") """ @@ -3278,8 +3279,8 @@ def add_project_variable(self, variable_name, variable_value, description=""): >>> from pyedb import Edb >>> edb_app = Edb() >>> boolean_1, ant_length = edb_app.add_project_variable("my_local_variable", "1cm") - >>> print(edb_app["$my_local_variable"]) #using getitem - >>> edb_app["$my_local_variable"] = "1cm" #using setitem + >>> print(edb_app["$my_local_variable"]) # using getitem + >>> edb_app["$my_local_variable"] = "1cm" # using setitem """ if not variable_name.startswith("$"): @@ -3317,8 +3318,8 @@ def add_design_variable(self, variable_name, variable_value, is_parameter=False, >>> from pyedb import Edb >>> edb_app = Edb() >>> boolean_1, ant_length = edb_app.add_design_variable("my_local_variable", "1cm") - >>> print(edb_app["my_local_variable"]) #using getitem - >>> edb_app["my_local_variable"] = "1cm" #using setitem + >>> print(edb_app["my_local_variable"]) # using getitem + >>> edb_app["my_local_variable"] = "1cm" # using setitem >>> boolean_2, para_length = edb_app.change_design_variable_value("my_parameter", "1m", is_parameter=True >>> boolean_3, project_length = edb_app.change_design_variable_value("$my_project_variable", "1m") @@ -3358,7 +3359,7 @@ def change_design_variable_value(self, variable_name, variable_value): >>> edb_app = Edb() >>> boolean, ant_length = edb_app.add_design_variable("ant_length", "1cm") >>> boolean, ant_length = edb_app.change_design_variable_value("ant_length", "1m") - >>> print(edb_app["ant_length"]) #using getitem + >>> print(edb_app["ant_length"]) # using getitem """ var_server = self.variable_exists(variable_name) if var_server[0]: @@ -3825,11 +3826,13 @@ def create_siwave_syz_setup(self, name=None, **kwargs): >>> from pyedb import Edb >>> edbapp = Edb() >>> setup1 = edbapp.create_siwave_syz_setup("setup1") - >>> setup1.add_frequency_sweep(frequency_sweep=[ - ... ["linear count", "0", "1kHz", 1], - ... ["log scale", "1kHz", "0.1GHz", 10], - ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], - ... ]) + >>> setup1.add_frequency_sweep( + ... frequency_sweep=[ + ... ["linear count", "0", "1kHz", 1], + ... ["log scale", "1kHz", "0.1GHz", 10], + ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], + ... ] + ... ) """ if not name: name = generate_unique_name("Siwave_SYZ") @@ -4584,8 +4587,7 @@ def create_model_for_arbitrary_wave_ports( ] if not polys: self.logger.error( - f"No polygon found with voids on layer {reference_layer} during model creation for " - f"arbitrary wave ports" + f"No polygon found with voids on layer {reference_layer} during model creation for arbitrary wave ports" ) return False void_padstacks = [] @@ -4603,7 +4605,7 @@ def create_model_for_arbitrary_wave_ports( if not void_padstacks: self.logger.error( - "No padstack instances found inside evaluated voids during model creation for arbitrary" "waveports" + "No padstack instances found inside evaluated voids during model creation for arbitrarywaveports" ) return False cloned_edb = Edb(edbpath=output_edb, edbversion=self.edbversion) diff --git a/src/pyedb/exceptions.py b/src/pyedb/exceptions.py index d355c16bab..622bd83f85 100644 --- a/src/pyedb/exceptions.py +++ b/src/pyedb/exceptions.py @@ -1,5 +1,4 @@ -""" -""" +""" """ class MaterialModelException(Exception): diff --git a/src/pyedb/generic/data_handlers.py b/src/pyedb/generic/data_handlers.py index 14ccb5b7cb..68598692ac 100644 --- a/src/pyedb/generic/data_handlers.py +++ b/src/pyedb/generic/data_handlers.py @@ -143,28 +143,28 @@ def from_rkm(code): # pragma: no cover Examples -------- - >>> from_rkm('R47') + >>> from_rkm("R47") '0.47' - >>> from_rkm('4R7') + >>> from_rkm("4R7") '4.7' - >>> from_rkm('470R') + >>> from_rkm("470R") '470' - >>> from_rkm('4K7') + >>> from_rkm("4K7") '4.7k' - >>> from_rkm('47K') + >>> from_rkm("47K") '47k' - >>> from_rkm('47K3') + >>> from_rkm("47K3") '47.3k' - >>> from_rkm('470K') + >>> from_rkm("470K") '470k' - >>> from_rkm('4M7') + >>> from_rkm("4M7") '4.7M' """ diff --git a/src/pyedb/generic/design_types.py b/src/pyedb/generic/design_types.py index bdda08115a..a72ffc982e 100644 --- a/src/pyedb/generic/design_types.py +++ b/src/pyedb/generic/design_types.py @@ -87,19 +87,19 @@ def Edb( Add a new variable named "s1" to the ``Edb`` instance. - >>> app['s1'] = "0.25 mm" - >>> app['s1'].tofloat + >>> app["s1"] = "0.25 mm" + >>> app["s1"].tofloat >>> 0.00025 - >>> app['s1'].tostring + >>> app["s1"].tostring >>> "0.25mm" or add a new parameter with description: - >>> app['s2'] = ["20um", "Spacing between traces"] - >>> app['s2'].value + >>> app["s2"] = ["20um", "Spacing between traces"] + >>> app["s2"].value >>> 1.9999999999999998e-05 - >>> app['s2'].description - >>> 'Spacing between traces' + >>> app["s2"].description + >>> "Spacing between traces" Create an ``Edb`` object and open the specified project. diff --git a/src/pyedb/grpc/database/components.py b/src/pyedb/grpc/database/components.py index 1d1f18d2c8..9334c2747a 100644 --- a/src/pyedb/grpc/database/components.py +++ b/src/pyedb/grpc/database/components.py @@ -20,9 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""This module contains the `Components` class. +"""This module contains the `Components` class.""" -""" import codecs import json import math @@ -547,16 +546,17 @@ def get_component_placement_vector( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") >>> vector, rotation, solder_ball_height = edb1.components.get_component_placement_vector( - ... mounted_component=mounted_cmp, - ... hosting_component=hosting_cmp, - ... mounted_component_pin1="A12", - ... mounted_component_pin2="A14", - ... hosting_component_pin1="A12", - ... hosting_component_pin2="A14") + ... mounted_component=mounted_cmp, + ... hosting_component=hosting_cmp, + ... mounted_component_pin1="A12", + ... mounted_component_pin2="A14", + ... hosting_component_pin1="A12", + ... hosting_component_pin2="A14", + ... ) """ m_pin1_pos = [0.0, 0.0] m_pin2_pos = [0.0, 0.0] @@ -939,7 +939,7 @@ def deactivate_rlc_component(self, component=None, create_circuit_port=False, pe Examples -------- >>> from pyedb import Edb - >>> edb_file = r'C:\my_edb_file.aedb' + >>> edb_file = r"C:\my_edb_file.aedb" >>> edb = Edb(edb_file) >>> for cmp in list(edb.components.instances.keys()): >>> edb.components.deactivate_rlc_component(component=cmp, create_circuit_port=False) @@ -1284,9 +1284,9 @@ def set_component_model(self, componentname, model_type="Spice", modelpath=None, >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder") - >>> edbapp.components.set_component_model("A1", model_type="Spice", - ... modelpath="pathtospfile", - ... modelname="spicemodelname") + >>> edbapp.components.set_component_model( + ... "A1", model_type="Spice", modelpath="pathtospfile", modelname="spicemodelname" + ... ) """ if not modelname: @@ -1634,9 +1634,7 @@ def set_component_rlc( >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder") - >>> edbapp.components.set_component_rlc( - ... "R1", res_value=50, ind_value=1e-9, cap_value=1e-12, isparallel=False - ... ) + >>> edbapp.components.set_component_rlc("R1", res_value=50, ind_value=1e-9, cap_value=1e-12, isparallel=False) """ if res_value is None and ind_value is None and cap_value is None: diff --git a/src/pyedb/grpc/database/definition/padstack_def.py b/src/pyedb/grpc/database/definition/padstack_def.py index 5719dab5b2..a310e225d5 100644 --- a/src/pyedb/grpc/database/definition/padstack_def.py +++ b/src/pyedb/grpc/database/definition/padstack_def.py @@ -717,7 +717,7 @@ def convert_to_3d_microvias(self, convert_only_signal_vias=True, hole_wall_angle s3d.add_member(cloned_circle2) if not self.data.material.value: self._pedb.logger.warning( - f"Padstack definution {self.name} has no material defined." f"Defaulting to copper" + f"Padstack definution {self.name} has no material defined.Defaulting to copper" ) self.data.material = "copper" s3d.set_material(self.data.material.value) diff --git a/src/pyedb/grpc/database/hfss.py b/src/pyedb/grpc/database/hfss.py index 4bcdfce15e..ca3e0d0bcf 100644 --- a/src/pyedb/grpc/database/hfss.py +++ b/src/pyedb/grpc/database/hfss.py @@ -23,6 +23,7 @@ """ This module contains the ``EdbHfss`` class. """ + import math import warnings @@ -197,8 +198,8 @@ def create_voltage_source_on_pin(self, pos_pin, neg_pin, voltage_value=3.3, phas >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_voltage_source_on_pin(pins[0], pins[1],50,"source_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_voltage_source_on_pin(pins[0], pins[1], 50, "source_name") """ warnings.warn( "`create_voltage_source_on_pin` is deprecated and is now located here " @@ -238,8 +239,8 @@ def create_current_source_on_pin(self, pos_pin, neg_pin, current_value=0.1, phas >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_current_source_on_pin(pins[0], pins[1],50,"source_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_current_source_on_pin(pins[0], pins[1], 50, "source_name") """ warnings.warn( "`create_current_source_on_pin` is deprecated and is now located here " @@ -277,8 +278,8 @@ def create_resistor_on_pin(self, pos_pin, neg_pin, rvalue=1, resistor_name=""): >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.hfss.create_resistor_on_pin(pins[0], pins[1],50,"res_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.hfss.create_resistor_on_pin(pins[0], pins[1], 50, "res_name") """ warnings.warn( "`create_resistor_on_pin` is deprecated and is now located here " diff --git a/src/pyedb/grpc/database/hierarchy/component.py b/src/pyedb/grpc/database/hierarchy/component.py index 398e683864..51da44fec8 100644 --- a/src/pyedb/grpc/database/hierarchy/component.py +++ b/src/pyedb/grpc/database/hierarchy/component.py @@ -1086,7 +1086,7 @@ def assign_s_param_model(self, file_path, name=None, reference_net=None): return False if not reference_net: self._pedb.logger.warning( - f"No reference net provided for S parameter file {file_path}, net `GND` is " f"assigned by default" + f"No reference net provided for S parameter file {file_path}, net `GND` is assigned by default" ) reference_net = "GND" n_port_model = GrpcNPortComponentModel.find_by_name(self.component_def, name) diff --git a/src/pyedb/grpc/database/layout/layout.py b/src/pyedb/grpc/database/layout/layout.py index 64c628e73b..71a2350294 100644 --- a/src/pyedb/grpc/database/layout/layout.py +++ b/src/pyedb/grpc/database/layout/layout.py @@ -23,6 +23,7 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + from typing import Union from ansys.edb.core.layout.layout import Layout as GrpcLayout diff --git a/src/pyedb/grpc/database/layout_validation.py b/src/pyedb/grpc/database/layout_validation.py index e1a11c1793..d10b663370 100644 --- a/src/pyedb/grpc/database/layout_validation.py +++ b/src/pyedb/grpc/database/layout_validation.py @@ -155,7 +155,7 @@ def disjoint_nets( Examples -------- - >>> renamed_nets = edb.layout_validation.disjoint_nets(["GND","Net2"]) + >>> renamed_nets = edb.layout_validation.disjoint_nets(["GND", "Net2"]) """ timer_start = self._pedb.logger.reset_timer() diff --git a/src/pyedb/grpc/database/modeler.py b/src/pyedb/grpc/database/modeler.py index 59a0c21992..c4659b1984 100644 --- a/src/pyedb/grpc/database/modeler.py +++ b/src/pyedb/grpc/database/modeler.py @@ -23,6 +23,7 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + import math from ansys.edb.core.geometry.arc_data import ArcData as GrpcArcData @@ -407,7 +408,7 @@ def get_polygon_points(polygon): -------- >>> poly = database.modeler.get_polygons_by_layer("GND") - >>> points = database.modeler.get_polygon_points(poly[0]) + >>> points = database.modeler.get_polygon_points(poly[0]) """ points = [] @@ -1243,7 +1244,7 @@ def defeature_polygon(self, poly, tolerance=0.001): new_poly = poly.polygon_data.defeature(tol=tolerance) if not new_poly.points: self._pedb.logger.error( - f"Defeaturing on polygon {poly.id} returned empty polygon, tolerance threshold " f"might too large. " + f"Defeaturing on polygon {poly.id} returned empty polygon, tolerance threshold might too large. " ) return False poly.polygon_data = new_poly diff --git a/src/pyedb/grpc/database/net/net.py b/src/pyedb/grpc/database/net/net.py index c3721062c0..85918f6380 100644 --- a/src/pyedb/grpc/database/net/net.py +++ b/src/pyedb/grpc/database/net/net.py @@ -40,8 +40,8 @@ class Net(GrpcNet): >>> from pyedb import Edb >>> edb = Edb(myedb, edbversion="2021.2") >>> edb_net = edb.nets.nets["GND"] - >>> edb_net.name # Class Property - >>> edb_net.name # EDB Object Property + >>> edb_net.name # Class Property + >>> edb_net.name # EDB Object Property """ def __init__(self, pedb, raw_net): diff --git a/src/pyedb/grpc/database/nets.py b/src/pyedb/grpc/database/nets.py index 77bf43a9ca..1add545b47 100644 --- a/src/pyedb/grpc/database/nets.py +++ b/src/pyedb/grpc/database/nets.py @@ -470,7 +470,7 @@ def delete(self, netlist): Examples -------- - >>> deleted_nets = database.nets.delete(["Net1","Net2"]) + >>> deleted_nets = database.nets.delete(["Net1", "Net2"]) """ if isinstance(netlist, str): netlist = [netlist] @@ -607,7 +607,7 @@ def find_and_fix_disjoint_nets( Examples -------- - >>> renamed_nets = database.nets.find_and_fix_disjoint_nets(["GND","Net2"]) + >>> renamed_nets = database.nets.find_and_fix_disjoint_nets(["GND", "Net2"]) """ warnings.warn("Use new function :func:`edb.layout_validation.disjoint_nets` instead.", DeprecationWarning) return self._pedb.layout_validation.disjoint_nets( diff --git a/src/pyedb/grpc/database/padstacks.py b/src/pyedb/grpc/database/padstacks.py index 784fa34c2b..4cccb000ae 100644 --- a/src/pyedb/grpc/database/padstacks.py +++ b/src/pyedb/grpc/database/padstacks.py @@ -23,6 +23,7 @@ """ This module contains the `EdbPadstacks` class. """ + import math import warnings @@ -286,7 +287,7 @@ def pingroups(self): List of all layout pin groups. """ warnings.warn( - "`pingroups` is deprecated and is now located here " "`pyedb.grpc.core.layout.pin_groups` instead.", + "`pingroups` is deprecated and is now located here `pyedb.grpc.core.layout.pin_groups` instead.", DeprecationWarning, ) return self._layout.pin_groups diff --git a/src/pyedb/grpc/database/primitive/primitive.py b/src/pyedb/grpc/database/primitive/primitive.py index 6c2486c109..2f11eda41d 100644 --- a/src/pyedb/grpc/database/primitive/primitive.py +++ b/src/pyedb/grpc/database/primitive/primitive.py @@ -38,8 +38,8 @@ class Primitive(GrpcPrimitive): >>> from pyedb import Edb >>> edb = Edb(myedb, edbversion="2021.2") >>> edb_prim = edb.modeler.primitives[0] - >>> edb_prim.is_void # Class Property - >>> edb_prim.IsVoid() # EDB Object Property + >>> edb_prim.is_void # Class Property + >>> edb_prim.IsVoid() # EDB Object Property """ def __init__(self, pedb, edb_object): diff --git a/src/pyedb/grpc/database/siwave.py b/src/pyedb/grpc/database/siwave.py index 077ea1590a..ff9d3952cf 100644 --- a/src/pyedb/grpc/database/siwave.py +++ b/src/pyedb/grpc/database/siwave.py @@ -24,6 +24,7 @@ This module contains these classes: ``CircuitPort``, ``CurrentSource``, ``EdbSiwave``, ``PinGroup``, ``ResistorSource``, ``Source``, ``SourceType``, and ``VoltageSource``. """ + import os import warnings @@ -298,7 +299,7 @@ def _check_gnd(self, component_name): """ warnings.warn( - "`_check_gnd` is deprecated and is now located here " "`pyedb.grpc.core.excitations._check_gnd` instead.", + "`_check_gnd` is deprecated and is now located here `pyedb.grpc.core.excitations._check_gnd` instead.", DeprecationWarning, ) return self._pedb.source_excitation._check_gnd(component_name) diff --git a/src/pyedb/grpc/database/source_excitations.py b/src/pyedb/grpc/database/source_excitations.py index 3c1db9ba5e..23722d8c0e 100644 --- a/src/pyedb/grpc/database/source_excitations.py +++ b/src/pyedb/grpc/database/source_excitations.py @@ -1110,8 +1110,8 @@ def create_resistor_on_pin(self, pos_pin, neg_pin, rvalue=1, resistor_name=""): >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> pins =edbapp.components.get_pin_from_component("U2A5") - >>> edbapp.excitation.create_resistor_on_pin(pins[0], pins[1],50,"res_name") + >>> pins = edbapp.components.get_pin_from_component("U2A5") + >>> edbapp.excitation.create_resistor_on_pin(pins[0], pins[1], 50, "res_name") """ if not resistor_name: resistor_name = ( @@ -1373,7 +1373,7 @@ def create_voltage_source_on_net( >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> edb.excitations.create_voltage_source_on_net("U2A5","V1P5_S3","U2A5","GND",3.3,0,"source_name") + >>> edb.excitations.create_voltage_source_on_net("U2A5", "V1P5_S3", "U2A5", "GND", 3.3, 0, "source_name") """ if not negative_component_name: negative_component_name = positive_component_name @@ -1384,8 +1384,7 @@ def create_voltage_source_on_net( if not source_name: source_name = ( - f"Vsource_{positive_component_name}_{positive_net_name}_" - f"{negative_component_name}_{negative_net_name}" + f"Vsource_{positive_component_name}_{positive_net_name}_{negative_component_name}_{negative_net_name}" ) return self.create_pin_group_terminal( positive_pins=pos_node_pins, @@ -1437,7 +1436,7 @@ def create_current_source_on_net( >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", "project name", "release version") - >>> edb.excitations.create_voltage_source_on_net("U2A5","V1P5_S3","U2A5","GND",3.3,0,"source_name") + >>> edb.excitations.create_voltage_source_on_net("U2A5", "V1P5_S3", "U2A5", "GND", 3.3, 0, "source_name") """ if not negative_component_name: negative_component_name = positive_component_name @@ -1448,8 +1447,7 @@ def create_current_source_on_net( if not source_name: source_name = ( - f"Vsource_{positive_component_name}_{positive_net_name}_" - f"{negative_component_name}_{negative_net_name}" + f"Vsource_{positive_component_name}_{positive_net_name}_{negative_component_name}_{negative_net_name}" ) return self.create_pin_group_terminal( positive_pins=pos_node_pins, diff --git a/src/pyedb/grpc/database/stackup.py b/src/pyedb/grpc/database/stackup.py index e541b3fc25..bd4019fbb1 100644 --- a/src/pyedb/grpc/database/stackup.py +++ b/src/pyedb/grpc/database/stackup.py @@ -930,7 +930,7 @@ def flip_design(self): Examples -------- - >>> edb = Edb(edbpath=targetfile, edbversion="2021.2") + >>> edb = Edb(edbpath=targetfile, edbversion="2021.2") >>> edb.stackup.flip_design() >>> edb.save() >>> edb.close_edb() @@ -1124,22 +1124,28 @@ def place_in_layout( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") >>> vector, rotation, solder_ball_height = edb1.components.get_component_placement_vector( - ... mounted_component=mounted_cmp, - ... hosting_component=hosting_cmp, - ... mounted_component_pin1="A12", - ... mounted_component_pin2="A14", - ... hosting_component_pin1="A12", - ... hosting_component_pin2="A14") - >>> edb2.stackup.place_in_layout(edb1.active_cell, angle=0.0, offset_x=vector[0], - ... offset_y=vector[1], flipped_stackup=False, place_on_top=True, - ... ) + ... mounted_component=mounted_cmp, + ... hosting_component=hosting_cmp, + ... mounted_component_pin1="A12", + ... mounted_component_pin2="A14", + ... hosting_component_pin1="A12", + ... hosting_component_pin2="A14", + ... ) + >>> edb2.stackup.place_in_layout( + ... edb1.active_cell, + ... angle=0.0, + ... offset_x=vector[0], + ... offset_y=vector[1], + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ # if flipped_stackup and place_on_top or (not flipped_stackup and not place_on_top): self.adjust_solder_dielectrics() @@ -1216,13 +1222,18 @@ def place_in_layout_3d_placement( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") - >>> edb2.stackup.place_in_layout(edb1.active_cell, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb2.stackup.place_in_layout( + ... edb1.active_cell, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ _angle = angle * math.pi / 180.0 @@ -1349,13 +1360,18 @@ def place_instance( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") - >>> edb1.stackup.place_instance(edb2, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb1.stackup.place_instance( + ... edb2, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ _angle = angle * math.pi / 180.0 @@ -1485,11 +1501,16 @@ def place_a3dcomp_3d_placement( Examples -------- - >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> a3dcomp_path = "connector.a3dcomp" - >>> edb1.stackup.place_a3dcomp_3d_placement(a3dcomp_path, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb1.stackup.place_a3dcomp_3d_placement( + ... a3dcomp_path, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ zero_data = GrpcValue(0.0) one_data = GrpcValue(1.0) @@ -1535,7 +1556,7 @@ def residual_copper_area_per_layer(self): Examples -------- - >>> edb = Edb(edbpath=targetfile1, edbversion="2021.2") + >>> edb = Edb(edbpath=targetfile1, edbversion="2021.2") >>> edb.stackup.residual_copper_area_per_layer() """ temp_data = {name: 0 for name, _ in self.signal_layers.items()} diff --git a/src/pyedb/grpc/database/utility/heat_sink.py b/src/pyedb/grpc/database/utility/heat_sink.py index a8aa3f1e30..b103e4c502 100644 --- a/src/pyedb/grpc/database/utility/heat_sink.py +++ b/src/pyedb/grpc/database/utility/heat_sink.py @@ -27,7 +27,6 @@ class HeatSink: - """Heatsink model description. Parameters diff --git a/src/pyedb/grpc/database/utility/simulation_configuration.py b/src/pyedb/grpc/database/utility/simulation_configuration.py index 8d1654e370..a4616657ef 100644 --- a/src/pyedb/grpc/database/utility/simulation_configuration.py +++ b/src/pyedb/grpc/database/utility/simulation_configuration.py @@ -2134,7 +2134,7 @@ class SimulationConfiguration(object): Defined the radiation box type, Conformal, Bounding box and ConvexHull are supported (HFSS only). - >>> sim_setup.max_num_passes= 30 + >>> sim_setup.max_num_passes = 30 Default value is 30, specify the maximum number of adaptive passes (only HFSS). Reasonable high value is recommended to force the solver reaching the convergence criteria. @@ -2149,7 +2149,7 @@ class SimulationConfiguration(object): local minima. >>> from pyedb.generic.constants import BasisOrder - >>> sim_setup.basis_order = BasisOrder.Single + >>> sim_setup.basis_order = BasisOrder.Single Select the order basis (HFSS only), Zero, Single, Double and Mixed are supported. For Signal integrity Single or Mixed should be used. @@ -2231,7 +2231,7 @@ class SimulationConfiguration(object): Activate the loop resistance usage per pin when ``True`` - >>> sim_setup.dc_via_report_path = 'C:\\temp\\via_report_file' + >>> sim_setup.dc_via_report_path = "C:\\temp\\via_report_file" Define the via report path file. diff --git a/src/pyedb/grpc/edb.py b/src/pyedb/grpc/edb.py index dba745140b..143374accc 100644 --- a/src/pyedb/grpc/edb.py +++ b/src/pyedb/grpc/edb.py @@ -154,8 +154,8 @@ class Edb(EdbInit): Add a new variable named "s1" to the ``Edb`` instance. - >>> app['s1'] = "0.25 mm" - >>> app['s1'] + >>> app["s1"] = "0.25 mm" + >>> app["s1"] >>> 0.00025 Create an ``Edb`` object and open the specified project. @@ -1206,7 +1206,7 @@ def get_connected_objects(self, layout_object_instance): continue except: self.logger.warning( - f"Failed to find connected objects on layout_obj " f"{layout_object_instance.layout_obj.id}, skipping." + f"Failed to find connected objects on layout_obj {layout_object_instance.layout_obj.id}, skipping." ) pass return temp @@ -1478,7 +1478,7 @@ def import_gds_file( command = [ anstranslator_full_path, inputGDS, - f'-o="{control_file_temp}"' f'-t="{tech_file}"', + f'-o="{control_file_temp}"-t="{tech_file}"', f'-g="{map_file}"', f'-f="{layer_filter}"', ] @@ -1826,7 +1826,7 @@ def cutout( Examples -------- >>> from pyedb import Edb - >>> edb = Edb(r'C:\\test.aedb', edbversion="2022.2") + >>> edb = Edb(r"C:\\test.aedb", edbversion="2022.2") >>> edb.logger.info_timer("Edb Opening") >>> edb.logger.reset_timer() >>> start = time.time() @@ -1836,7 +1836,7 @@ def cutout( >>> signal_list.append(net) >>> power_list = ["PGND"] >>> edb.cutout(signal_list=signal_list, reference_list=power_list, extent_type="Conforming") - >>> end_time = str((time.time() - start)/60) + >>> end_time = str((time.time() - start) / 60) >>> edb.logger.info("Total legacy cutout time in min %s", end_time) >>> edb.nets.plot(signal_list, None, color_by_net=True) >>> edb.nets.plot(power_list, None, color_by_net=True) @@ -2595,7 +2595,7 @@ def export_hfss( >>> from pyedb import Edb >>> edb = Edb(edbpath=r"C:\temp\myproject.aedb", edbversion="2023.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\temp", options_config) >>> edb.export_hfss(r"C:\temp") """ @@ -2637,7 +2637,7 @@ def export_q3d( >>> from pyedb import Edb >>> edb = Edb(edbpath=r"C:\temp\myproject.aedb", edbversion="2021.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\temp", options_config) >>> edb.export_q3d(r"C:\temp") """ @@ -2689,7 +2689,7 @@ def export_maxwell( >>> edb = Edb(edbpath=r"C:\temp\myproject.aedb", edbversion="2021.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\temp", options_config) >>> edb.export_maxwell(r"C:\temp") """ @@ -2840,8 +2840,8 @@ def add_project_variable(self, variable_name, variable_value): >>> from pyedb import Edb >>> edb_app = Edb() >>> boolean_1, ant_length = edb_app.add_project_variable("my_local_variable", "1cm") - >>> print(edb_app["$my_local_variable"]) #using getitem - >>> edb_app["$my_local_variable"] = "1cm" #using setitem + >>> print(edb_app["$my_local_variable"]) # using getitem + >>> edb_app["$my_local_variable"] = "1cm" # using setitem """ if not variable_name.startswith("$"): @@ -2876,8 +2876,8 @@ def add_design_variable(self, variable_name, variable_value, is_parameter=False) >>> from pyedb import Edb >>> edb_app = Edb() >>> boolean_1, ant_length = edb_app.add_design_variable("my_local_variable", "1cm") - >>> print(edb_app["my_local_variable"]) #using getitem - >>> edb_app["my_local_variable"] = "1cm" #using setitem + >>> print(edb_app["my_local_variable"]) # using getitem + >>> edb_app["my_local_variable"] = "1cm" # using setitem >>> boolean_2, para_length = edb_app.change_design_variable_value("my_parameter", "1m", is_parameter=True >>> boolean_3, project_length = edb_app.change_design_variable_value("$my_project_variable", "1m") @@ -2912,7 +2912,7 @@ def change_design_variable_value(self, variable_name, variable_value): >>> edb_app = Edb() >>> boolean, ant_length = edb_app.add_design_variable("ant_length", "1cm") >>> boolean, ant_length = edb_app.change_design_variable_value("ant_length", "1m") - >>> print(edb_app["ant_length"]) #using getitem + >>> print(edb_app["ant_length"]) # using getitem """ if self.variable_exists(variable_name): if variable_name in self.db.get_all_variable_names(): @@ -3110,7 +3110,7 @@ def create_hfss_setup(self, name=None, start_frequency="0GHz", stop_frequency="2 """ warnings.warn( - "`create_hfss_setup` is deprecated and is now located here " "`pyedb.grpc.core.hfss.add_setup` instead.", + "`create_hfss_setup` is deprecated and is now located here `pyedb.grpc.core.hfss.add_setup` instead.", DeprecationWarning, ) return self._hfss.add_setup( @@ -3193,11 +3193,13 @@ def create_siwave_syz_setup(self, name=None, **kwargs): >>> from pyedb import Edb >>> edbapp = Edb() >>> setup1 = edbapp.create_siwave_syz_setup("setup1") - >>> setup1.add_frequency_sweep(frequency_sweep=[ - ... ["linear count", "0", "1kHz", 1], - ... ["log scale", "1kHz", "0.1GHz", 10], - ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], - ... ]) + >>> setup1.add_frequency_sweep( + ... frequency_sweep=[ + ... ["linear count", "0", "1kHz", 1], + ... ["log scale", "1kHz", "0.1GHz", 10], + ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], + ... ] + ... ) """ if not name: name = generate_unique_name("Siwave_SYZ") @@ -3969,8 +3971,7 @@ def create_model_for_arbitrary_wave_ports( ] if not polys: self.logger.error( - f"No polygon found with voids on layer {reference_layer} during model creation for " - f"arbitrary wave ports" + f"No polygon found with voids on layer {reference_layer} during model creation for arbitrary wave ports" ) return False void_padstacks = [] @@ -3983,7 +3984,7 @@ def create_model_for_arbitrary_wave_ports( if not void_padstacks: self.logger.error( - "No padstack instances found inside evaluated voids during model creation for arbitrary" "waveports" + "No padstack instances found inside evaluated voids during model creation for arbitrarywaveports" ) return False cloned_edb = Edb(edbpath=output_edb, edbversion=self.edbversion, restart_rpc_server=True) diff --git a/src/pyedb/grpc/edb_init.py b/src/pyedb/grpc/edb_init.py index add7123ac1..57cee78660 100644 --- a/src/pyedb/grpc/edb_init.py +++ b/src/pyedb/grpc/edb_init.py @@ -22,6 +22,7 @@ """Database.""" + import atexit import os import signal diff --git a/src/pyedb/ipc2581/ipc2581.py b/src/pyedb/ipc2581/ipc2581.py index f59614ea7f..0b287762b2 100644 --- a/src/pyedb/ipc2581/ipc2581.py +++ b/src/pyedb/ipc2581/ipc2581.py @@ -89,9 +89,9 @@ def add_pdstack_definition(self): self.from_meter_to_units(pad.parameters_values[0], self.units) ) if not primitive_ref in self.content.standard_geometries_dict.standard_circ_dict: - self.content.standard_geometries_dict.standard_circ_dict[ - primitive_ref - ] = self.from_meter_to_units(pad.parameters_values[0], self.units) + self.content.standard_geometries_dict.standard_circ_dict[primitive_ref] = ( + self.from_meter_to_units(pad.parameters_values[0], self.units) + ) elif pad.geometry_type == 2: primitive_ref = "RECT_{}_{}".format( self.from_meter_to_units(pad.parameters_values[0], self.units), @@ -135,9 +135,9 @@ def add_pdstack_definition(self): self.from_meter_to_units(antipad.parameters_values[0], self.units) ) if not primitive_ref in self.content.standard_geometries_dict.standard_circ_dict: - self.content.standard_geometries_dict.standard_circ_dict[ - primitive_ref - ] = self.from_meter_to_units(antipad.parameters_values[0], self.units) + self.content.standard_geometries_dict.standard_circ_dict[primitive_ref] = ( + self.from_meter_to_units(antipad.parameters_values[0], self.units) + ) elif antipad.geometry_type == 2: primitive_ref = "RECT_{}_{}".format( self.from_meter_to_units(antipad.parameters_values[0], self.units), diff --git a/src/pyedb/misc/downloads.py b/src/pyedb/misc/downloads.py index da52ed8ec5..54e1932ee3 100644 --- a/src/pyedb/misc/downloads.py +++ b/src/pyedb/misc/downloads.py @@ -21,6 +21,7 @@ # SOFTWARE. """Download example datasets from https://github.com/pyansys/example-data""" + import os import shutil import tempfile diff --git a/src/pyedb/misc/misc.py b/src/pyedb/misc/misc.py index 6116e821d4..75a3b02352 100644 --- a/src/pyedb/misc/misc.py +++ b/src/pyedb/misc/misc.py @@ -21,6 +21,7 @@ # SOFTWARE. """Miscellaneous Methods for PyEDB.""" + import os import warnings diff --git a/src/pyedb/misc/utilities.py b/src/pyedb/misc/utilities.py index 52ddc13cf8..f15ed60926 100644 --- a/src/pyedb/misc/utilities.py +++ b/src/pyedb/misc/utilities.py @@ -22,7 +22,6 @@ """Module gathering utility functions for PyEDB modules.""" - import math diff --git a/src/pyedb/modeler/geometry_operators.py b/src/pyedb/modeler/geometry_operators.py index b68a47c273..60addce820 100644 --- a/src/pyedb/modeler/geometry_operators.py +++ b/src/pyedb/modeler/geometry_operators.py @@ -62,12 +62,12 @@ def parse_dim_arg(string, scale_to_unit=None, variable_manager=None): # pragma: Parse `'"2mm"'`. >>> from pyedb.modeler.geometry_operators import GeometryOperators as go - >>> go.parse_dim_arg('2mm') + >>> go.parse_dim_arg("2mm") >>> 0.002 Use the optional argument ``scale_to_unit`` to specify the destination unit. - >>> go.parse_dim_arg('2mm', scale_to_unit='mm') + >>> go.parse_dim_arg("2mm", scale_to_unit="mm") >>> 2.0 """ @@ -1457,7 +1457,7 @@ def v_angle_sign(va, vb, vn, right_handed=True): # pragma: no cover if GeometryOperators.v_norm(cross) < tol: return math.pi assert GeometryOperators.is_collinear(cross, vn), ( - "vn must be the normal to the " "plane containing va and vb." + "vn must be the normal to the plane containing va and vb." ) # pragma: no cover vnn = GeometryOperators.normalize_vector(vn) @@ -1589,6 +1589,7 @@ def are_segments_intersecting(a1, a2, b1, b2, include_collinear=True): ``True`` if the segments are intersecting. ``False`` otherwise. """ + # fmt: off def on_segment(p, q, r): # Given three collinear points p, q, r, the function checks if point q lies on line-segment 'pr' diff --git a/tests/grpc/system/conftest.py b/tests/grpc/system/conftest.py index 772923ee8b..9728102c88 100644 --- a/tests/grpc/system/conftest.py +++ b/tests/grpc/system/conftest.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""" -""" +""" """ import os from os.path import dirname diff --git a/tests/grpc/system/test_edb.py b/tests/grpc/system/test_edb.py index bddadd7a11..2de3664fc1 100644 --- a/tests/grpc/system/test_edb.py +++ b/tests/grpc/system/test_edb.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import os from typing import Sequence diff --git a/tests/grpc/system/test_edb_components.py b/tests/grpc/system/test_edb_components.py index ac9af2ceb0..55f286e365 100644 --- a/tests/grpc/system/test_edb_components.py +++ b/tests/grpc/system/test_edb_components.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb components -""" +"""Tests related to Edb components""" + import math import os diff --git a/tests/grpc/system/test_edb_definition.py b/tests/grpc/system/test_edb_definition.py index 89058aec68..a2e8736901 100644 --- a/tests/grpc/system/test_edb_definition.py +++ b/tests/grpc/system/test_edb_definition.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb component definitions -""" +"""Tests related to Edb component definitions""" + import os import pytest diff --git a/tests/grpc/system/test_edb_differential_pairs.py b/tests/grpc/system/test_edb_differential_pairs.py index 131430f9de..c2c047d00f 100644 --- a/tests/grpc/system/test_edb_differential_pairs.py +++ b/tests/grpc/system/test_edb_differential_pairs.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb differential pairs -""" +"""Tests related to Edb differential pairs""" import pytest diff --git a/tests/grpc/system/test_edb_extended_nets.py b/tests/grpc/system/test_edb_extended_nets.py index 80ac0d3974..ce9a86c590 100644 --- a/tests/grpc/system/test_edb_extended_nets.py +++ b/tests/grpc/system/test_edb_extended_nets.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb extended nets -""" +"""Tests related to Edb extended nets""" import pytest diff --git a/tests/grpc/system/test_edb_future_features_242.py b/tests/grpc/system/test_edb_future_features_242.py index 34744115b1..463f9629e5 100644 --- a/tests/grpc/system/test_edb_future_features_242.py +++ b/tests/grpc/system/test_edb_future_features_242.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import pytest diff --git a/tests/grpc/system/test_edb_ipc.py b/tests/grpc/system/test_edb_ipc.py index 41605c926a..0d03365188 100644 --- a/tests/grpc/system/test_edb_ipc.py +++ b/tests/grpc/system/test_edb_ipc.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to the interaction between Edb and Ipc2581 -""" +"""Tests related to the interaction between Edb and Ipc2581""" import os diff --git a/tests/grpc/system/test_edb_materials.py b/tests/grpc/system/test_edb_materials.py index bf821d8bb2..4be340527a 100644 --- a/tests/grpc/system/test_edb_materials.py +++ b/tests/grpc/system/test_edb_materials.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import os diff --git a/tests/grpc/system/test_edb_modeler.py b/tests/grpc/system/test_edb_modeler.py index 72e9591fee..8a9a553308 100644 --- a/tests/grpc/system/test_edb_modeler.py +++ b/tests/grpc/system/test_edb_modeler.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb modeler -""" +"""Tests related to Edb modeler""" import os diff --git a/tests/grpc/system/test_edb_net_classes.py b/tests/grpc/system/test_edb_net_classes.py index 93f6faef62..9ef8167715 100644 --- a/tests/grpc/system/test_edb_net_classes.py +++ b/tests/grpc/system/test_edb_net_classes.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb net classes -""" +"""Tests related to Edb net classes""" import pytest diff --git a/tests/grpc/system/test_edb_nets.py b/tests/grpc/system/test_edb_nets.py index 53e0a2c194..0c96bd4394 100644 --- a/tests/grpc/system/test_edb_nets.py +++ b/tests/grpc/system/test_edb_nets.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb nets -""" +"""Tests related to Edb nets""" import os diff --git a/tests/grpc/system/test_edb_padstacks.py b/tests/grpc/system/test_edb_padstacks.py index 18c83a9ef9..1e64ca681f 100644 --- a/tests/grpc/system/test_edb_padstacks.py +++ b/tests/grpc/system/test_edb_padstacks.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb padstacks -""" +"""Tests related to Edb padstacks""" + import os import pytest diff --git a/tests/grpc/system/test_edb_stackup.py b/tests/grpc/system/test_edb_stackup.py index cbf48aada5..e1f9d30eec 100644 --- a/tests/grpc/system/test_edb_stackup.py +++ b/tests/grpc/system/test_edb_stackup.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb stackup -""" +"""Tests related to Edb stackup""" import math import os diff --git a/tests/grpc/system/test_emi_scanner.py b/tests/grpc/system/test_emi_scanner.py index 7563391862..b80f52d8bf 100644 --- a/tests/grpc/system/test_emi_scanner.py +++ b/tests/grpc/system/test_emi_scanner.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to the interaction between Edb and Ipc2581 -""" +"""Tests related to the interaction between Edb and Ipc2581""" from pathlib import Path diff --git a/tests/grpc/system/test_siwave_features.py b/tests/grpc/system/test_siwave_features.py index 6c68fe8085..cf00e2c790 100644 --- a/tests/grpc/system/test_siwave_features.py +++ b/tests/grpc/system/test_siwave_features.py @@ -11,8 +11,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import os diff --git a/tests/grpc/unit/conftest.py b/tests/grpc/unit/conftest.py index cada8e557a..359ef1ef50 100644 --- a/tests/grpc/unit/conftest.py +++ b/tests/grpc/unit/conftest.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""" -""" +""" """ import csv import os diff --git a/tests/legacy/system/conftest.py b/tests/legacy/system/conftest.py index 552dd8e3e2..4c16ff30ad 100644 --- a/tests/legacy/system/conftest.py +++ b/tests/legacy/system/conftest.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""" -""" +""" """ import os from os.path import dirname diff --git a/tests/legacy/system/test_edb_components.py b/tests/legacy/system/test_edb_components.py index e23d1cc22d..04e8a0ee13 100644 --- a/tests/legacy/system/test_edb_components.py +++ b/tests/legacy/system/test_edb_components.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb components -""" +"""Tests related to Edb components""" + import math import os diff --git a/tests/legacy/system/test_edb_definition.py b/tests/legacy/system/test_edb_definition.py index eaebd27d66..3bd388e215 100644 --- a/tests/legacy/system/test_edb_definition.py +++ b/tests/legacy/system/test_edb_definition.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb component definitions -""" +"""Tests related to Edb component definitions""" + import os import pytest diff --git a/tests/legacy/system/test_edb_differential_pairs.py b/tests/legacy/system/test_edb_differential_pairs.py index 7684992a37..c766f72f56 100644 --- a/tests/legacy/system/test_edb_differential_pairs.py +++ b/tests/legacy/system/test_edb_differential_pairs.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb differential pairs -""" +"""Tests related to Edb differential pairs""" import pytest diff --git a/tests/legacy/system/test_edb_extended_nets.py b/tests/legacy/system/test_edb_extended_nets.py index 58b6199aba..e172d216b0 100644 --- a/tests/legacy/system/test_edb_extended_nets.py +++ b/tests/legacy/system/test_edb_extended_nets.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb extended nets -""" +"""Tests related to Edb extended nets""" import pytest diff --git a/tests/legacy/system/test_edb_future_features_242.py b/tests/legacy/system/test_edb_future_features_242.py index 0648501b03..c2c8bb6998 100644 --- a/tests/legacy/system/test_edb_future_features_242.py +++ b/tests/legacy/system/test_edb_future_features_242.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import pytest diff --git a/tests/legacy/system/test_edb_ipc.py b/tests/legacy/system/test_edb_ipc.py index 2ae5164722..949df6415e 100644 --- a/tests/legacy/system/test_edb_ipc.py +++ b/tests/legacy/system/test_edb_ipc.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to the interaction between Edb and Ipc2581 -""" +"""Tests related to the interaction between Edb and Ipc2581""" import os diff --git a/tests/legacy/system/test_edb_materials.py b/tests/legacy/system/test_edb_materials.py index 669e1bcbad..82296400f6 100644 --- a/tests/legacy/system/test_edb_materials.py +++ b/tests/legacy/system/test_edb_materials.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import os diff --git a/tests/legacy/system/test_edb_modeler.py b/tests/legacy/system/test_edb_modeler.py index 7e2921e684..a6262da5be 100644 --- a/tests/legacy/system/test_edb_modeler.py +++ b/tests/legacy/system/test_edb_modeler.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb modeler -""" +"""Tests related to Edb modeler""" import os diff --git a/tests/legacy/system/test_edb_net_classes.py b/tests/legacy/system/test_edb_net_classes.py index 661a7cf100..84908c57e5 100644 --- a/tests/legacy/system/test_edb_net_classes.py +++ b/tests/legacy/system/test_edb_net_classes.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb net classes -""" +"""Tests related to Edb net classes""" import pytest diff --git a/tests/legacy/system/test_edb_nets.py b/tests/legacy/system/test_edb_nets.py index 0a332a6976..3ef85bcc1d 100644 --- a/tests/legacy/system/test_edb_nets.py +++ b/tests/legacy/system/test_edb_nets.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb nets -""" +"""Tests related to Edb nets""" import os diff --git a/tests/legacy/system/test_edb_padstacks.py b/tests/legacy/system/test_edb_padstacks.py index 54a123ebb2..32e0e7a44f 100644 --- a/tests/legacy/system/test_edb_padstacks.py +++ b/tests/legacy/system/test_edb_padstacks.py @@ -21,6 +21,7 @@ # SOFTWARE. """Tests related to Edb padstacks""" + import math import os from pathlib import Path @@ -546,6 +547,6 @@ def _assert_inside(rect, pad): BASE_MESSAGE = "rectangle is not inside pad as" result = rect.Intersect(pad) assert len(result) == 1, f"{BASE_MESSAGE} intersection returned more than one lump" - assert math.isclose( - result[0].Area(), rect.Area() - ), f"{BASE_MESSAGE} area of intersection is not equal to rectangle area" + assert math.isclose(result[0].Area(), rect.Area()), ( + f"{BASE_MESSAGE} area of intersection is not equal to rectangle area" + ) diff --git a/tests/legacy/system/test_edb_stackup.py b/tests/legacy/system/test_edb_stackup.py index b340035103..dcf5937696 100644 --- a/tests/legacy/system/test_edb_stackup.py +++ b/tests/legacy/system/test_edb_stackup.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb stackup -""" +"""Tests related to Edb stackup""" import math import os diff --git a/tests/legacy/system/test_emi_scanner.py b/tests/legacy/system/test_emi_scanner.py index 39efa7af5b..adfd7df79d 100644 --- a/tests/legacy/system/test_emi_scanner.py +++ b/tests/legacy/system/test_emi_scanner.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to the interaction between Edb and Ipc2581 -""" +"""Tests related to the interaction between Edb and Ipc2581""" from pathlib import Path diff --git a/tests/legacy/system/test_siwave_features.py b/tests/legacy/system/test_siwave_features.py index d70cb6e175..90aa29435d 100644 --- a/tests/legacy/system/test_siwave_features.py +++ b/tests/legacy/system/test_siwave_features.py @@ -11,8 +11,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb -""" +"""Tests related to Edb""" import os diff --git a/tests/legacy/unit/conftest.py b/tests/legacy/unit/conftest.py index cada8e557a..359ef1ef50 100644 --- a/tests/legacy/unit/conftest.py +++ b/tests/legacy/unit/conftest.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""" -""" +""" """ import csv import os From 99be75d953b3734249c591ecc73801e30f1353bd Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Tue, 20 May 2025 16:07:14 +0200 Subject: [PATCH 4/9] Exhaustive list of ignored ruff linting rules and enable auto-fix --- pyproject.toml | 104 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8a5f5f2fd3..9c9eb0f418 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,7 @@ Discussions = "https://github.com/ansys/pyedb/discussions" [tool.ruff] line-length = 120 +fix = true [tool.ruff.format] quote-style = "double" @@ -99,9 +100,108 @@ docstring-code-format = true [tool.ruff.lint] select = [ - "I" # isort, see https://docs.astral.sh/ruff/rules/#isort-i + "D", # pydocstyle, see https://docs.astral.sh/ruff/rules/#pydocstyle-d + "E", # pycodestyle, see https://docs.astral.sh/ruff/rules/#pycodestyle-e-w + "F", # pyflakes, see https://docs.astral.sh/ruff/rules/#pyflakes-f + "I", # isort, see https://docs.astral.sh/ruff/rules/#isort-i + "N", # pep8-naming, see https://docs.astral.sh/ruff/rules/#pep8-naming-n + "PTH", # flake8-use-pathlib, https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth + "TD", # flake8-todos, https://docs.astral.sh/ruff/rules/#flake8-todos-td + "W", # pycodestyle, see https://docs.astral.sh/ruff/rules/#pycodestyle-e-w +] +ignore = [ + # "D" - pydocstyle, see https://docs.astral.sh/ruff/rules/#pydocstyle-d + "D100", # undocumented-public-module + "D101", # undocumented-public-class + "D102", # undocumented-public-method + "D103", # undocumented-public-function + "D104", # undocumented-public-package + "D105", # undocumented-magic-method + "D106", # undocumented-public-nested-class + "D200", # unnecessary-multiline-docstring + "D202", # blank-line-after-function + "D205", # missing-blank-line-after-summary + "D208", # over-indentation + "D209", # new-line-after-last-paragraph + "D210", # surrounding-whitespace + "D214", # overindented-section + "D215", # overindented-section-underline + "D301", # escape-sequence-in-docstring + "D400", # missing-trailing-period + "D401", # non-imperative-mood + "D403", # first-word-uncapitalized + "D404", # docstring-starts-with-this + "D405", # non-capitalized-section-name + "D406", # missing-new-line-after-section-name + "D407", # missing-dashed-underline-after-section + "D409", # mismatched-section-underline-length + "D410", # no-blank-line-after-section + "D411", # no-blank-line-before-section + "D412", # blank-lines-between-header-and-content + "D414", # empty-docstring-section + "D419", # empty-docstring + + # "E" - pycodestyle, see https://docs.astral.sh/ruff/rules/#pycodestyle-e-w + "E402", # module-import-not-at-top-of-file + "E711", # none-comparison + "E713", # not-in-test + "E721", # type-comparison + "E722", # bare-except + "E731", # lambda-assignment + "E741", # ambiguous-variable-name + "E743", # ambiguous-function-name + + # "F" - pyflakes, see https://docs.astral.sh/ruff/rules/#pyflakes-f + "F401", # unused-import + "F523", # string-dot-format-extra-positional-arguments + "F541", # f-string-missing-placeholders + "F811", # redefined-while-unused + "F821", # undefined-name + "F841", # unused-variable + + # "N" - pep8-naming, see https://docs.astral.sh/ruff/rules/#pep8-naming-n + "N801", # invalid-class-name + "N802", # invalid-function-name + "N803", # invalid-argument-name + "N806", # non-lowercase-variable-in-function + "N812", # lowercase-imported-as-non-lowercase + "N813", # camelcase-imported-as-lowercase + "N815", # mixed-case-variable-in-class-scope + "N817", # camelcase-imported-as-acronym + "N818", # error-suffix-on-exception-name + "N999", # invalid-module-name + + # "PTH" - flake8-use-pathlib, https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth + "PTH100", # os-path-abspath + "PTH101", # os-chmod + "PTH102", # os-mkdir + "PTH103", # os-makedirs + "PTH104", # os-rename + "PTH107", # os-remove + "PTH108", # os-unlink + "PTH110", # os-path-exists + "PTH111", # os-path-expanduser + "PTH112", # os-path-isdir + "PTH113", # os-path-isfile + "PTH116", # os-stat + "PTH118", # os-path-join + "PTH119", # os-path-basename + "PTH120", # os-path-dirname + "PTH122", # os-path-splitext + "PTH123", # builtin-open + "PTH202", # os-path-getsize + + # "TD" - flake8-todos, https://docs.astral.sh/ruff/rules/#flake8-todos-td + "TD001", # invalid-todo-tag + "TD002", # missing-todo-author + "TD003", # missing-todo-link + "TD004", # missing-todo-colon + "TD005", # missing-todo-description + "TD006", # invalid-todo-capitalization + + # "W" - pycodestyle, see https://docs.astral.sh/ruff/rules/#pycodestyle-e-w + "W605" # invalid-escape-sequence ] -ignore = [] [tool.ruff.lint.pydocstyle] # Use Numpy-style docstrings. From 933cd63376d7fa7270f310c759c33e5ddc26f5db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:54:54 +0000 Subject: [PATCH 5/9] MISC: Auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci --- doc/source/conf.py | 4 +- src/pyedb/configuration/configuration.py | 4 +- src/pyedb/dotnet/clr_module.py | 2 +- src/pyedb/dotnet/database/Variables.py | 6 +- .../database/cell/hierarchy/component.py | 2 +- src/pyedb/dotnet/database/cell/layout.py | 1 + src/pyedb/dotnet/database/components.py | 2 +- src/pyedb/dotnet/database/dotnet/database.py | 1 + .../database/edb_data/padstacks_data.py | 2 +- .../edb_data/simulation_configuration.py | 2 +- .../dotnet/database/geometry/polygon_data.py | 2 +- src/pyedb/dotnet/database/materials.py | 2 +- src/pyedb/dotnet/database/padstack.py | 10 ++- .../database/sim_setup_data/io/siwave.py | 2 +- src/pyedb/dotnet/database/stackup.py | 2 +- .../database/utilities/simulation_setup.py | 2 +- src/pyedb/dotnet/edb.py | 70 ++++++++------- src/pyedb/edb_logger.py | 2 +- src/pyedb/extensions/via_design_backend.py | 4 +- src/pyedb/generic/data_handlers.py | 2 +- src/pyedb/generic/design_types.py | 45 +++++----- src/pyedb/generic/general_methods.py | 2 +- src/pyedb/generic/process.py | 2 +- src/pyedb/grpc/database/components.py | 7 +- src/pyedb/grpc/database/control_file.py | 33 ++++--- .../grpc/database/definition/materials.py | 4 +- .../grpc/database/definition/package_def.py | 2 +- .../grpc/database/definition/padstack_def.py | 11 ++- src/pyedb/grpc/database/hfss.py | 1 + .../grpc/database/hierarchy/component.py | 7 +- src/pyedb/grpc/database/layers/layer.py | 3 +- src/pyedb/grpc/database/layout/layout.py | 3 +- src/pyedb/grpc/database/modeler.py | 5 +- src/pyedb/grpc/database/nets.py | 50 ++++------- src/pyedb/grpc/database/padstacks.py | 21 ++--- src/pyedb/grpc/database/primitive/bondwire.py | 2 +- .../database/primitive/padstack_instance.py | 5 +- .../grpc/database/primitive/rectangle.py | 2 +- .../simulation_setup/hfss_general_settings.py | 2 + .../simulation_setup/hfss_settings_options.py | 4 + .../database/simulation_setup/sweep_data.py | 4 +- src/pyedb/grpc/database/siwave.py | 18 ++-- src/pyedb/grpc/database/source_excitations.py | 88 +++++++++++-------- src/pyedb/grpc/database/stackup.py | 62 ++++++++----- .../grpc/database/terminal/bundle_terminal.py | 2 +- .../grpc/database/utility/hfss_extent_info.py | 4 +- src/pyedb/grpc/edb.py | 21 +++-- src/pyedb/grpc/rpc_session.py | 4 +- src/pyedb/libraries/common.py | 7 +- .../libraries/rf_libraries/base_functions.py | 23 ++--- .../libraries/rf_libraries/planar_antennas.py | 24 +---- src/pyedb/misc/aedtlib_personalib_install.py | 2 +- .../emc_rule_checker_settings.py | 2 +- .../xtalk_scan/scan_config.py | 2 +- src/pyedb/modeler/geometry_operators.py | 2 +- src/pyedb/siwave.py | 4 +- tests/conftest.py | 6 +- tests/system/test_edb_configuration_2p0.py | 2 +- tests/system/test_edb_padstacks.py | 7 +- tests/system/test_edb_stackup.py | 3 +- tests/test_warnings.py | 2 +- tests/unit/test_clr_module.py | 2 +- tests/unit/test_edb.py | 2 +- tests/unit/test_edbsiwave.py | 2 +- tests/unit/test_materials.py | 2 +- tests/unit/test_padstack.py | 2 +- tests/unit/test_stackup.py | 2 +- 67 files changed, 319 insertions(+), 317 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index e696f99737..634f9102ef 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,14 +1,14 @@ # Configuration file for the PyEDB documentation builder. import datetime -from importlib import import_module import json import os import pathlib -from pprint import pformat import shutil import sys import warnings +from importlib import import_module +from pprint import pformat from ansys_sphinx_theme import ( ansys_favicon, diff --git a/src/pyedb/configuration/configuration.py b/src/pyedb/configuration/configuration.py index d8da7753aa..258bf31bd4 100644 --- a/src/pyedb/configuration/configuration.py +++ b/src/pyedb/configuration/configuration.py @@ -19,11 +19,11 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from datetime import datetime import json import os -from pathlib import Path import warnings +from datetime import datetime +from pathlib import Path import toml diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index e383795df4..2619c67e0d 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -1,8 +1,8 @@ import os -from pathlib import Path import pkgutil import sys import warnings +from pathlib import Path import pyedb diff --git a/src/pyedb/dotnet/database/Variables.py b/src/pyedb/dotnet/database/Variables.py index 535cddd26f..65cd76e568 100644 --- a/src/pyedb/dotnet/database/Variables.py +++ b/src/pyedb/dotnet/database/Variables.py @@ -35,10 +35,8 @@ """ -from __future__ import ( - absolute_import, # noreorder - division, -) +from __future__ import absolute_import # noreorder +from __future__ import division import os import re diff --git a/src/pyedb/dotnet/database/cell/hierarchy/component.py b/src/pyedb/dotnet/database/cell/hierarchy/component.py index 96510046f1..5904c77321 100644 --- a/src/pyedb/dotnet/database/cell/hierarchy/component.py +++ b/src/pyedb/dotnet/database/cell/hierarchy/component.py @@ -22,8 +22,8 @@ import logging import re -from typing import Optional import warnings +from typing import Optional from pyedb.dotnet.database.cell.hierarchy.hierarchy_obj import Group from pyedb.dotnet.database.cell.hierarchy.model import PinPairModel, SPICEModel diff --git a/src/pyedb/dotnet/database/cell/layout.py b/src/pyedb/dotnet/database/cell/layout.py index 54eb3d8750..9df396724e 100644 --- a/src/pyedb/dotnet/database/cell/layout.py +++ b/src/pyedb/dotnet/database/cell/layout.py @@ -23,6 +23,7 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + from typing import List, Union from pyedb.dotnet.database.cell.hierarchy.component import EDBComponent diff --git a/src/pyedb/dotnet/database/components.py b/src/pyedb/dotnet/database/components.py index e1c359f7a2..dddd972258 100644 --- a/src/pyedb/dotnet/database/components.py +++ b/src/pyedb/dotnet/database/components.py @@ -27,8 +27,8 @@ import math import os import re -from typing import List, Set, Union import warnings +from typing import List, Set, Union from pyedb.component_libraries.ansys_components import ( ComponentLib, diff --git a/src/pyedb/dotnet/database/dotnet/database.py b/src/pyedb/dotnet/database/dotnet/database.py index 847c7fbfb7..48bc9a4bf0 100644 --- a/src/pyedb/dotnet/database/dotnet/database.py +++ b/src/pyedb/dotnet/database/dotnet/database.py @@ -21,6 +21,7 @@ # SOFTWARE. """Database.""" + import re from pyedb.dotnet.database.general import convert_py_list_to_net_list diff --git a/src/pyedb/dotnet/database/edb_data/padstacks_data.py b/src/pyedb/dotnet/database/edb_data/padstacks_data.py index 0915b97ca5..e08bac8f30 100644 --- a/src/pyedb/dotnet/database/edb_data/padstacks_data.py +++ b/src/pyedb/dotnet/database/edb_data/padstacks_data.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from collections import OrderedDict import math import warnings +from collections import OrderedDict from pyedb.dotnet.clr_module import String from pyedb.dotnet.database.cell.primitive.primitive import Connectable diff --git a/src/pyedb/dotnet/database/edb_data/simulation_configuration.py b/src/pyedb/dotnet/database/edb_data/simulation_configuration.py index 102ff16e52..82941d2b5b 100644 --- a/src/pyedb/dotnet/database/edb_data/simulation_configuration.py +++ b/src/pyedb/dotnet/database/edb_data/simulation_configuration.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from collections import OrderedDict import json import os +from collections import OrderedDict from pyedb.dotnet.clr_module import Dictionary from pyedb.dotnet.database.edb_data.sources import Source, SourceType diff --git a/src/pyedb/dotnet/database/geometry/polygon_data.py b/src/pyedb/dotnet/database/geometry/polygon_data.py index 43487177d6..5bb8e70bda 100644 --- a/src/pyedb/dotnet/database/geometry/polygon_data.py +++ b/src/pyedb/dotnet/database/geometry/polygon_data.py @@ -19,8 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from typing import Union import warnings +from typing import Union from pyedb.dotnet.database.general import convert_py_list_to_net_list from pyedb.dotnet.database.geometry.point_data import PointData diff --git a/src/pyedb/dotnet/database/materials.py b/src/pyedb/dotnet/database/materials.py index 1af27a54c3..6e7b70603e 100644 --- a/src/pyedb/dotnet/database/materials.py +++ b/src/pyedb/dotnet/database/materials.py @@ -26,8 +26,8 @@ import logging import os import re -from typing import Optional, Union import warnings +from typing import Optional, Union from pydantic import BaseModel, confloat diff --git a/src/pyedb/dotnet/database/padstack.py b/src/pyedb/dotnet/database/padstack.py index bacba1653a..48be2b3dbf 100644 --- a/src/pyedb/dotnet/database/padstack.py +++ b/src/pyedb/dotnet/database/padstack.py @@ -23,10 +23,11 @@ """ This module contains the `EdbPadstacks` class. """ -from collections import defaultdict + import math -from typing import Dict, List import warnings +from collections import defaultdict +from typing import Dict, List import numpy as np import rtree @@ -708,8 +709,9 @@ def set_all_antipad_value(self, value): ) else: # pragma no cover self._logger.error( - "Failed to reassign anti-pad value {} on Pads-stack definition {}," - " layer{}".format(str(value), padstack.edb_padstack.GetName(), layer) + "Failed to reassign anti-pad value {} on Pads-stack definition {}, layer{}".format( + str(value), padstack.edb_padstack.GetName(), layer + ) ) all_succeed = False padstack.edb_padstack.SetData(cloned_padstack_data) diff --git a/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py b/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py index 761e1cb89e..2c8519df3a 100644 --- a/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py +++ b/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py @@ -349,7 +349,7 @@ def automatic_mesh(self): ``True`` if automatic mesh is used, ``False`` otherwise. """ warnings.warn( - "`automatic_mesh` is deprecated." "Use `mesh_automatic` instead.", + "`automatic_mesh` is deprecated.Use `mesh_automatic` instead.", DeprecationWarning, ) return self.sim_setup_info.simulation_settings.AdvancedSettings.MeshAutoMatic diff --git a/src/pyedb/dotnet/database/stackup.py b/src/pyedb/dotnet/database/stackup.py index 7e9ee74cf2..152c2718ad 100644 --- a/src/pyedb/dotnet/database/stackup.py +++ b/src/pyedb/dotnet/database/stackup.py @@ -27,11 +27,11 @@ from __future__ import absolute_import # noreorder -from collections import OrderedDict import json import logging import math import warnings +from collections import OrderedDict from pyedb.dotnet.database.edb_data.layer_data import ( LayerEdbClass, diff --git a/src/pyedb/dotnet/database/utilities/simulation_setup.py b/src/pyedb/dotnet/database/utilities/simulation_setup.py index a67e7dfd31..f025a33844 100644 --- a/src/pyedb/dotnet/database/utilities/simulation_setup.py +++ b/src/pyedb/dotnet/database/utilities/simulation_setup.py @@ -21,8 +21,8 @@ # SOFTWARE. -from enum import Enum import warnings +from enum import Enum from pyedb.dotnet.database.sim_setup_data.data.sim_setup_info import SimSetupInfo from pyedb.dotnet.database.sim_setup_data.data.sweep_data import SweepData diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index d13c809f88..06ef12de3b 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -25,29 +25,29 @@ This module is implicitly loaded in HFSS 3D Layout when launched. """ -from datetime import datetime -from itertools import combinations + import os -from pathlib import Path import re import shutil import subprocess import sys import time import traceback -from typing import Union import warnings +from datetime import datetime +from itertools import combinations +from pathlib import Path +from typing import Union from zipfile import ZipFile as zpf import rtree -from pyedb.configuration.configuration import Configuration import pyedb.dotnet -from pyedb.dotnet.database.Variables import decompose_variable_value +import pyedb.dotnet.database.dotnet.database +from pyedb.configuration.configuration import Configuration from pyedb.dotnet.database.cell.layout import Layout from pyedb.dotnet.database.cell.terminal.terminal import Terminal from pyedb.dotnet.database.components import Components -import pyedb.dotnet.database.dotnet.database from pyedb.dotnet.database.edb_data.design_options import EdbDesignOptions from pyedb.dotnet.database.edb_data.ports import ( BundleWavePort, @@ -92,6 +92,7 @@ SiwaveSimulationSetup, ) from pyedb.dotnet.database.utilities.value import Value +from pyedb.dotnet.database.Variables import decompose_variable_value from pyedb.generic.constants import AEDT_UNITS, SolverType, unit_converter from pyedb.generic.general_methods import generate_unique_name, is_linux, is_windows from pyedb.generic.process import SiwaveSolve @@ -152,19 +153,19 @@ class Edb: Add a new variable named "s1" to the ``Edb`` instance. - >>> app['s1'] = "0.25 mm" - >>> app['s1'].tofloat + >>> app["s1"] = "0.25 mm" + >>> app["s1"].tofloat >>> 0.00025 - >>> app['s1'].tostring + >>> app["s1"].tostring >>> "0.25mm" or add a new parameter with description: - >>> app['s2'] = ["20um", "Spacing between traces"] - >>> app['s2'].value + >>> app["s2"] = ["20um", "Spacing between traces"] + >>> app["s2"].value >>> 1.9999999999999998e-05 - >>> app['s2'].description - >>> 'Spacing between traces' + >>> app["s2"].description + >>> "Spacing between traces" Create an ``Edb`` object and open the specified project. @@ -2048,7 +2049,7 @@ def cutout( Examples -------- >>> from pyedb import Edb - >>> edb = Edb(r'C:\\test.aedb', version="2022.2") + >>> edb = Edb(r"C:\\test.aedb", version="2022.2") >>> edb.logger.info_timer("Edb Opening") >>> edb.logger.reset_timer() >>> start = time.time() @@ -2058,7 +2059,7 @@ def cutout( >>> signal_list.append(net) >>> power_list = ["PGND"] >>> edb.cutout(signal_list=signal_list, reference_list=power_list, extent_type="Conforming") - >>> end_time = str((time.time() - start)/60) + >>> end_time = str((time.time() - start) / 60) >>> edb.logger.info("Total legacy cutout time in min %s", end_time) >>> edb.nets.plot(signal_list, None, color_by_net=True) >>> edb.nets.plot(power_list, None, color_by_net=True) @@ -2708,7 +2709,7 @@ def create_cutout_multithread( Examples -------- >>> from pyedb import Edb - >>> edb = Edb(r'C:\\test.aedb', version="2022.2") + >>> edb = Edb(r"C:\\test.aedb", version="2022.2") >>> edb.logger.info_timer("Edb Opening") >>> edb.logger.reset_timer() >>> start = time.time() @@ -2718,7 +2719,7 @@ def create_cutout_multithread( >>> signal_list.append(net) >>> power_list = ["PGND"] >>> edb.create_cutout_multithread(signal_list=signal_list, reference_list=power_list, extent_type="Conforming") - >>> end_time = str((time.time() - start)/60) + >>> end_time = str((time.time() - start) / 60) >>> edb.logger.info("Total legacy cutout time in min %s", end_time) >>> edb.nets.plot(signal_list, None, color_by_net=True) >>> edb.nets.plot(power_list, None, color_by_net=True) @@ -3107,7 +3108,7 @@ def export_hfss( >>> from pyedb import Edb >>> edb = Edb(edbpath="C:\\temp\\myproject.aedb", version="2023.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file(r"C:\\temp", options_config) >>> edb.export_hfss(r"C:\\temp") """ @@ -3149,7 +3150,7 @@ def export_q3d( >>> from pyedb import Edb >>> edb = Edb(edbpath="C:\\temp\\myproject.aedb", version="2021.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file("C:\\temp", options_config) >>> edb.export_q3d("C:\\temp") """ @@ -3201,7 +3202,7 @@ def export_maxwell( >>> edb = Edb(edbpath="C:\\temp\\myproject.aedb", version="2021.2") - >>> options_config = {'UNITE_NETS' : 1, 'LAUNCH_Q3D' : 0} + >>> options_config = {"UNITE_NETS": 1, "LAUNCH_Q3D": 0} >>> edb.write_export3d_option_config_file("C:\\temp", options_config) >>> edb.export_maxwell("C:\\temp") """ @@ -3369,8 +3370,8 @@ def add_project_variable(self, variable_name, variable_value, description=""): >>> from pyedb import Edb >>> edb_app = Edb() >>> boolean_1, ant_length = edb_app.add_project_variable("my_local_variable", "1cm") - >>> print(edb_app["$my_local_variable"]) #using getitem - >>> edb_app["$my_local_variable"] = "1cm" #using setitem + >>> print(edb_app["$my_local_variable"]) # using getitem + >>> edb_app["$my_local_variable"] = "1cm" # using setitem """ if not variable_name.startswith("$"): @@ -3408,8 +3409,8 @@ def add_design_variable(self, variable_name, variable_value, is_parameter=False, >>> from pyedb import Edb >>> edb_app = Edb() >>> boolean_1, ant_length = edb_app.add_design_variable("my_local_variable", "1cm") - >>> print(edb_app["my_local_variable"]) #using getitem - >>> edb_app["my_local_variable"] = "1cm" #using setitem + >>> print(edb_app["my_local_variable"]) # using getitem + >>> edb_app["my_local_variable"] = "1cm" # using setitem >>> boolean_2, para_length = edb_app.change_design_variable_value("my_parameter", "1m", is_parameter=True >>> boolean_3, project_length = edb_app.change_design_variable_value("$my_project_variable", "1m") @@ -3449,7 +3450,7 @@ def change_design_variable_value(self, variable_name, variable_value): >>> edb_app = Edb() >>> boolean, ant_length = edb_app.add_design_variable("ant_length", "1cm") >>> boolean, ant_length = edb_app.change_design_variable_value("ant_length", "1m") - >>> print(edb_app["ant_length"]) #using getitem + >>> print(edb_app["ant_length"]) # using getitem """ var_server = self.variable_exists(variable_name) if var_server[0]: @@ -3928,11 +3929,13 @@ def create_siwave_syz_setup(self, name=None, **kwargs): >>> from pyedb import Edb >>> edbapp = Edb() >>> setup1 = edbapp.create_siwave_syz_setup("setup1") - >>> setup1.add_frequency_sweep(frequency_sweep=[ - ... ["linear count", "0", "1kHz", 1], - ... ["log scale", "1kHz", "0.1GHz", 10], - ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], - ... ]) + >>> setup1.add_frequency_sweep( + ... frequency_sweep=[ + ... ["linear count", "0", "1kHz", 1], + ... ["log scale", "1kHz", "0.1GHz", 10], + ... ["linear scale", "0.1GHz", "10GHz", "0.1GHz"], + ... ] + ... ) """ if not name: name = generate_unique_name("Siwave_SYZ") @@ -4687,8 +4690,7 @@ def create_model_for_arbitrary_wave_ports( ] if not polys: raise RuntimeWarning( - f"No polygon found with voids on layer {reference_layer} during model creation for " - f"arbitrary wave ports" + f"No polygon found with voids on layer {reference_layer} during model creation for arbitrary wave ports" ) void_padstacks = [] for poly in polys: @@ -4705,7 +4707,7 @@ def create_model_for_arbitrary_wave_ports( if not void_padstacks: raise RuntimeWarning( - "No padstack instances found inside evaluated voids during model creation for arbitrary" "waveports" + "No padstack instances found inside evaluated voids during model creation for arbitrarywaveports" ) cloned_edb = Edb(edbpath=output_edb) diff --git a/src/pyedb/edb_logger.py b/src/pyedb/edb_logger.py index fcf5941372..db901df4d8 100644 --- a/src/pyedb/edb_logger.py +++ b/src/pyedb/edb_logger.py @@ -22,12 +22,12 @@ # -*- coding: utf-8 -*- import logging -from logging.handlers import RotatingFileHandler import os import shutil import sys import tempfile import time +from logging.handlers import RotatingFileHandler class Msg: diff --git a/src/pyedb/extensions/via_design_backend.py b/src/pyedb/extensions/via_design_backend.py index f570e1a0e8..096c435ee1 100644 --- a/src/pyedb/extensions/via_design_backend.py +++ b/src/pyedb/extensions/via_design_backend.py @@ -1,8 +1,8 @@ -from copy import deepcopy as copy import json -from pathlib import Path import re import tempfile +from copy import deepcopy as copy +from pathlib import Path from typing import Union import numpy as np diff --git a/src/pyedb/generic/data_handlers.py b/src/pyedb/generic/data_handlers.py index 68598692ac..3300bfc330 100644 --- a/src/pyedb/generic/data_handlers.py +++ b/src/pyedb/generic/data_handlers.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from decimal import Decimal import json import math import random import re import string +from decimal import Decimal from pyedb.generic.general_methods import settings diff --git a/src/pyedb/generic/design_types.py b/src/pyedb/generic/design_types.py index 672d2dbf81..ca5b9a38de 100644 --- a/src/pyedb/generic/design_types.py +++ b/src/pyedb/generic/design_types.py @@ -19,8 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from typing import TYPE_CHECKING, Literal, Union, overload import warnings +from typing import TYPE_CHECKING, Literal, Union, overload from pyedb.generic.grpc_warnings import GRPC_GENERAL_WARNING from pyedb.generic.settings import settings @@ -32,18 +32,15 @@ @overload -def Edb(*, grpc: Literal[True], **kwargs) -> "EdbGrpc": - ... +def Edb(*, grpc: Literal[True], **kwargs) -> "EdbGrpc": ... @overload -def Edb(*, grpc: Literal[False] = False, **kwargs) -> "EdbDotnet": - ... +def Edb(*, grpc: Literal[False] = False, **kwargs) -> "EdbDotnet": ... @overload -def Edb(*, grpc: bool, **kwargs) -> Union["EdbGrpc", "EdbDotnet"]: - ... +def Edb(*, grpc: bool, **kwargs) -> Union["EdbGrpc", "EdbDotnet"]: ... # lazy imports @@ -156,15 +153,15 @@ def Edb( # Create SIwave SYZ setup >>> syz_setup = edb.create_siwave_syz_setup( - >>> name="GHz_Setup", - >>> start_freq="1GHz", - >>> stop_freq="10GHz" + >>> name = ("GHz_Setup",) + >>> start_freq = ("1GHz",) + >>> stop_freq = "10GHz" >>> ) # Create SIwave DC setup >>> dc_setup = edb.create_siwave_dc_setup( - >>> name="DC_Analysis", - >>> use_dc_point=True + >>> name = ("DC_Analysis",) + >>> use_dc_point = True >>> ) # Solve with SIwave @@ -197,15 +194,15 @@ def Edb( # Create wave port between two pins >>> wave_port = edb.source_excitation.create_port( - >>> positive_terminal=pin1, - >>> negative_terminal=pin2, - >>> port_type="Wave" + >>> positive_terminal = (pin1,) + >>> negative_terminal = (pin2,) + >>> port_type = "Wave" >>> ) # Create lumped port >>> lumped_port = edb.source_excitation.create_port( - >>> positive_terminal=via_terminal, - >>> port_type="Lumped" + >>> positive_terminal = (via_terminal,) + >>> port_type = "Lumped" >>> ) 8. Component Management @@ -220,10 +217,10 @@ def Edb( # Auto-parametrize design elements >>> params = edb.auto_parametrize_design( - >>> traces=True, - >>> pads=True, - >>> antipads=True, - >>> use_relative_variables=True + >>> traces = (True,) + >>> pads = (True,) + >>> antipads = (True,) + >>> use_relative_variables = True >>> ) >>> print("Created parameters:", params) @@ -244,9 +241,9 @@ def Edb( # Create differential pair >>> edb.differential_pairs.create( - >>> positive_net="USB_P", - >>> negative_net="USB_N", - >>> name="USB_DP" + >>> positive_net = ("USB_P",) + >>> negative_net = ("USB_N",) + >>> name = "USB_DP" >>> ) 13. Workflow Automation diff --git a/src/pyedb/generic/general_methods.py b/src/pyedb/generic/general_methods.py index 0ac161f67c..81c6d298e4 100644 --- a/src/pyedb/generic/general_methods.py +++ b/src/pyedb/generic/general_methods.py @@ -25,7 +25,6 @@ import ast import codecs -from collections import OrderedDict import csv import datetime import difflib @@ -42,6 +41,7 @@ import tempfile import time import traceback +from collections import OrderedDict from pyedb.generic.constants import CSS4_COLORS from pyedb.generic.settings import settings diff --git a/src/pyedb/generic/process.py b/src/pyedb/generic/process.py index a95a93f301..45c5b0b055 100644 --- a/src/pyedb/generic/process.py +++ b/src/pyedb/generic/process.py @@ -1,6 +1,6 @@ import os.path -from pathlib import Path import subprocess +from pathlib import Path from pyedb.generic.general_methods import is_linux diff --git a/src/pyedb/grpc/database/components.py b/src/pyedb/grpc/database/components.py index be6cb18a43..883b0d00c1 100644 --- a/src/pyedb/grpc/database/components.py +++ b/src/pyedb/grpc/database/components.py @@ -20,16 +20,15 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""This module contains the `Components` class. +"""This module contains the `Components` class.""" -""" import codecs import json import math import os import re -from typing import Any, Dict, List, Optional, Tuple, Union import warnings +from typing import Any, Dict, List, Optional, Tuple, Union from ansys.edb.core.definition.die_property import DieOrientation as GrpDieOrientation from ansys.edb.core.definition.die_property import DieType as GrpcDieType @@ -2208,7 +2207,7 @@ def deactivate_rlc_component( Examples -------- >>> from pyedb import Edb - >>> edb_file = r'C:\my_edb_file.aedb' + >>> edb_file = r"C:\my_edb_file.aedb" >>> edb = Edb(edb_file) >>> for cmp in list(edb.components.instances.keys()): >>> edb.components.deactivate_rlc_component(component=cmp, create_circuit_port=False) diff --git a/src/pyedb/grpc/database/control_file.py b/src/pyedb/grpc/database/control_file.py index fa5101aca5..1a36dc6973 100644 --- a/src/pyedb/grpc/database/control_file.py +++ b/src/pyedb/grpc/database/control_file.py @@ -58,9 +58,9 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): ------- # Example 1: Converting a technology file to control file >>> converted_file = convert_technology_file( - >>> tech_file="/path/to/tech.t", - >>> edbversion="2025.2", - >>> control_file="/path/to/output.xml" + >>> tech_file = ("/path/to/tech.t",) + >>> edbversion = ("2025.2",) + >>> control_file = "/path/to/output.xml" >>> ) >>> if converted_file: >>> print(f"Converted to: {converted_file}") @@ -68,28 +68,28 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): # Example 2: Creating a material >>> from pyedb import ControlFileMaterial >>> material = ControlFileMaterial( - >>> "Copper", + >>> ("Copper",) >>> {"Permittivity": 1.0, "Conductivity": 5.8e7} >>> ) # Example 3: Creating a dielectric layer >>> from pyedb import ControlFileDielectric >>> dielectric = ControlFileDielectric( - >>> "Core", + >>> ("Core",) >>> {"Thickness": "0.2mm", "Material": "FR4"} >>> ) # Example 4: Creating a signal layer >>> from pyedb import ControlFileLayer >>> signal_layer = ControlFileLayer( - >>> "TopLayer", + >>> ("TopLayer",) >>> {"Type": "signal", "Material": "Copper", "Thickness": "0.035mm"} >>> ) # Example 5: Creating a via layer >>> from pyedb import ControlFileVia >>> via_layer = ControlFileVia( - >>> "Via1", + >>> ("Via1",) >>> {"StartLayer": "TopLayer", "StopLayer": "BottomLayer"} >>> ) >>> via_layer.create_via_group = True @@ -112,9 +112,9 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): # Example 8: Setting up simulation extents >>> from pyedb import ControlExtent >>> extent = ControlExtent( - >>> type="Conforming", - >>> diel_hactor=0.3, - >>> airbox_hfactor=0.5 + >>> type = ("Conforming",) + >>> diel_hactor = (0.3,) + >>> airbox_hfactor = 0.5 >>> ) # Example 9: Creating circuit ports @@ -143,14 +143,23 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): # Example 13: Frequency sweep configuration >>> from pyedb import ControlFileSweep >>> sweep = ControlFileSweep( - >>> "Sweep1", "1GHz", "10GHz", "0.1GHz", + >>> ( + ... "Sweep1", + ... "1GHz", + ... "10GHz", + ... "0.1GHz", + ... ) >>> "Interpolating", "LinearStep", True >>> ) # Example 14: Mesh operation setup >>> from pyedb import ControlFileMeshOp >>> mesh_op = ControlFileMeshOp( - >>> "FineMesh", "Region1", "MeshOperationSkinDepth", + >>> ( + ... "FineMesh", + ... "Region1", + ... "MeshOperationSkinDepth", + ... ) >>> {"Net1": "TopLayer"} >>> ) >>> mesh_op.skin_depth = "1um" diff --git a/src/pyedb/grpc/database/definition/materials.py b/src/pyedb/grpc/database/definition/materials.py index 135fe4904c..3c2374a73d 100644 --- a/src/pyedb/grpc/database/definition/materials.py +++ b/src/pyedb/grpc/database/definition/materials.py @@ -26,15 +26,15 @@ import logging import os import re -from typing import Optional, Union import warnings +from typing import Optional, Union from ansys.edb.core.definition.debye_model import DebyeModel as GrpcDebyeModel from ansys.edb.core.definition.djordjecvic_sarkar_model import ( DjordjecvicSarkarModel as GrpcDjordjecvicSarkarModel, ) +from ansys.edb.core.definition.material_def import MaterialDef as GrpcMaterialDef from ansys.edb.core.definition.material_def import ( - MaterialDef as GrpcMaterialDef, MaterialProperty as GrpcMaterialProperty, ) from ansys.edb.core.definition.multipole_debye_model import ( diff --git a/src/pyedb/grpc/database/definition/package_def.py b/src/pyedb/grpc/database/definition/package_def.py index 0b537f2bf6..4516691da2 100644 --- a/src/pyedb/grpc/database/definition/package_def.py +++ b/src/pyedb/grpc/database/definition/package_def.py @@ -221,8 +221,8 @@ def set_heatsink(self, fin_base_height, fin_height, fin_orientation, fin_spacing fin_thickness : str, float Fin thickness. """ + from ansys.edb.core.utility.heat_sink import HeatSink as GrpcHeatSink from ansys.edb.core.utility.heat_sink import ( - HeatSink as GrpcHeatSink, HeatSinkFinOrientation as GrpcHeatSinkFinOrientation, ) diff --git a/src/pyedb/grpc/database/definition/padstack_def.py b/src/pyedb/grpc/database/definition/padstack_def.py index 66b6c55605..fab5727346 100644 --- a/src/pyedb/grpc/database/definition/padstack_def.py +++ b/src/pyedb/grpc/database/definition/padstack_def.py @@ -23,15 +23,18 @@ import math import warnings +import ansys.edb.core.geometry.polygon_data from ansys.edb.core.definition.padstack_def import PadstackDef as GrpcPadstackDef from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, +) +from ansys.edb.core.definition.padstack_def_data import ( PadstackHoleRange as GrpcPadstackHoleRange, - PadType as GrpcPadType, ) -import ansys.edb.core.geometry.polygon_data +from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure, Structure3D as GrpcStructure3D +from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure +from ansys.edb.core.hierarchy.structure3d import Structure3D as GrpcStructure3D from ansys.edb.core.primitive.circle import Circle as GrpcCircle from pyedb.generic.general_methods import generate_unique_name @@ -124,7 +127,7 @@ def shape(self, value: str): self._update_pad_parameters_parameters(geom_type=GrpcPadGeometryType.PADGEOMTYPE_POLYGON) else: raise ValueError( - f"Unsupported pad shape: {value}. Supported shapes are 'circle', " f"'rectangle', and 'polygon'." + f"Unsupported pad shape: {value}. Supported shapes are 'circle', 'rectangle', and 'polygon'." ) @property diff --git a/src/pyedb/grpc/database/hfss.py b/src/pyedb/grpc/database/hfss.py index 135723d86c..4cdfafe630 100644 --- a/src/pyedb/grpc/database/hfss.py +++ b/src/pyedb/grpc/database/hfss.py @@ -23,6 +23,7 @@ """ This module contains the ``EdbHfss`` class. """ + import math import warnings diff --git a/src/pyedb/grpc/database/hierarchy/component.py b/src/pyedb/grpc/database/hierarchy/component.py index 7fa1cdb427..932892af81 100644 --- a/src/pyedb/grpc/database/hierarchy/component.py +++ b/src/pyedb/grpc/database/hierarchy/component.py @@ -22,19 +22,20 @@ import logging import re -from typing import List, Optional, Union import warnings +from typing import List, Optional, Union from ansys.edb.core.definition.component_model import ( NPortComponentModel as GrpcNPortComponentModel, ) -from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation, DieType as GrpcDieType +from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation +from ansys.edb.core.definition.die_property import DieType as GrpcDieType from ansys.edb.core.definition.solder_ball_property import SolderballShape from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.component_group import ( ComponentGroup as GrpcComponentGroup, - ComponentType as GrpcComponentType, ) +from ansys.edb.core.hierarchy.component_group import ComponentType as GrpcComponentType from ansys.edb.core.hierarchy.netlist_model import NetlistModel as GrpcNetlistModel from ansys.edb.core.hierarchy.pin_pair_model import PinPairModel as GrpcPinPairModel from ansys.edb.core.hierarchy.sparameter_model import ( diff --git a/src/pyedb/grpc/database/layers/layer.py b/src/pyedb/grpc/database/layers/layer.py index 7c81f009ff..ae3839cc2a 100644 --- a/src/pyedb/grpc/database/layers/layer.py +++ b/src/pyedb/grpc/database/layers/layer.py @@ -6,7 +6,8 @@ from __future__ import absolute_import -from ansys.edb.core.layer.layer import Layer as GrpcLayer, LayerType as GrpcLayerType +from ansys.edb.core.layer.layer import Layer as GrpcLayer +from ansys.edb.core.layer.layer import LayerType as GrpcLayerType class Layer(GrpcLayer): diff --git a/src/pyedb/grpc/database/layout/layout.py b/src/pyedb/grpc/database/layout/layout.py index ca3e418556..b2fd41be03 100644 --- a/src/pyedb/grpc/database/layout/layout.py +++ b/src/pyedb/grpc/database/layout/layout.py @@ -23,9 +23,9 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + from typing import Dict, Union -from ansys.edb.core.layout.layout import Layout as GrpcLayout import ansys.edb.core.primitive.bondwire import ansys.edb.core.primitive.circle import ansys.edb.core.primitive.padstack_instance @@ -33,6 +33,7 @@ import ansys.edb.core.primitive.polygon import ansys.edb.core.primitive.primitive import ansys.edb.core.primitive.rectangle +from ansys.edb.core.layout.layout import Layout as GrpcLayout from pyedb.grpc.database.hierarchy.component import Component from pyedb.grpc.database.hierarchy.pingroup import PinGroup diff --git a/src/pyedb/grpc/database/modeler.py b/src/pyedb/grpc/database/modeler.py index b4336ee24d..f38cb0afbb 100644 --- a/src/pyedb/grpc/database/modeler.py +++ b/src/pyedb/grpc/database/modeler.py @@ -23,15 +23,16 @@ """ This module contains these classes: `EdbLayout` and `Shape`. """ + import math from typing import Any, Dict, List, Optional, Union from ansys.edb.core.geometry.arc_data import ArcData as GrpcArcData from ansys.edb.core.geometry.point_data import PointData as GrpcPointData +from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.geometry.polygon_data import ( PolygonSenseType as GrpcPolygonSenseType, ) -from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.pin_group import PinGroup as GrpcPinGroup from ansys.edb.core.inner.exceptions import InvalidArgumentException from ansys.edb.core.primitive.bondwire import BondwireType as GrpcBondwireType @@ -1265,7 +1266,7 @@ def defeature_polygon(self, poly: Polygon, tolerance: float = 0.001) -> bool: new_poly = poly.polygon_data.defeature(tol=tolerance) if not new_poly.points: self._pedb.logger.error( - f"Defeaturing on polygon {poly.id} returned empty polygon, tolerance threshold " f"might too large. " + f"Defeaturing on polygon {poly.id} returned empty polygon, tolerance threshold might too large. " ) return False poly.polygon_data = new_poly diff --git a/src/pyedb/grpc/database/nets.py b/src/pyedb/grpc/database/nets.py index c59a6589aa..40e1cf7446 100644 --- a/src/pyedb/grpc/database/nets.py +++ b/src/pyedb/grpc/database/nets.py @@ -22,8 +22,8 @@ from __future__ import absolute_import # noreorder -from typing import Any, Dict, List, Optional, Set, Tuple, Union import warnings +from typing import Any, Dict, List, Optional, Set, Tuple, Union from ansys.edb.core.net.net_class import NetClass as GrpcNetClass @@ -96,15 +96,15 @@ class Nets(CommonNets): >>> # Generate extended nets (deprecated) >>> nets.generate_extended_nets( - >>> resistor_below=5, + >>> resistor_below = (5,) >>>inductor_below=0.5, - >>> capacitor_above=0.1 + >>> capacitor_above = 0.1 >>> ) >>> # Classify nets >>> nets.classify_nets( - >>> power_nets=["VDD_CPU", "VDD_MEM"], - >>> signal_nets=["PCIe_TX", "ETH_RX"] + >>> power_nets = (["VDD_CPU", "VDD_MEM"],) + >>> signal_nets = ["PCIe_TX", "ETH_RX"] >>> ) >>> # Check power/ground status @@ -113,15 +113,15 @@ class Nets(CommonNets): >>> # Get DC-connected nets >>> dc_connected = nets.get_dcconnected_net_list( - >>> ground_nets=["GND"], - >>> res_value=0.002 + >>> ground_nets = (["GND"],) + >>> res_value = 0.002 >>> ) print("DC-connected nets:", dc_connected) >>> # Get power tree >>> comp_list, columns, net_group = nets.get_powertree( - >>> power_net_name="VDD_CPU", - >>> ground_nets=["GND"] + >>> power_net_name = ("VDD_CPU",) + >>> ground_nets = ["GND"] >>> ) >>> print("Power tree components:", comp_list) @@ -143,8 +143,8 @@ class Nets(CommonNets): >>> # Find and fix disjoint nets (deprecated) >>> fixed_nets = nets.find_and_fix_disjoint_nets( - >>> net_list=["PCIe_TX"], - >>> clean_disjoints_less_than=1e-6 + >>> net_list = (["PCIe_TX"],) + >>> clean_disjoints_less_than = 1e-6 >>> ) >>> print("Fixed nets:", fixed_nets) @@ -422,11 +422,7 @@ def generate_extended_nets( Examples -------- - >>> edb_nets.generate_extended_nets( - ... resistor_below=5, - ... inductor_below=0.5, - ... capacitor_above=0.1 - ... ) + >>> edb_nets.generate_extended_nets(resistor_below=5, inductor_below=0.5, capacitor_above=0.1) """ warnings.warn("Use new method :func:`edb.extended_nets.generate_extended_nets` instead.", DeprecationWarning) self._pedb.extended_nets.generate_extended_nets( @@ -487,10 +483,7 @@ def classify_nets( Examples -------- - >>> edb_nets.classify_nets( - ... power_nets=["VDD_CPU", "VDD_MEM"], - ... signal_nets=["PCIe_TX", "ETH_RX"] - ... ) + >>> edb_nets.classify_nets(power_nets=["VDD_CPU", "VDD_MEM"], signal_nets=["PCIe_TX", "ETH_RX"]) """ if isinstance(power_nets, str): power_nets = [] @@ -551,10 +544,7 @@ def get_dcconnected_net_list(self, ground_nets: List[str] = ["GND"], res_value: Examples -------- - >>> dc_connected = edb_nets.get_dcconnected_net_list( - ... ground_nets=["GND"], - ... res_value=0.002 - ... ) + >>> dc_connected = edb_nets.get_dcconnected_net_list(ground_nets=["GND"], res_value=0.002) >>> for net_group in dc_connected: ... print("Connected nets:", net_group) """ @@ -611,10 +601,7 @@ def get_powertree( Examples -------- - >>> comp_list, columns, net_group = edb_nets.get_powertree( - ... power_net_name="VDD_CPU", - ... ground_nets=["GND"] - ... ) + >>> comp_list, columns, net_group = edb_nets.get_powertree(power_net_name="VDD_CPU", ground_nets=["GND"]) >>> print("Power tree components:", comp_list) """ flag_in_ng = False @@ -700,7 +687,7 @@ def delete(self, netlist: Union[str, List[str]]) -> List[str]: Examples -------- - >>> deleted_nets = database.nets.delete(["Net1","Net2"]) + >>> deleted_nets = database.nets.delete(["Net1", "Net2"]) """ if isinstance(netlist, str): netlist = [netlist] @@ -858,10 +845,7 @@ def find_and_fix_disjoint_nets( Examples -------- - >>> fixed_nets = edb_nets.find_and_fix_disjoint_nets( - ... net_list=["PCIe_TX"], - ... clean_disjoints_less_than=1e-6 - ... ) + >>> fixed_nets = edb_nets.find_and_fix_disjoint_nets(net_list=["PCIe_TX"], clean_disjoints_less_than=1e-6) >>> print("Fixed nets:", fixed_nets) """ diff --git a/src/pyedb/grpc/database/padstacks.py b/src/pyedb/grpc/database/padstacks.py index 8ef70591fd..c3c61bd7e1 100644 --- a/src/pyedb/grpc/database/padstacks.py +++ b/src/pyedb/grpc/database/padstacks.py @@ -23,11 +23,14 @@ """ This module contains the `EdbPadstacks` class. """ -from collections import defaultdict + import math -from typing import Any, Dict, List, Optional, Tuple, Union import warnings +from collections import defaultdict +from typing import Any, Dict, List, Optional, Tuple, Union +import numpy as np +import rtree from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, ) @@ -37,17 +40,15 @@ from ansys.edb.core.definition.padstack_def_data import ( PadstackHoleRange as GrpcPadstackHoleRange, ) +from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType from ansys.edb.core.definition.padstack_def_data import ( SolderballPlacement as GrpcSolderballPlacement, ) from ansys.edb.core.definition.padstack_def_data import ( SolderballShape as GrpcSolderballShape, ) -from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -import numpy as np -import rtree from pyedb.generic.general_methods import generate_unique_name from pyedb.grpc.database.definition.padstack_def import PadstackDef @@ -334,7 +335,7 @@ def pingroups(self) -> List[Any]: >>> groups = edb_padstacks._layout.pin_groups # New way """ warnings.warn( - "`pingroups` is deprecated and is now located here " "`pyedb.grpc.core.layout.pin_groups` instead.", + "`pingroups` is deprecated and is now located here `pyedb.grpc.core.layout.pin_groups` instead.", DeprecationWarning, ) return self._layout.pin_groups @@ -380,10 +381,7 @@ def create_circular_padstack( Examples -------- >>> via_name = edb_padstacks.create_circular_padstack( - ... padstackname="VIA1", - ... holediam="200um", - ... paddiam="400um", - ... antipaddiam="600um" + ... padstackname="VIA1", holediam="200um", paddiam="400um", antipaddiam="600um" ... ) """ @@ -1299,8 +1297,7 @@ def get_padstack_instance_by_net_name(self, net: str): List of padstack instances associated with the specified net. """ warnings.warn( - "`get_padstack_instance_by_net_name` is deprecated, use `get_instances` with `net_name` " - "parameter instead.", + "`get_padstack_instance_by_net_name` is deprecated, use `get_instances` with `net_name` parameter instead.", DeprecationWarning, ) return self.get_instances(net_name=net) diff --git a/src/pyedb/grpc/database/primitive/bondwire.py b/src/pyedb/grpc/database/primitive/bondwire.py index a257cc0387..0b7df258e5 100644 --- a/src/pyedb/grpc/database/primitive/bondwire.py +++ b/src/pyedb/grpc/database/primitive/bondwire.py @@ -20,10 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.edb.core.primitive.bondwire import Bondwire as GrpcBondWire from ansys.edb.core.primitive.bondwire import ( BondwireCrossSectionType as GrpcBondwireCrossSectionType, ) -from ansys.edb.core.primitive.bondwire import Bondwire as GrpcBondWire from ansys.edb.core.primitive.bondwire import BondwireType as GrpcBondWireType from pyedb.grpc.database.utility.value import Value diff --git a/src/pyedb/grpc/database/primitive/padstack_instance.py b/src/pyedb/grpc/database/primitive/padstack_instance.py index 807f4b342d..973ffd8cc2 100644 --- a/src/pyedb/grpc/database/primitive/padstack_instance.py +++ b/src/pyedb/grpc/database/primitive/padstack_instance.py @@ -144,7 +144,7 @@ def set_backdrill_top(self, drill_depth, drill_diameter, offset=0.0): True if success, False otherwise. """ warnings.warn( - "`set_backdrill_top` is deprecated. Use `set_back_drill_by_depth` or " "`set_back_drill_by_layer` instead.", + "`set_backdrill_top` is deprecated. Use `set_back_drill_by_depth` or `set_back_drill_by_layer` instead.", DeprecationWarning, ) if isinstance(drill_depth, str): @@ -179,8 +179,7 @@ def set_backdrill_bottom(self, drill_depth, drill_diameter, offset=0.0): True if success, False otherwise. """ warnings.warn( - "`set_backdrill_bottom` is deprecated. Use `set_back_drill_by_depth` or " - "`set_back_drill_by_layer` instead.", + "`set_backdrill_bottom` is deprecated. Use `set_back_drill_by_depth` or `set_back_drill_by_layer` instead.", DeprecationWarning, ) if isinstance(drill_depth, str): diff --git a/src/pyedb/grpc/database/primitive/rectangle.py b/src/pyedb/grpc/database/primitive/rectangle.py index 920eaa6cd2..a17d00c9eb 100644 --- a/src/pyedb/grpc/database/primitive/rectangle.py +++ b/src/pyedb/grpc/database/primitive/rectangle.py @@ -21,10 +21,10 @@ # SOFTWARE. +from ansys.edb.core.primitive.rectangle import Rectangle as GrpcRectangle from ansys.edb.core.primitive.rectangle import ( RectangleRepresentationType as GrpcRectangleRepresentationType, ) -from ansys.edb.core.primitive.rectangle import Rectangle as GrpcRectangle from pyedb.grpc.database.primitive.primitive import Primitive from pyedb.grpc.database.utility.value import Value diff --git a/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py b/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py index 6e248a344f..9de0c904e1 100644 --- a/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py +++ b/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py @@ -23,6 +23,8 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( AdaptType as GrpcAdaptType, +) +from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( HFSSGeneralSettings as GrpcHFSSGeneralSettings, ) diff --git a/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py b/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py index b041990238..bb0124d3a2 100644 --- a/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py +++ b/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py @@ -23,7 +23,11 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( BasisFunctionOrder as GrpcBasisFunctionOrder, +) +from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( HFSSSettingsOptions as GrpcHFSSSettingsOptions, +) +from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( SolverType as GrpcSolverType, ) diff --git a/src/pyedb/grpc/database/simulation_setup/sweep_data.py b/src/pyedb/grpc/database/simulation_setup/sweep_data.py index c94a54aeba..4a3a587b03 100644 --- a/src/pyedb/grpc/database/simulation_setup/sweep_data.py +++ b/src/pyedb/grpc/database/simulation_setup/sweep_data.py @@ -22,9 +22,11 @@ from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, +) +from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, - SweepData as GrpcSweepData, ) +from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData class SweepData(GrpcSweepData): diff --git a/src/pyedb/grpc/database/siwave.py b/src/pyedb/grpc/database/siwave.py index d8a82048b0..6cc63303bc 100644 --- a/src/pyedb/grpc/database/siwave.py +++ b/src/pyedb/grpc/database/siwave.py @@ -26,15 +26,17 @@ """ import os -from typing import Any, Dict, Optional, Union import warnings +from typing import Any, Dict, Optional, Union from ansys.edb.core.database import ProductIdType as GrpcProductIdType from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, +) +from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, - SweepData as GrpcSweepData, ) +from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData from pyedb.grpc.database.simulation_setup.siwave_cpa_simulation_setup import ( SIWaveCPASimulationSetup, @@ -562,9 +564,7 @@ def create_exec_file( >>> success = edbapp.siwave.create_exec_file(add_ac=True, add_syz=True) >>> # Create exec file with Touchstone export >>> success = edbapp.siwave.create_exec_file( - ... add_ac=True, - ... export_touchstone=True, - ... touchstone_file_path="C:/temp/my_touchstone.s2p" + ... add_ac=True, export_touchstone=True, touchstone_file_path="C:/temp/my_touchstone.s2p" ... ) """ workdir = os.path.dirname(self._pedb.edbpath) @@ -643,17 +643,13 @@ def add_siwave_syz_analysis( >>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", edbversion="2021.2") >>> # Add SYZ analysis with linear sweep from 1kHz to 10GHz - >>> setup = edbapp.siwave.add_siwave_syz_analysis( - ... start_freq=1e3, - ... stop_freq=10e9, - ... distribution="linear" - ... ) + >>> setup = edbapp.siwave.add_siwave_syz_analysis(start_freq=1e3, stop_freq=10e9, distribution="linear") >>> # Add SYZ analysis with decade sweep >>> setup = edbapp.siwave.add_siwave_syz_analysis( ... start_freq=1e3, ... stop_freq=10e9, ... distribution="decade_count", - ... step_freq=10 # 10 points per decade + ... step_freq=10, # 10 points per decade ... ) """ setup = self._pedb.create_siwave_syz_setup() diff --git a/src/pyedb/grpc/database/source_excitations.py b/src/pyedb/grpc/database/source_excitations.py index 7f71119f53..0d7e7e3306 100644 --- a/src/pyedb/grpc/database/source_excitations.py +++ b/src/pyedb/grpc/database/source_excitations.py @@ -66,13 +66,13 @@ class SourceExcitation: >>> # Create voltage source on component pins >>> from pyedb.grpc.database.utility.sources import Source, SourceType >>> source = Source( - >>> source_type=SourceType.Vsource, - >>> name="V1", - >>> positive_node=("U1", "VCC"), - >>> negative_node=("U1", "GND"), - >>> amplitude="1V", - >>> phase="0deg", - >>> impedance="50ohm" + >>> source_type = (SourceType.Vsource,) + >>> name = ("V1",) + >>> positive_node = (("U1", "VCC"),) + >>> negative_node = (("U1", "GND"),) + >>> amplitude = ("1V",) + >>> phase = ("0deg",) + >>> impedance = "50ohm" >>> ) >>> source_excitations.create_source_on_component([source]) @@ -85,20 +85,20 @@ class SourceExcitation: >>> # 3. create_port_on_pins >>> # Create circuit port between component pins >>> port_term = source_excitations.create_port_on_pins( - >>> refdes="U1", - >>> pins="Pin1", - >>> reference_pins=["GND_Pin1", "GND_Pin2"], - >>> impedance=50, - >>> port_name="Port1" + >>> refdes = ("U1",) + >>> pins = ("Pin1",) + >>> reference_pins = (["GND_Pin1", "GND_Pin2"],) + >>> impedance = (50,) + >>> port_name = "Port1" >>> ) >>> # 4. create_port_on_component >>> # Create coaxial ports on component nets >>> source_excitations.create_port_on_component( >>> component="U1", - >>> net_list=["PCIe_RX0", "PCIe_RX1"], - >>> port_type=SourceType.CoaxPort, - >>> reference_net="GND" + >>> net_list = (["PCIe_RX0", "PCIe_RX1"],) + >>> port_type = (SourceType.CoaxPort,) + >>> reference_net = "GND" >>> ) >>> # 5. add_port_on_rlc_component @@ -153,9 +153,9 @@ class SourceExcitation: >>> # 16. create_coax_port_on_component >>> # Create coaxial ports on component >>> ports = source_excitations.create_coax_port_on_component( - >>> ["U1", "U2"], - >>> ["PCIe_RX0", "PCIe_TX0"], - >>> delete_existing_terminal=True + >>> (["U1", "U2"],) + >>> (["PCIe_RX0", "PCIe_TX0"],) + >>> delete_existing_terminal = True >>> ) >>> # 17. create_differential_wave_port @@ -163,23 +163,32 @@ class SourceExcitation: >>> pos_prim = edb.modeler.primitives[0] >>> neg_prim = edb.modeler.primitives[1] >>> port_name, diff_port = source_excitations.create_differential_wave_port( - >>> pos_prim.id, [0, 0], - >>> neg_prim.id, [0, 0.2], + >>> ( + ... pos_prim.id, + ... [0, 0], + ... ) + >>> ( + ... neg_prim.id, + ... [0, 0.2], + ... ) >>> "DiffPort" >>> ) >>> # 18. create_wave_port >>> # Create wave port >>> port_name, wave_port = source_excitations.create_wave_port( - >>> pos_prim.id, [0, 0], + >>> ( + ... pos_prim.id, + ... [0, 0], + ... ) >>> "WavePort" >>> ) >>> # 19. create_bundle_wave_port >>> # Create bundle wave port >>> port_name, bundle_port = source_excitations.create_bundle_wave_port( - >>> [pos_prim.id, neg_prim.id], - >>> [[0,0], [0,0.2]], + >>> ([pos_prim.id, neg_prim.id],) + >>> ([[0, 0], [0, 0.2]],) >>> "BundlePort" >>> ) @@ -194,8 +203,12 @@ class SourceExcitation: >>> # 22. place_voltage_probe >>> # Place voltage probe between points >>> source_excitations.place_voltage_probe( - >>> "Probe1", - >>> "SignalNet", [0, 0], "TopLayer", + >>> ("Probe1",) + >>> ( + ... "SignalNet", + ... [0, 0], + ... "TopLayer", + ... ) >>> "GND", [0.1, 0.1], "BottomLayer" >>> ) @@ -1656,8 +1669,7 @@ def create_voltage_source_on_net( if not source_name: source_name = ( - f"Vsource_{positive_component_name}_{positive_net_name}_" - f"{negative_component_name}_{negative_net_name}" + f"Vsource_{positive_component_name}_{positive_net_name}_{negative_component_name}_{negative_net_name}" ) return self.create_pin_group_terminal( positive_pins=pos_node_pins, @@ -1720,8 +1732,7 @@ def create_current_source_on_net( if not source_name: source_name = ( - f"Vsource_{positive_component_name}_{positive_net_name}_" - f"{negative_component_name}_{negative_net_name}" + f"Vsource_{positive_component_name}_{positive_net_name}_{negative_component_name}_{negative_net_name}" ) return self.create_pin_group_terminal( positive_pins=pos_node_pins, @@ -1865,7 +1876,7 @@ def create_differential_wave_port( -------- >>> from pyedb import Edb >>> edb = Edb() - >>> port_name, port = edb.source_excitation.create_differential_wave_port(0, [0,0], 1, [0,0.2]) + >>> port_name, port = edb.source_excitation.create_differential_wave_port(0, [0, 0], 1, [0, 0.2]) """ if not port_name: port_name = generate_unique_name("diff") @@ -1939,7 +1950,7 @@ def create_wave_port( -------- >>> from pyedb import Edb >>> edb = Edb() - >>> port_name, port = edb.source_excitation.create_wave_port(0, [0,0]) + >>> port_name, port = edb.source_excitation.create_wave_port(0, [0, 0]) """ if not port_name: port_name = generate_unique_name("Terminal_") @@ -2007,7 +2018,7 @@ def create_edge_port_vertical( -------- >>> from pyedb import Edb >>> edb = Edb() - >>> term = edb.source_excitation.create_edge_port_vertical(0, [0,0], reference_layer="TopLayer") + >>> term = edb.source_excitation.create_edge_port_vertical(0, [0, 0], reference_layer="TopLayer") """ if not port_name: port_name = generate_unique_name("Terminal_") @@ -2079,7 +2090,7 @@ def create_edge_port_horizontal( -------- >>> from pyedb import Edb >>> edb = Edb() - >>> edb.source_excitation.create_edge_port_horizontal(0, [0,0], 1, [0,0.1], "EdgePort") + >>> edb.source_excitation.create_edge_port_horizontal(0, [0, 0], 1, [0, 0.1], "EdgePort") """ pos_edge_term = self._create_edge_terminal(prim_id, point_on_edge, port_name) neg_edge_term = self._create_edge_terminal(ref_prim_id, point_on_ref_edge, port_name + "_ref", is_ref=True) @@ -2350,7 +2361,7 @@ def create_bundle_wave_port( -------- >>> from pyedb import Edb >>> edb = Edb() - >>> port_name, port = edb.source_excitation.create_bundle_wave_port([0,1], [[0,0],[0,0.2]]) + >>> port_name, port = edb.source_excitation.create_bundle_wave_port([0, 1], [[0, 0], [0, 0.2]]) """ if not port_name: port_name = generate_unique_name("bundle_port") @@ -2453,7 +2464,7 @@ def get_point_terminal(self, name: str, net_name: str, location: List[float], la -------- >>> from pyedb import Edb >>> edb = Edb() - >>> term = edb.source_excitation.get_point_terminal("Term1", "Net1", [0,0], "TopLayer") + >>> term = edb.source_excitation.get_point_terminal("Term1", "Net1", [0, 0], "TopLayer") """ from pyedb.grpc.database.terminal.point_terminal import PointTerminal @@ -2571,7 +2582,7 @@ def create_edge_port_on_polygon( >>> edb = Edb() >>> poly = edb.modeler.primitives[0] >>> ref_poly = edb.modeler.primitives[1] - >>> edb.source_excitation.create_edge_port_on_polygon(poly, ref_poly, [0,0], [0.1,0]) + >>> edb.source_excitation.create_edge_port_on_polygon(poly, ref_poly, [0, 0], [0.1, 0]) """ if not polygon: self._logger.error("No polygon provided for port {} creation".format(port_name)) @@ -3072,8 +3083,9 @@ def place_voltage_probe( -------- >>> from pyedb import Edb >>> edb = Edb() - >>> probe = edb.source_excitation.place_voltage_probe("Probe1", "Net1", [0,0], "TopLayer", - ... "GND", [0.1,0], "TopLayer") + >>> probe = edb.source_excitation.place_voltage_probe( + ... "Probe1", "Net1", [0, 0], "TopLayer", "GND", [0.1, 0], "TopLayer" + ... ) """ p_terminal = PointTerminal.create( layout=self._pedb.active_layout, diff --git a/src/pyedb/grpc/database/stackup.py b/src/pyedb/grpc/database/stackup.py index 37435f3900..a5d86c5de7 100644 --- a/src/pyedb/grpc/database/stackup.py +++ b/src/pyedb/grpc/database/stackup.py @@ -27,12 +27,12 @@ from __future__ import absolute_import -from collections import OrderedDict import json import logging import math -from typing import Any, Dict, List, Optional, Tuple, Union import warnings +from collections import OrderedDict +from typing import Any, Dict, List, Optional, Tuple, Union from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation from ansys.edb.core.definition.solder_ball_property import ( @@ -43,10 +43,10 @@ from ansys.edb.core.hierarchy.component_group import ComponentType as GrpcComponentType from ansys.edb.core.layer.layer import LayerType as GrpcLayerType from ansys.edb.core.layer.layer import TopBottomAssociation as GrpcTopBottomAssociation +from ansys.edb.core.layer.layer_collection import LayerCollection as GrpcLayerCollection from ansys.edb.core.layer.layer_collection import ( LayerCollectionMode as GrpcLayerCollectionMode, ) -from ansys.edb.core.layer.layer_collection import LayerCollection as GrpcLayerCollection from ansys.edb.core.layer.layer_collection import LayerTypeSet as GrpcLayerTypeSet from ansys.edb.core.layer.stackup_layer import StackupLayer as GrpcStackupLayer from ansys.edb.core.layout.mcad_model import McadModel as GrpcMcadModel @@ -128,8 +128,9 @@ def add_layer_top(self, name: str, layer_type: str = "signal", **kwargs) -> Unio -------- >>> from pyedb import Edb >>> edb = Edb() - >>> top_layer = edb.stackup.add_layer_top("NewTopLayer", layer_type="signal", thickness="0.1mm", - ... material="copper") + >>> top_layer = edb.stackup.add_layer_top( + ... "NewTopLayer", layer_type="signal", thickness="0.1mm", material="copper" + ... ) """ thickness = Value(0.0) if "thickness" in kwargs: @@ -167,8 +168,9 @@ def add_layer_bottom(self, name: str, layer_type: str = "signal", **kwargs) -> U -------- >>> from pyedb import Edb >>> edb = Edb() - >>> bot_layer = edb.stackup.add_layer_bottom("NewBottomLayer", layer_type="signal", thickness="0.1mm", - ... material="copper") + >>> bot_layer = edb.stackup.add_layer_bottom( + ... "NewBottomLayer", layer_type="signal", thickness="0.1mm", material="copper" + ... ) """ thickness = Value(0.0) layer_type_map = {"dielectric": GrpcLayerType.DIELECTRIC_LAYER, "signal": GrpcLayerType.SIGNAL_LAYER} @@ -1330,15 +1332,21 @@ def place_in_layout( >>> mounted_cmp = edb2.components.get_component_by_name("BGA") >>> vector, rotation, solder_ball_height = edb1.components.get_component_placement_vector( - ... mounted_component=mounted_cmp, - ... hosting_component=hosting_cmp, - ... mounted_component_pin1="A12", - ... mounted_component_pin2="A14", - ... hosting_component_pin1="A12", - ... hosting_component_pin2="A14") - >>> edb2.stackup.place_in_layout(edb1.active_cell, angle=0.0, offset_x=vector[0], - ... offset_y=vector[1], flipped_stackup=False, place_on_top=True, - ... ) + ... mounted_component=mounted_cmp, + ... hosting_component=hosting_cmp, + ... mounted_component_pin1="A12", + ... mounted_component_pin2="A14", + ... hosting_component_pin1="A12", + ... hosting_component_pin2="A14", + ... ) + >>> edb2.stackup.place_in_layout( + ... edb1.active_cell, + ... angle=0.0, + ... offset_x=vector[0], + ... offset_y=vector[1], + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ # if flipped_stackup and place_on_top or (not flipped_stackup and not place_on_top): self.adjust_solder_dielectrics() @@ -1418,9 +1426,14 @@ def place_in_layout_3d_placement( >>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2") >>> hosting_cmp = edb1.components.get_component_by_name("U100") >>> mounted_cmp = edb2.components.get_component_by_name("BGA") - >>> edb2.stackup.place_in_layout(edb1.active_cell, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb2.stackup.place_in_layout( + ... edb1.active_cell, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ _angle = angle * math.pi / 180.0 @@ -1678,9 +1691,14 @@ def place_a3dcomp_3d_placement( -------- >>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2") >>> a3dcomp_path = "connector.a3dcomp" - >>> edb1.stackup.place_a3dcomp_3d_placement(a3dcomp_path, angle=0.0, offset_x="1mm", - ... offset_y="2mm", flipped_stackup=False, place_on_top=True, - ... ) + >>> edb1.stackup.place_a3dcomp_3d_placement( + ... a3dcomp_path, + ... angle=0.0, + ... offset_x="1mm", + ... offset_y="2mm", + ... flipped_stackup=False, + ... place_on_top=True, + ... ) """ rotation_axis_from = GrpcPoint3DData(1.0, 0.0, 0.0) _angle = angle * math.pi / 180.0 diff --git a/src/pyedb/grpc/database/terminal/bundle_terminal.py b/src/pyedb/grpc/database/terminal/bundle_terminal.py index b1d0b81c83..0aefccd89f 100644 --- a/src/pyedb/grpc/database/terminal/bundle_terminal.py +++ b/src/pyedb/grpc/database/terminal/bundle_terminal.py @@ -21,10 +21,10 @@ # SOFTWARE. from ansys.edb.core.terminal.bundle_terminal import BundleTerminal as GrpcBundleTerminal +from ansys.edb.core.terminal.terminal import HfssPIType as GrpcHfssPIType from ansys.edb.core.terminal.terminal import ( SourceTermToGroundType as GrpcSourceTermToGroundType, ) -from ansys.edb.core.terminal.terminal import HfssPIType as GrpcHfssPIType from pyedb.grpc.database.hierarchy.component import Component from pyedb.grpc.database.layers.layer import Layer diff --git a/src/pyedb/grpc/database/utility/hfss_extent_info.py b/src/pyedb/grpc/database/utility/hfss_extent_info.py index 5c5b52f0cb..f897eb216b 100644 --- a/src/pyedb/grpc/database/utility/hfss_extent_info.py +++ b/src/pyedb/grpc/database/utility/hfss_extent_info.py @@ -20,11 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo as GrpcHfssExtentInfo from ansys.edb.core.utility.hfss_extent_info import ( - HfssExtentInfo as GrpcHfssExtentInfo, HFSSExtentInfoType as GrpcHfssExtentInfoType, - OpenRegionType as GrpcOpenRegionType, ) +from ansys.edb.core.utility.hfss_extent_info import OpenRegionType as GrpcOpenRegionType from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/edb.py b/src/pyedb/grpc/edb.py index 5f56cdf389..40106e3f93 100644 --- a/src/pyedb/grpc/edb.py +++ b/src/pyedb/grpc/edb.py @@ -56,7 +56,6 @@ >>> edb.export_hfss(r"C:\output_folder") """ -from itertools import combinations import os import re import shutil @@ -65,20 +64,21 @@ import tempfile import time import traceback -from typing import Dict, List, Union import warnings +from itertools import combinations +from typing import Dict, List, Union from zipfile import ZipFile as zpf +import ansys.edb.core.layout.cell +import rtree from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.layout_component import ( LayoutComponent as GrpcLayoutComponent, ) -import ansys.edb.core.layout.cell from ansys.edb.core.simulation_setup.siwave_dcir_simulation_setup import ( SIWaveDCIRSimulationSetup as GrpcSIWaveDCIRSimulationSetup, ) from ansys.edb.core.utility.value import Value as GrpcValue -import rtree from pyedb.configuration.configuration import Configuration from pyedb.generic.constants import unit_converter @@ -1187,7 +1187,7 @@ def get_connected_objects(self, layout_object_instance): continue except: self.logger.warning( - f"Failed to find connected objects on layout_obj " f"{layout_object_instance.layout_obj.id}, skipping." + f"Failed to find connected objects on layout_obj {layout_object_instance.layout_obj.id}, skipping." ) pass return temp @@ -1395,7 +1395,7 @@ def import_gds_file( command = [ anstranslator_full_path, inputGDS, - f'-o="{control_file_temp}"' f'-t="{tech_file}"', + f'-o="{control_file_temp}"-t="{tech_file}"', f'-g="{map_file}"', f'-f="{layer_filter}"', ] @@ -1730,7 +1730,7 @@ def cutout( >>> # Create a basic cutout: >>> edb.cutout(signal_list=["Net1"], reference_list=["GND"]) >>> # Create cutout with custom polygon: - >>> custom_poly = [[0,0], [10e-3,0], [10e-3,10e-3], [0,10e-3]] + >>> custom_poly = [[0, 0], [10e-3, 0], [10e-3, 10e-3], [0, 10e-3]] >>> edb.cutout(custom_extent=custom_poly) """ if expansion_factor > 0: @@ -3005,7 +3005,7 @@ def create_hfss_setup( Use :func:`pyedb.grpc.core.hfss.add_setup` instead. """ warnings.warn( - "`create_hfss_setup` is deprecated and is now located here " "`pyedb.grpc.core.hfss.add_setup` instead.", + "`create_hfss_setup` is deprecated and is now located here `pyedb.grpc.core.hfss.add_setup` instead.", DeprecationWarning, ) return self._hfss.add_setup( @@ -3753,8 +3753,7 @@ def create_model_for_arbitrary_wave_ports( ] if not polys: self.logger.error( - f"No polygon found with voids on layer {reference_layer} during model creation for " - f"arbitrary wave ports" + f"No polygon found with voids on layer {reference_layer} during model creation for arbitrary wave ports" ) return False void_padstacks = [] @@ -3767,7 +3766,7 @@ def create_model_for_arbitrary_wave_ports( if not void_padstacks: self.logger.error( - "No padstack instances found inside evaluated voids during model creation for arbitrary" "waveports" + "No padstack instances found inside evaluated voids during model creation for arbitrarywaveports" ) return False cloned_edb = Edb(edbpath=output_edb, edbversion=self.edbversion, restart_rpc_server=True) diff --git a/src/pyedb/grpc/rpc_session.py b/src/pyedb/grpc/rpc_session.py index 984d446de9..98e93cd3d5 100644 --- a/src/pyedb/grpc/rpc_session.py +++ b/src/pyedb/grpc/rpc_session.py @@ -21,17 +21,17 @@ # SOFTWARE. import os -from random import randint import sys import time +from random import randint +import psutil from ansys.edb.core.session import launch_session from ansys.edb.core.utility.io_manager import ( IOMangementType, end_managing, start_managing, ) -import psutil from pyedb import __version__ from pyedb.generic.general_methods import env_path, env_value, is_linux diff --git a/src/pyedb/libraries/common.py b/src/pyedb/libraries/common.py index e0ab1bc02f..b31304b0a2 100644 --- a/src/pyedb/libraries/common.py +++ b/src/pyedb/libraries/common.py @@ -45,8 +45,7 @@ class Substrate: Examples -------- - >>> sub = Substrate(h=1.6e-3, er=4.4, tan_d=0.02, - ... name="FR4", size=(10e-3, 15e-3)) + >>> sub = Substrate(h=1.6e-3, er=4.4, tan_d=0.02, name="FR4", size=(10e-3, 15e-3)) >>> sub.h 0.0016 """ @@ -84,7 +83,7 @@ class Material: >>> m = Material(edb, "MyMaterial") >>> m.name 'MyMaterial' - >>> edb.materials["MyMaterial"] # now exists in the database + >>> edb.materials["MyMaterial"] # now exists in the database """ @@ -125,7 +124,7 @@ class Conductor(Material): >>> cu = Conductor(edb, "Copper", conductivity=5.8e7) >>> cu.conductivity 58000000.0 - >>> cu.conductivity = 3.5e7 # update on-the-fly + >>> cu.conductivity = 3.5e7 # update on-the-fly >>> edb.materials["Copper"].conductivity 35000000.0 """ diff --git a/src/pyedb/libraries/rf_libraries/base_functions.py b/src/pyedb/libraries/rf_libraries/base_functions.py index d609e27cf4..5dc96a899d 100644 --- a/src/pyedb/libraries/rf_libraries/base_functions.py +++ b/src/pyedb/libraries/rf_libraries/base_functions.py @@ -50,8 +50,7 @@ class HatchGround: Examples -------- - >>> hatch = HatchGround(pitch=0.5e-3, width=0.2e-3, - ... fill_target=70, board_size=5e-3) + >>> hatch = HatchGround(pitch=0.5e-3, width=0.2e-3, fill_target=70, board_size=5e-3) >>> edb = Edb("demo.aedb") >>> hatch._edb = edb >>> hatch.create() @@ -164,8 +163,7 @@ class Meander: Examples -------- - >>> m = Meander(pitch=0.2e-3, trace_width=0.15e-3, - ... amplitude=2e-3, num_turns=4) + >>> m = Meander(pitch=0.2e-3, trace_width=0.15e-3, amplitude=2e-3, num_turns=4) >>> edb = Edb("meander.aedb") >>> m._pedb = edb >>> m.create() @@ -293,7 +291,7 @@ class MIMCapacitor: >>> edb = Edb("mim.aedb") >>> cap._pedb = edb >>> cap.create() - >>> f"{cap.capacitance_f*1e12:.2f} pF" + >>> f"{cap.capacitance_f * 1e12:.2f} pF" '1.45 pF' """ @@ -383,8 +381,7 @@ class SpiralInductor: Examples -------- - >>> sp = SpiralInductor(turns=3.5, trace_width=25e-6, - ... inner_diameter=80e-6) + >>> sp = SpiralInductor(turns=3.5, trace_width=25e-6, inner_diameter=80e-6) >>> edb = Edb("spiral.aedb") >>> sp._pedb = edb >>> sp.create() @@ -769,7 +766,7 @@ class RatRace: >>> edb = Edb("ratrace.aedb") >>> rr._pedb = edb >>> rr.create() - >>> f"{rr.circumference*1e3:.2f} mm" + >>> f"{rr.circumference * 1e3:.2f} mm" '45.00 mm' """ @@ -958,9 +955,7 @@ class InterdigitalCapacitor: Examples -------- - >>> idc = InterdigitalCapacitor(fingers=10, - ... finger_length="0.5mm", - ... gap="0.03mm") + >>> idc = InterdigitalCapacitor(fingers=10, finger_length="0.5mm", gap="0.03mm") >>> edb = Edb("idc.aedb") >>> idc._pedb = edb >>> idc.create() @@ -1104,11 +1099,7 @@ class DifferentialTLine: Examples -------- - >>> diff = DifferentialTLine(Edb("diff.aedb"), - ... length=5e-3, - ... width=0.15e-3, - ... spacing=0.1e-3, - ... angle=math.pi/4) + >>> diff = DifferentialTLine(Edb("diff.aedb"), length=5e-3, width=0.15e-3, spacing=0.1e-3, angle=math.pi / 4) >>> traces = diff.create() >>> f"{diff.diff_impedance:.1f} Ω" '95.6 Ω' diff --git a/src/pyedb/libraries/rf_libraries/planar_antennas.py b/src/pyedb/libraries/rf_libraries/planar_antennas.py index 06a05e0ac9..447e610cf7 100644 --- a/src/pyedb/libraries/rf_libraries/planar_antennas.py +++ b/src/pyedb/libraries/rf_libraries/planar_antennas.py @@ -66,13 +66,7 @@ class RectangularPatch: Build a 5.8 GHz patch on a 0.787 mm Rogers RO4350B substrate: >>> edb = pyedb.Edb() - >>> patch = RectangularPatch( - ... edb_cell=edb, - ... freq="5.8GHz", - ... inset="4.2mm", - ... layer="TOP", - ... bottom_layer="GND" - ... ) + >>> patch = RectangularPatch(edb_cell=edb, freq="5.8GHz", inset="4.2mm", layer="TOP", bottom_layer="GND") >>> patch.substrate.er = 3.66 >>> patch.substrate.tand = 0.0037 >>> patch.substrate.h = 0.000787 @@ -248,13 +242,7 @@ class CircularPatch: Build a 5.8 GHz circular patch on a 0.787 mm Rogers RO4350B substrate: >>> edb = pyedb.Edb() - >>> patch = CircularPatch( - ... edb_cell=edb, - ... freq="5.8GHz", - ... probe_offset="6.4mm", - ... layer="TOP", - ... bottom_layer="GND" - ... ) + >>> patch = CircularPatch(edb_cell=edb, freq="5.8GHz", probe_offset="6.4mm", layer="TOP", bottom_layer="GND") >>> patch.substrate.er = 3.66 >>> patch.substrate.tand = 0.0037 >>> patch.substrate.h = 0.000787 @@ -425,13 +413,7 @@ class TriangularPatch: Build a 5.8 GHz triangular patch on a 0.787 mm Rogers RO4350B substrate: >>> edb = pyedb.Edb() - >>> patch = TriangularPatch( - ... edb_cell=edb, - ... freq="5.8GHz", - ... probe_offset="5.6mm", - ... layer="TOP", - ... bottom_layer="GND" - ... ) + >>> patch = TriangularPatch(edb_cell=edb, freq="5.8GHz", probe_offset="5.6mm", layer="TOP", bottom_layer="GND") >>> patch.substrate.er = 3.66 >>> patch.substrate.tand = 0.0037 >>> patch.substrate.h = 0.000787 diff --git a/src/pyedb/misc/aedtlib_personalib_install.py b/src/pyedb/misc/aedtlib_personalib_install.py index 2c21a73984..1cc3f25e8d 100644 --- a/src/pyedb/misc/aedtlib_personalib_install.py +++ b/src/pyedb/misc/aedtlib_personalib_install.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from xml.dom.minidom import parseString import xml.etree.ElementTree as ET +from xml.dom.minidom import parseString def write_pretty_xml(root, file_path): diff --git a/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py b/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py index c744ab6206..aebaa7b0ce 100644 --- a/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py +++ b/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from copy import deepcopy as copy import json +from copy import deepcopy as copy import numpy as np diff --git a/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py b/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py index 5317063d09..0c406e31fb 100644 --- a/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py +++ b/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from enum import Enum import os import xml.etree as ET +from enum import Enum from pyedb.generic.general_methods import ET from pyedb.misc.siw_feature_config.xtalk_scan.fd_xtalk_scan_config import ( diff --git a/src/pyedb/modeler/geometry_operators.py b/src/pyedb/modeler/geometry_operators.py index 60addce820..1eaf5b2d0e 100644 --- a/src/pyedb/modeler/geometry_operators.py +++ b/src/pyedb/modeler/geometry_operators.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from collections import defaultdict import math import re import sys +from collections import defaultdict import numpy as np diff --git a/src/pyedb/siwave.py b/src/pyedb/siwave.py index 18da4ccfe3..ef8d53a708 100644 --- a/src/pyedb/siwave.py +++ b/src/pyedb/siwave.py @@ -9,14 +9,14 @@ from __future__ import absolute_import # noreorder import os -from pathlib import Path import pkgutil import shutil import sys import tempfile import time -from typing import Optional, Union import warnings +from pathlib import Path +from typing import Optional, Union from pyedb import Edb from pyedb.dotnet.clr_module import _clr diff --git a/tests/conftest.py b/tests/conftest.py index 38480b9f5d..d6fa767d7a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,15 +20,15 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""" -""" +""" """ + import json import os -from pathlib import Path import random import shutil import string import tempfile +from pathlib import Path import pytest diff --git a/tests/system/test_edb_configuration_2p0.py b/tests/system/test_edb_configuration_2p0.py index bed9f5d9af..f7c9013a6b 100644 --- a/tests/system/test_edb_configuration_2p0.py +++ b/tests/system/test_edb_configuration_2p0.py @@ -19,8 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from collections import Counter import json +from collections import Counter from pathlib import Path import pytest diff --git a/tests/system/test_edb_padstacks.py b/tests/system/test_edb_padstacks.py index 3ad4ca3be7..29c9cf0fdc 100644 --- a/tests/system/test_edb_padstacks.py +++ b/tests/system/test_edb_padstacks.py @@ -21,6 +21,7 @@ # SOFTWARE. """Tests related to Edb padstacks""" + import math import os @@ -581,6 +582,6 @@ def _assert_inside(rect, pad): BASE_MESSAGE = "rectangle is not inside pad as" result = rect.Intersect(pad) assert len(result) == 1, f"{BASE_MESSAGE} intersection returned more than one lump" - assert math.isclose( - round(result[0].Area(), 4), round(rect.Area(), 4) - ), f"{BASE_MESSAGE} area of intersection is not equal to rectangle area" + assert math.isclose(round(result[0].Area(), 4), round(rect.Area(), 4)), ( + f"{BASE_MESSAGE} area of intersection is not equal to rectangle area" + ) diff --git a/tests/system/test_edb_stackup.py b/tests/system/test_edb_stackup.py index f4dc292934..09a6112028 100644 --- a/tests/system/test_edb_stackup.py +++ b/tests/system/test_edb_stackup.py @@ -20,8 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Tests related to Edb stackup -""" +"""Tests related to Edb stackup""" import math import os diff --git a/tests/test_warnings.py b/tests/test_warnings.py index 9e1e36630d..fffbb3c944 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -21,8 +21,8 @@ # SOFTWARE. import sys -from unittest.mock import patch import warnings +from unittest.mock import patch from pyedb import LATEST_DEPRECATED_PYTHON_VERSION, deprecation_warning diff --git a/tests/unit/test_clr_module.py b/tests/unit/test_clr_module.py index cbb300d69c..7d6ec147e6 100644 --- a/tests/unit/test_clr_module.py +++ b/tests/unit/test_clr_module.py @@ -1,6 +1,6 @@ import os -from pathlib import Path import sys +from pathlib import Path from unittest.mock import MagicMock, patch import pytest diff --git a/tests/unit/test_edb.py b/tests/unit/test_edb.py index ae945a6272..7b94bba21f 100644 --- a/tests/unit/test_edb.py +++ b/tests/unit/test_edb.py @@ -23,8 +23,8 @@ import os -from mock import MagicMock, PropertyMock, patch import pytest +from mock import MagicMock, PropertyMock, patch from pyedb import Edb from tests.conftest import desktop_version diff --git a/tests/unit/test_edbsiwave.py b/tests/unit/test_edbsiwave.py index 28bd21beed..301d3a08ba 100644 --- a/tests/unit/test_edbsiwave.py +++ b/tests/unit/test_edbsiwave.py @@ -22,8 +22,8 @@ import os -from mock import Mock import pytest +from mock import Mock from pyedb.dotnet.database.siwave import EdbSiwave diff --git a/tests/unit/test_materials.py b/tests/unit/test_materials.py index dd17079f9b..ea9aacf2de 100644 --- a/tests/unit/test_materials.py +++ b/tests/unit/test_materials.py @@ -23,8 +23,8 @@ import builtins from unittest.mock import mock_open -from mock import MagicMock, PropertyMock, patch import pytest +from mock import MagicMock, PropertyMock, patch from pyedb.dotnet.database.materials import Materials diff --git a/tests/unit/test_padstack.py b/tests/unit/test_padstack.py index 8aa4ac5cb2..4ae8152040 100644 --- a/tests/unit/test_padstack.py +++ b/tests/unit/test_padstack.py @@ -21,8 +21,8 @@ # SOFTWARE. -from mock import MagicMock, PropertyMock, patch import pytest +from mock import MagicMock, PropertyMock, patch from pyedb.dotnet.database.padstack import EdbPadstacks diff --git a/tests/unit/test_stackup.py b/tests/unit/test_stackup.py index a33b438136..d38804f98f 100644 --- a/tests/unit/test_stackup.py +++ b/tests/unit/test_stackup.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from mock import MagicMock, PropertyMock, patch import pytest +from mock import MagicMock, PropertyMock, patch from pyedb.dotnet.database.stackup import Stackup From b6eb97b5d12920740b2f356446cd6595fcb9ea52 Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Tue, 26 Aug 2025 11:31:43 +0200 Subject: [PATCH 6/9] chore: Update list of ignored rules for ruff and pre-commit hooks, apply ruff linting and formatting --- .pre-commit-config.yaml | 21 +++---------------- doc/source/conf.py | 4 ++-- pyproject.toml | 2 ++ src/pyedb/configuration/configuration.py | 4 ++-- src/pyedb/dotnet/clr_module.py | 2 +- src/pyedb/dotnet/database/Variables.py | 6 ++++-- .../database/cell/hierarchy/component.py | 2 +- src/pyedb/dotnet/database/components.py | 2 +- .../database/edb_data/padstacks_data.py | 2 +- .../edb_data/simulation_configuration.py | 2 +- .../dotnet/database/geometry/polygon_data.py | 2 +- src/pyedb/dotnet/database/materials.py | 2 +- src/pyedb/dotnet/database/padstack.py | 4 ++-- src/pyedb/dotnet/database/stackup.py | 2 +- .../database/utilities/simulation_setup.py | 2 +- src/pyedb/dotnet/edb.py | 12 +++++------ src/pyedb/edb_logger.py | 2 +- src/pyedb/extensions/via_design_backend.py | 4 ++-- src/pyedb/generic/data_handlers.py | 2 +- src/pyedb/generic/design_types.py | 2 +- src/pyedb/generic/general_methods.py | 2 +- src/pyedb/generic/process.py | 2 +- src/pyedb/grpc/database/components.py | 8 +++---- .../grpc/database/definition/materials.py | 4 ++-- .../grpc/database/definition/package_def.py | 2 +- .../grpc/database/definition/padstack_def.py | 9 +++----- src/pyedb/grpc/database/hfss.py | 4 ---- .../grpc/database/hierarchy/component.py | 7 +++---- src/pyedb/grpc/database/layers/layer.py | 3 +-- .../grpc/database/layers/stackup_layer.py | 3 +-- src/pyedb/grpc/database/layout/layout.py | 2 +- src/pyedb/grpc/database/modeler.py | 5 ++--- src/pyedb/grpc/database/nets.py | 2 +- src/pyedb/grpc/database/padstacks.py | 18 +++++----------- src/pyedb/grpc/database/primitive/bondwire.py | 4 ++-- .../database/primitive/padstack_instance.py | 3 +-- src/pyedb/grpc/database/primitive/path.py | 3 +-- .../grpc/database/primitive/rectangle.py | 2 +- .../simulation_setup/hfss_general_settings.py | 2 -- .../simulation_setup/hfss_settings_options.py | 4 ---- .../database/simulation_setup/sweep_data.py | 4 +--- src/pyedb/grpc/database/siwave.py | 6 ++---- src/pyedb/grpc/database/source_excitations.py | 3 +-- src/pyedb/grpc/database/stackup.py | 11 +++++----- .../grpc/database/terminal/bundle_terminal.py | 2 +- src/pyedb/grpc/database/terminal/terminal.py | 8 ++++--- .../grpc/database/utility/hfss_extent_info.py | 4 ++-- src/pyedb/grpc/edb.py | 11 +++++----- src/pyedb/grpc/rpc_session.py | 4 ++-- src/pyedb/misc/aedtlib_personalib_install.py | 2 +- .../emc_rule_checker_settings.py | 2 +- .../xtalk_scan/scan_config.py | 2 +- src/pyedb/modeler/geometry_operators.py | 2 +- src/pyedb/siwave.py | 4 ++-- tests/conftest.py | 2 +- tests/system/test_edb_configuration_2p0.py | 2 +- tests/test_warnings.py | 2 +- tests/unit/test_clr_module.py | 2 +- tests/unit/test_edb.py | 2 +- tests/unit/test_edbsiwave.py | 2 +- tests/unit/test_materials.py | 2 +- tests/unit/test_padstack.py | 2 +- tests/unit/test_stackup.py | 2 +- 63 files changed, 104 insertions(+), 149 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96fe04655a..bfe9c75356 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,31 +11,16 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.9 + rev: v0.12.10 hooks: - - id: ruff + - id: ruff-check - id: ruff-format - repo: https://github.com/adamchainz/blacken-docs rev: 1.19.1 hooks: - id: blacken-docs - additional_dependencies: [black==23.10.1] - -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - args: ["--profile=black"] - -- repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - args: [ - --max-line-length, "120", - ansys, codegen, doc, examples, tests - ] + additional_dependencies: [black==25.1.0] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 634f9102ef..e696f99737 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,14 +1,14 @@ # Configuration file for the PyEDB documentation builder. import datetime +from importlib import import_module import json import os import pathlib +from pprint import pformat import shutil import sys import warnings -from importlib import import_module -from pprint import pformat from ansys_sphinx_theme import ( ansys_favicon, diff --git a/pyproject.toml b/pyproject.toml index d8686be97a..542f78ef43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -143,6 +143,7 @@ ignore = [ # "E" - pycodestyle, see https://docs.astral.sh/ruff/rules/#pycodestyle-e-w "E402", # module-import-not-at-top-of-file "E711", # none-comparison + "E712", # true-false-comparison "E713", # not-in-test "E721", # type-comparison "E722", # bare-except @@ -166,6 +167,7 @@ ignore = [ "N812", # lowercase-imported-as-non-lowercase "N813", # camelcase-imported-as-lowercase "N815", # mixed-case-variable-in-class-scope + "N816", # mixed-case-variable-in-global-scope "N817", # camelcase-imported-as-acronym "N818", # error-suffix-on-exception-name "N999", # invalid-module-name diff --git a/src/pyedb/configuration/configuration.py b/src/pyedb/configuration/configuration.py index 258bf31bd4..d8da7753aa 100644 --- a/src/pyedb/configuration/configuration.py +++ b/src/pyedb/configuration/configuration.py @@ -19,11 +19,11 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from datetime import datetime import json import os -import warnings -from datetime import datetime from pathlib import Path +import warnings import toml diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index 2619c67e0d..e383795df4 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -1,8 +1,8 @@ import os +from pathlib import Path import pkgutil import sys import warnings -from pathlib import Path import pyedb diff --git a/src/pyedb/dotnet/database/Variables.py b/src/pyedb/dotnet/database/Variables.py index 65cd76e568..535cddd26f 100644 --- a/src/pyedb/dotnet/database/Variables.py +++ b/src/pyedb/dotnet/database/Variables.py @@ -35,8 +35,10 @@ """ -from __future__ import absolute_import # noreorder -from __future__ import division +from __future__ import ( + absolute_import, # noreorder + division, +) import os import re diff --git a/src/pyedb/dotnet/database/cell/hierarchy/component.py b/src/pyedb/dotnet/database/cell/hierarchy/component.py index 5904c77321..96510046f1 100644 --- a/src/pyedb/dotnet/database/cell/hierarchy/component.py +++ b/src/pyedb/dotnet/database/cell/hierarchy/component.py @@ -22,8 +22,8 @@ import logging import re -import warnings from typing import Optional +import warnings from pyedb.dotnet.database.cell.hierarchy.hierarchy_obj import Group from pyedb.dotnet.database.cell.hierarchy.model import PinPairModel, SPICEModel diff --git a/src/pyedb/dotnet/database/components.py b/src/pyedb/dotnet/database/components.py index dddd972258..e1c359f7a2 100644 --- a/src/pyedb/dotnet/database/components.py +++ b/src/pyedb/dotnet/database/components.py @@ -27,8 +27,8 @@ import math import os import re -import warnings from typing import List, Set, Union +import warnings from pyedb.component_libraries.ansys_components import ( ComponentLib, diff --git a/src/pyedb/dotnet/database/edb_data/padstacks_data.py b/src/pyedb/dotnet/database/edb_data/padstacks_data.py index e08bac8f30..0915b97ca5 100644 --- a/src/pyedb/dotnet/database/edb_data/padstacks_data.py +++ b/src/pyedb/dotnet/database/edb_data/padstacks_data.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from collections import OrderedDict import math import warnings -from collections import OrderedDict from pyedb.dotnet.clr_module import String from pyedb.dotnet.database.cell.primitive.primitive import Connectable diff --git a/src/pyedb/dotnet/database/edb_data/simulation_configuration.py b/src/pyedb/dotnet/database/edb_data/simulation_configuration.py index 82941d2b5b..102ff16e52 100644 --- a/src/pyedb/dotnet/database/edb_data/simulation_configuration.py +++ b/src/pyedb/dotnet/database/edb_data/simulation_configuration.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from collections import OrderedDict import json import os -from collections import OrderedDict from pyedb.dotnet.clr_module import Dictionary from pyedb.dotnet.database.edb_data.sources import Source, SourceType diff --git a/src/pyedb/dotnet/database/geometry/polygon_data.py b/src/pyedb/dotnet/database/geometry/polygon_data.py index 5bb8e70bda..43487177d6 100644 --- a/src/pyedb/dotnet/database/geometry/polygon_data.py +++ b/src/pyedb/dotnet/database/geometry/polygon_data.py @@ -19,8 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import warnings from typing import Union +import warnings from pyedb.dotnet.database.general import convert_py_list_to_net_list from pyedb.dotnet.database.geometry.point_data import PointData diff --git a/src/pyedb/dotnet/database/materials.py b/src/pyedb/dotnet/database/materials.py index 6e7b70603e..1af27a54c3 100644 --- a/src/pyedb/dotnet/database/materials.py +++ b/src/pyedb/dotnet/database/materials.py @@ -26,8 +26,8 @@ import logging import os import re -import warnings from typing import Optional, Union +import warnings from pydantic import BaseModel, confloat diff --git a/src/pyedb/dotnet/database/padstack.py b/src/pyedb/dotnet/database/padstack.py index 48be2b3dbf..2af783fbdb 100644 --- a/src/pyedb/dotnet/database/padstack.py +++ b/src/pyedb/dotnet/database/padstack.py @@ -24,10 +24,10 @@ This module contains the `EdbPadstacks` class. """ -import math -import warnings from collections import defaultdict +import math from typing import Dict, List +import warnings import numpy as np import rtree diff --git a/src/pyedb/dotnet/database/stackup.py b/src/pyedb/dotnet/database/stackup.py index 152c2718ad..7e9ee74cf2 100644 --- a/src/pyedb/dotnet/database/stackup.py +++ b/src/pyedb/dotnet/database/stackup.py @@ -27,11 +27,11 @@ from __future__ import absolute_import # noreorder +from collections import OrderedDict import json import logging import math import warnings -from collections import OrderedDict from pyedb.dotnet.database.edb_data.layer_data import ( LayerEdbClass, diff --git a/src/pyedb/dotnet/database/utilities/simulation_setup.py b/src/pyedb/dotnet/database/utilities/simulation_setup.py index f025a33844..a67e7dfd31 100644 --- a/src/pyedb/dotnet/database/utilities/simulation_setup.py +++ b/src/pyedb/dotnet/database/utilities/simulation_setup.py @@ -21,8 +21,8 @@ # SOFTWARE. -import warnings from enum import Enum +import warnings from pyedb.dotnet.database.sim_setup_data.data.sim_setup_info import SimSetupInfo from pyedb.dotnet.database.sim_setup_data.data.sweep_data import SweepData diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index 06ef12de3b..1b6f781361 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -26,28 +26,28 @@ """ +from datetime import datetime +from itertools import combinations import os +from pathlib import Path import re import shutil import subprocess import sys import time import traceback -import warnings -from datetime import datetime -from itertools import combinations -from pathlib import Path from typing import Union +import warnings from zipfile import ZipFile as zpf import rtree -import pyedb.dotnet -import pyedb.dotnet.database.dotnet.database from pyedb.configuration.configuration import Configuration +import pyedb.dotnet from pyedb.dotnet.database.cell.layout import Layout from pyedb.dotnet.database.cell.terminal.terminal import Terminal from pyedb.dotnet.database.components import Components +import pyedb.dotnet.database.dotnet.database from pyedb.dotnet.database.edb_data.design_options import EdbDesignOptions from pyedb.dotnet.database.edb_data.ports import ( BundleWavePort, diff --git a/src/pyedb/edb_logger.py b/src/pyedb/edb_logger.py index db901df4d8..fcf5941372 100644 --- a/src/pyedb/edb_logger.py +++ b/src/pyedb/edb_logger.py @@ -22,12 +22,12 @@ # -*- coding: utf-8 -*- import logging +from logging.handlers import RotatingFileHandler import os import shutil import sys import tempfile import time -from logging.handlers import RotatingFileHandler class Msg: diff --git a/src/pyedb/extensions/via_design_backend.py b/src/pyedb/extensions/via_design_backend.py index 096c435ee1..f570e1a0e8 100644 --- a/src/pyedb/extensions/via_design_backend.py +++ b/src/pyedb/extensions/via_design_backend.py @@ -1,8 +1,8 @@ +from copy import deepcopy as copy import json +from pathlib import Path import re import tempfile -from copy import deepcopy as copy -from pathlib import Path from typing import Union import numpy as np diff --git a/src/pyedb/generic/data_handlers.py b/src/pyedb/generic/data_handlers.py index 3300bfc330..68598692ac 100644 --- a/src/pyedb/generic/data_handlers.py +++ b/src/pyedb/generic/data_handlers.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- +from decimal import Decimal import json import math import random import re import string -from decimal import Decimal from pyedb.generic.general_methods import settings diff --git a/src/pyedb/generic/design_types.py b/src/pyedb/generic/design_types.py index ca5b9a38de..3edbde359f 100644 --- a/src/pyedb/generic/design_types.py +++ b/src/pyedb/generic/design_types.py @@ -19,8 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import warnings from typing import TYPE_CHECKING, Literal, Union, overload +import warnings from pyedb.generic.grpc_warnings import GRPC_GENERAL_WARNING from pyedb.generic.settings import settings diff --git a/src/pyedb/generic/general_methods.py b/src/pyedb/generic/general_methods.py index 81c6d298e4..0ac161f67c 100644 --- a/src/pyedb/generic/general_methods.py +++ b/src/pyedb/generic/general_methods.py @@ -25,6 +25,7 @@ import ast import codecs +from collections import OrderedDict import csv import datetime import difflib @@ -41,7 +42,6 @@ import tempfile import time import traceback -from collections import OrderedDict from pyedb.generic.constants import CSS4_COLORS from pyedb.generic.settings import settings diff --git a/src/pyedb/generic/process.py b/src/pyedb/generic/process.py index 45c5b0b055..a95a93f301 100644 --- a/src/pyedb/generic/process.py +++ b/src/pyedb/generic/process.py @@ -1,6 +1,6 @@ import os.path -import subprocess from pathlib import Path +import subprocess from pyedb.generic.general_methods import is_linux diff --git a/src/pyedb/grpc/database/components.py b/src/pyedb/grpc/database/components.py index 883b0d00c1..c12d6ab9f7 100644 --- a/src/pyedb/grpc/database/components.py +++ b/src/pyedb/grpc/database/components.py @@ -27,11 +27,10 @@ import math import os import re -import warnings from typing import Any, Dict, List, Optional, Tuple, Union +import warnings -from ansys.edb.core.definition.die_property import DieOrientation as GrpDieOrientation -from ansys.edb.core.definition.die_property import DieType as GrpcDieType +from ansys.edb.core.definition.die_property import DieOrientation as GrpDieOrientation, DieType as GrpcDieType from ansys.edb.core.definition.solder_ball_property import ( SolderballShape as GrpcSolderballShape, ) @@ -995,8 +994,7 @@ def _get_component_definition(self, name, pins) -> Union[ComponentDef, None]: """ component_definition = ComponentDef.find(self._db, name) if component_definition.is_null: - from ansys.edb.core.layout.cell import Cell as GrpcCell - from ansys.edb.core.layout.cell import CellType as GrpcCellType + from ansys.edb.core.layout.cell import Cell as GrpcCell, CellType as GrpcCellType foot_print_cell = GrpcCell.create(self._pedb.active_db, GrpcCellType.FOOTPRINT_CELL, name) component_definition = ComponentDef.create(self._db, name, fp=foot_print_cell) diff --git a/src/pyedb/grpc/database/definition/materials.py b/src/pyedb/grpc/database/definition/materials.py index 3c2374a73d..135fe4904c 100644 --- a/src/pyedb/grpc/database/definition/materials.py +++ b/src/pyedb/grpc/database/definition/materials.py @@ -26,15 +26,15 @@ import logging import os import re -import warnings from typing import Optional, Union +import warnings from ansys.edb.core.definition.debye_model import DebyeModel as GrpcDebyeModel from ansys.edb.core.definition.djordjecvic_sarkar_model import ( DjordjecvicSarkarModel as GrpcDjordjecvicSarkarModel, ) -from ansys.edb.core.definition.material_def import MaterialDef as GrpcMaterialDef from ansys.edb.core.definition.material_def import ( + MaterialDef as GrpcMaterialDef, MaterialProperty as GrpcMaterialProperty, ) from ansys.edb.core.definition.multipole_debye_model import ( diff --git a/src/pyedb/grpc/database/definition/package_def.py b/src/pyedb/grpc/database/definition/package_def.py index 4516691da2..0b537f2bf6 100644 --- a/src/pyedb/grpc/database/definition/package_def.py +++ b/src/pyedb/grpc/database/definition/package_def.py @@ -221,8 +221,8 @@ def set_heatsink(self, fin_base_height, fin_height, fin_orientation, fin_spacing fin_thickness : str, float Fin thickness. """ - from ansys.edb.core.utility.heat_sink import HeatSink as GrpcHeatSink from ansys.edb.core.utility.heat_sink import ( + HeatSink as GrpcHeatSink, HeatSinkFinOrientation as GrpcHeatSinkFinOrientation, ) diff --git a/src/pyedb/grpc/database/definition/padstack_def.py b/src/pyedb/grpc/database/definition/padstack_def.py index fab5727346..c33bf14d49 100644 --- a/src/pyedb/grpc/database/definition/padstack_def.py +++ b/src/pyedb/grpc/database/definition/padstack_def.py @@ -23,18 +23,15 @@ import math import warnings -import ansys.edb.core.geometry.polygon_data from ansys.edb.core.definition.padstack_def import PadstackDef as GrpcPadstackDef from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, -) -from ansys.edb.core.definition.padstack_def_data import ( PadstackHoleRange as GrpcPadstackHoleRange, + PadType as GrpcPadType, ) -from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType +import ansys.edb.core.geometry.polygon_data from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure -from ansys.edb.core.hierarchy.structure3d import Structure3D as GrpcStructure3D +from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure, Structure3D as GrpcStructure3D from ansys.edb.core.primitive.circle import Circle as GrpcCircle from pyedb.generic.general_methods import generate_unique_name diff --git a/src/pyedb/grpc/database/hfss.py b/src/pyedb/grpc/database/hfss.py index 4cdfafe630..feb75df3a4 100644 --- a/src/pyedb/grpc/database/hfss.py +++ b/src/pyedb/grpc/database/hfss.py @@ -1260,11 +1260,7 @@ def add_setup( ) from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, - ) - from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, - ) - from ansys.edb.core.simulation_setup.simulation_setup import ( SweepData as GrpcSweepData, ) diff --git a/src/pyedb/grpc/database/hierarchy/component.py b/src/pyedb/grpc/database/hierarchy/component.py index 932892af81..7fa1cdb427 100644 --- a/src/pyedb/grpc/database/hierarchy/component.py +++ b/src/pyedb/grpc/database/hierarchy/component.py @@ -22,20 +22,19 @@ import logging import re -import warnings from typing import List, Optional, Union +import warnings from ansys.edb.core.definition.component_model import ( NPortComponentModel as GrpcNPortComponentModel, ) -from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation -from ansys.edb.core.definition.die_property import DieType as GrpcDieType +from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation, DieType as GrpcDieType from ansys.edb.core.definition.solder_ball_property import SolderballShape from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.component_group import ( ComponentGroup as GrpcComponentGroup, + ComponentType as GrpcComponentType, ) -from ansys.edb.core.hierarchy.component_group import ComponentType as GrpcComponentType from ansys.edb.core.hierarchy.netlist_model import NetlistModel as GrpcNetlistModel from ansys.edb.core.hierarchy.pin_pair_model import PinPairModel as GrpcPinPairModel from ansys.edb.core.hierarchy.sparameter_model import ( diff --git a/src/pyedb/grpc/database/layers/layer.py b/src/pyedb/grpc/database/layers/layer.py index ae3839cc2a..7c81f009ff 100644 --- a/src/pyedb/grpc/database/layers/layer.py +++ b/src/pyedb/grpc/database/layers/layer.py @@ -6,8 +6,7 @@ from __future__ import absolute_import -from ansys.edb.core.layer.layer import Layer as GrpcLayer -from ansys.edb.core.layer.layer import LayerType as GrpcLayerType +from ansys.edb.core.layer.layer import Layer as GrpcLayer, LayerType as GrpcLayerType class Layer(GrpcLayer): diff --git a/src/pyedb/grpc/database/layers/stackup_layer.py b/src/pyedb/grpc/database/layers/stackup_layer.py index e38779d6e9..7ff48064a6 100644 --- a/src/pyedb/grpc/database/layers/stackup_layer.py +++ b/src/pyedb/grpc/database/layers/stackup_layer.py @@ -23,8 +23,7 @@ from __future__ import absolute_import from ansys.edb.core.layer.layer import LayerType as GrpcLayerType -from ansys.edb.core.layer.stackup_layer import RoughnessRegion as GrpcRoughnessRegion -from ansys.edb.core.layer.stackup_layer import StackupLayer as GrpcStackupLayer +from ansys.edb.core.layer.stackup_layer import RoughnessRegion as GrpcRoughnessRegion, StackupLayer as GrpcStackupLayer from pyedb.grpc.database.utility.value import Value diff --git a/src/pyedb/grpc/database/layout/layout.py b/src/pyedb/grpc/database/layout/layout.py index b2fd41be03..f6f9b26c47 100644 --- a/src/pyedb/grpc/database/layout/layout.py +++ b/src/pyedb/grpc/database/layout/layout.py @@ -26,6 +26,7 @@ from typing import Dict, Union +from ansys.edb.core.layout.layout import Layout as GrpcLayout import ansys.edb.core.primitive.bondwire import ansys.edb.core.primitive.circle import ansys.edb.core.primitive.padstack_instance @@ -33,7 +34,6 @@ import ansys.edb.core.primitive.polygon import ansys.edb.core.primitive.primitive import ansys.edb.core.primitive.rectangle -from ansys.edb.core.layout.layout import Layout as GrpcLayout from pyedb.grpc.database.hierarchy.component import Component from pyedb.grpc.database.hierarchy.pingroup import PinGroup diff --git a/src/pyedb/grpc/database/modeler.py b/src/pyedb/grpc/database/modeler.py index f38cb0afbb..84f87c7e76 100644 --- a/src/pyedb/grpc/database/modeler.py +++ b/src/pyedb/grpc/database/modeler.py @@ -29,15 +29,14 @@ from ansys.edb.core.geometry.arc_data import ArcData as GrpcArcData from ansys.edb.core.geometry.point_data import PointData as GrpcPointData -from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.geometry.polygon_data import ( + PolygonData as GrpcPolygonData, PolygonSenseType as GrpcPolygonSenseType, ) from ansys.edb.core.hierarchy.pin_group import PinGroup as GrpcPinGroup from ansys.edb.core.inner.exceptions import InvalidArgumentException from ansys.edb.core.primitive.bondwire import BondwireType as GrpcBondwireType -from ansys.edb.core.primitive.path import PathCornerType as GrpcPathCornerType -from ansys.edb.core.primitive.path import PathEndCapType as GrpcPathEndCapType +from ansys.edb.core.primitive.path import PathCornerType as GrpcPathCornerType, PathEndCapType as GrpcPathEndCapType from ansys.edb.core.primitive.rectangle import ( RectangleRepresentationType as GrpcRectangleRepresentationType, ) diff --git a/src/pyedb/grpc/database/nets.py b/src/pyedb/grpc/database/nets.py index 40e1cf7446..2c7161f646 100644 --- a/src/pyedb/grpc/database/nets.py +++ b/src/pyedb/grpc/database/nets.py @@ -22,8 +22,8 @@ from __future__ import absolute_import # noreorder -import warnings from typing import Any, Dict, List, Optional, Set, Tuple, Union +import warnings from ansys.edb.core.net.net_class import NetClass as GrpcNetClass diff --git a/src/pyedb/grpc/database/padstacks.py b/src/pyedb/grpc/database/padstacks.py index c3c61bd7e1..46371837eb 100644 --- a/src/pyedb/grpc/database/padstacks.py +++ b/src/pyedb/grpc/database/padstacks.py @@ -24,31 +24,23 @@ This module contains the `EdbPadstacks` class. """ -import math -import warnings from collections import defaultdict +import math from typing import Any, Dict, List, Optional, Tuple, Union +import warnings -import numpy as np -import rtree from ansys.edb.core.definition.padstack_def_data import ( PadGeometryType as GrpcPadGeometryType, -) -from ansys.edb.core.definition.padstack_def_data import ( PadstackDefData as GrpcPadstackDefData, -) -from ansys.edb.core.definition.padstack_def_data import ( PadstackHoleRange as GrpcPadstackHoleRange, -) -from ansys.edb.core.definition.padstack_def_data import PadType as GrpcPadType -from ansys.edb.core.definition.padstack_def_data import ( + PadType as GrpcPadType, SolderballPlacement as GrpcSolderballPlacement, -) -from ansys.edb.core.definition.padstack_def_data import ( SolderballShape as GrpcSolderballShape, ) from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData +import numpy as np +import rtree from pyedb.generic.general_methods import generate_unique_name from pyedb.grpc.database.definition.padstack_def import PadstackDef diff --git a/src/pyedb/grpc/database/primitive/bondwire.py b/src/pyedb/grpc/database/primitive/bondwire.py index 0b7df258e5..465fd11edf 100644 --- a/src/pyedb/grpc/database/primitive/bondwire.py +++ b/src/pyedb/grpc/database/primitive/bondwire.py @@ -20,11 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from ansys.edb.core.primitive.bondwire import Bondwire as GrpcBondWire from ansys.edb.core.primitive.bondwire import ( + Bondwire as GrpcBondWire, BondwireCrossSectionType as GrpcBondwireCrossSectionType, + BondwireType as GrpcBondWireType, ) -from ansys.edb.core.primitive.bondwire import BondwireType as GrpcBondWireType from pyedb.grpc.database.utility.value import Value diff --git a/src/pyedb/grpc/database/primitive/padstack_instance.py b/src/pyedb/grpc/database/primitive/padstack_instance.py index 973ffd8cc2..cd4f4278f3 100644 --- a/src/pyedb/grpc/database/primitive/padstack_instance.py +++ b/src/pyedb/grpc/database/primitive/padstack_instance.py @@ -28,8 +28,7 @@ from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.pin_group import PinGroup as GrpcPinGroup -from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure -from ansys.edb.core.hierarchy.structure3d import Structure3D as GrpcStructure3D +from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure, Structure3D as GrpcStructure3D from ansys.edb.core.primitive.padstack_instance import ( PadstackInstance as GrpcPadstackInstance, ) diff --git a/src/pyedb/grpc/database/primitive/path.py b/src/pyedb/grpc/database/primitive/path.py index b50b338271..1bf9227281 100644 --- a/src/pyedb/grpc/database/primitive/path.py +++ b/src/pyedb/grpc/database/primitive/path.py @@ -22,8 +22,7 @@ import math from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.primitive.path import Path as GrpcPath -from ansys.edb.core.primitive.path import PathCornerType as GrpcPatCornerType +from ansys.edb.core.primitive.path import Path as GrpcPath, PathCornerType as GrpcPatCornerType from pyedb.grpc.database.primitive.primitive import Primitive from pyedb.grpc.database.utility.value import Value diff --git a/src/pyedb/grpc/database/primitive/rectangle.py b/src/pyedb/grpc/database/primitive/rectangle.py index a17d00c9eb..fe5b7ef40c 100644 --- a/src/pyedb/grpc/database/primitive/rectangle.py +++ b/src/pyedb/grpc/database/primitive/rectangle.py @@ -21,8 +21,8 @@ # SOFTWARE. -from ansys.edb.core.primitive.rectangle import Rectangle as GrpcRectangle from ansys.edb.core.primitive.rectangle import ( + Rectangle as GrpcRectangle, RectangleRepresentationType as GrpcRectangleRepresentationType, ) diff --git a/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py b/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py index 9de0c904e1..6e248a344f 100644 --- a/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py +++ b/src/pyedb/grpc/database/simulation_setup/hfss_general_settings.py @@ -23,8 +23,6 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( AdaptType as GrpcAdaptType, -) -from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( HFSSGeneralSettings as GrpcHFSSGeneralSettings, ) diff --git a/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py b/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py index bb0124d3a2..b041990238 100644 --- a/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py +++ b/src/pyedb/grpc/database/simulation_setup/hfss_settings_options.py @@ -23,11 +23,7 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( BasisFunctionOrder as GrpcBasisFunctionOrder, -) -from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( HFSSSettingsOptions as GrpcHFSSSettingsOptions, -) -from ansys.edb.core.simulation_setup.hfss_simulation_settings import ( SolverType as GrpcSolverType, ) diff --git a/src/pyedb/grpc/database/simulation_setup/sweep_data.py b/src/pyedb/grpc/database/simulation_setup/sweep_data.py index 4a3a587b03..c94a54aeba 100644 --- a/src/pyedb/grpc/database/simulation_setup/sweep_data.py +++ b/src/pyedb/grpc/database/simulation_setup/sweep_data.py @@ -22,11 +22,9 @@ from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, -) -from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, + SweepData as GrpcSweepData, ) -from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData class SweepData(GrpcSweepData): diff --git a/src/pyedb/grpc/database/siwave.py b/src/pyedb/grpc/database/siwave.py index 6cc63303bc..10e0e66c39 100644 --- a/src/pyedb/grpc/database/siwave.py +++ b/src/pyedb/grpc/database/siwave.py @@ -26,17 +26,15 @@ """ import os -import warnings from typing import Any, Dict, Optional, Union +import warnings from ansys.edb.core.database import ProductIdType as GrpcProductIdType from ansys.edb.core.simulation_setup.simulation_setup import ( Distribution as GrpcDistribution, -) -from ansys.edb.core.simulation_setup.simulation_setup import ( FrequencyData as GrpcFrequencyData, + SweepData as GrpcSweepData, ) -from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData from pyedb.grpc.database.simulation_setup.siwave_cpa_simulation_setup import ( SIWaveCPASimulationSetup, diff --git a/src/pyedb/grpc/database/source_excitations.py b/src/pyedb/grpc/database/source_excitations.py index 0d7e7e3306..fe7cf83114 100644 --- a/src/pyedb/grpc/database/source_excitations.py +++ b/src/pyedb/grpc/database/source_excitations.py @@ -25,8 +25,7 @@ from ansys.edb.core.database import ProductIdType as GrpcProductIdType from ansys.edb.core.geometry.point_data import PointData as GrpcPointData from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData -from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTerminal -from ansys.edb.core.terminal.edge_terminal import PrimitiveEdge as GrpcPrimitiveEdge +from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTerminal, PrimitiveEdge as GrpcPrimitiveEdge from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType from ansys.edb.core.utility.rlc import Rlc as GrpcRlc diff --git a/src/pyedb/grpc/database/stackup.py b/src/pyedb/grpc/database/stackup.py index a5d86c5de7..5db83a4bdd 100644 --- a/src/pyedb/grpc/database/stackup.py +++ b/src/pyedb/grpc/database/stackup.py @@ -27,12 +27,12 @@ from __future__ import absolute_import +from collections import OrderedDict import json import logging import math -import warnings -from collections import OrderedDict from typing import Any, Dict, List, Optional, Tuple, Union +import warnings from ansys.edb.core.definition.die_property import DieOrientation as GrpcDieOrientation from ansys.edb.core.definition.solder_ball_property import ( @@ -41,13 +41,12 @@ from ansys.edb.core.geometry.point3d_data import Point3DData as GrpcPoint3DData from ansys.edb.core.hierarchy.cell_instance import CellInstance as GrpcCellInstance from ansys.edb.core.hierarchy.component_group import ComponentType as GrpcComponentType -from ansys.edb.core.layer.layer import LayerType as GrpcLayerType -from ansys.edb.core.layer.layer import TopBottomAssociation as GrpcTopBottomAssociation -from ansys.edb.core.layer.layer_collection import LayerCollection as GrpcLayerCollection +from ansys.edb.core.layer.layer import LayerType as GrpcLayerType, TopBottomAssociation as GrpcTopBottomAssociation from ansys.edb.core.layer.layer_collection import ( + LayerCollection as GrpcLayerCollection, LayerCollectionMode as GrpcLayerCollectionMode, + LayerTypeSet as GrpcLayerTypeSet, ) -from ansys.edb.core.layer.layer_collection import LayerTypeSet as GrpcLayerTypeSet from ansys.edb.core.layer.stackup_layer import StackupLayer as GrpcStackupLayer from ansys.edb.core.layout.mcad_model import McadModel as GrpcMcadModel diff --git a/src/pyedb/grpc/database/terminal/bundle_terminal.py b/src/pyedb/grpc/database/terminal/bundle_terminal.py index 0aefccd89f..40b3772c4f 100644 --- a/src/pyedb/grpc/database/terminal/bundle_terminal.py +++ b/src/pyedb/grpc/database/terminal/bundle_terminal.py @@ -21,8 +21,8 @@ # SOFTWARE. from ansys.edb.core.terminal.bundle_terminal import BundleTerminal as GrpcBundleTerminal -from ansys.edb.core.terminal.terminal import HfssPIType as GrpcHfssPIType from ansys.edb.core.terminal.terminal import ( + HfssPIType as GrpcHfssPIType, SourceTermToGroundType as GrpcSourceTermToGroundType, ) diff --git a/src/pyedb/grpc/database/terminal/terminal.py b/src/pyedb/grpc/database/terminal/terminal.py index 8b49e90247..402350014f 100644 --- a/src/pyedb/grpc/database/terminal/terminal.py +++ b/src/pyedb/grpc/database/terminal/terminal.py @@ -23,9 +23,11 @@ import re from ansys.edb.core.terminal.edge_terminal import EdgeType as GrpcEdgeType -from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType -from ansys.edb.core.terminal.terminal import Terminal as GrpcTerminal -from ansys.edb.core.terminal.terminal import TerminalType as GrpcTerminalType +from ansys.edb.core.terminal.terminal import ( + BoundaryType as GrpcBoundaryType, + Terminal as GrpcTerminal, + TerminalType as GrpcTerminalType, +) from pyedb.grpc.database.primitive.padstack_instance import PadstackInstance from pyedb.grpc.database.primitive.primitive import Primitive diff --git a/src/pyedb/grpc/database/utility/hfss_extent_info.py b/src/pyedb/grpc/database/utility/hfss_extent_info.py index f897eb216b..5c5b52f0cb 100644 --- a/src/pyedb/grpc/database/utility/hfss_extent_info.py +++ b/src/pyedb/grpc/database/utility/hfss_extent_info.py @@ -20,11 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo as GrpcHfssExtentInfo from ansys.edb.core.utility.hfss_extent_info import ( + HfssExtentInfo as GrpcHfssExtentInfo, HFSSExtentInfoType as GrpcHfssExtentInfoType, + OpenRegionType as GrpcOpenRegionType, ) -from ansys.edb.core.utility.hfss_extent_info import OpenRegionType as GrpcOpenRegionType from ansys.edb.core.utility.value import Value as GrpcValue diff --git a/src/pyedb/grpc/edb.py b/src/pyedb/grpc/edb.py index 40106e3f93..560cfb22e7 100644 --- a/src/pyedb/grpc/edb.py +++ b/src/pyedb/grpc/edb.py @@ -56,6 +56,7 @@ >>> edb.export_hfss(r"C:\output_folder") """ +from itertools import combinations import os import re import shutil @@ -64,21 +65,20 @@ import tempfile import time import traceback -import warnings -from itertools import combinations from typing import Dict, List, Union +import warnings from zipfile import ZipFile as zpf -import ansys.edb.core.layout.cell -import rtree from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData from ansys.edb.core.hierarchy.layout_component import ( LayoutComponent as GrpcLayoutComponent, ) +import ansys.edb.core.layout.cell from ansys.edb.core.simulation_setup.siwave_dcir_simulation_setup import ( SIWaveDCIRSimulationSetup as GrpcSIWaveDCIRSimulationSetup, ) from ansys.edb.core.utility.value import Value as GrpcValue +import rtree from pyedb.configuration.configuration import Configuration from pyedb.generic.constants import unit_converter @@ -654,8 +654,7 @@ def create(self, restart_rpc_server=False) -> any: bool True if successful, False otherwise. """ - from ansys.edb.core.layout.cell import Cell as GrpcCell - from ansys.edb.core.layout.cell import CellType as GrpcCellType + from ansys.edb.core.layout.cell import Cell as GrpcCell, CellType as GrpcCellType self.standalone = self.standalone n_try = 10 diff --git a/src/pyedb/grpc/rpc_session.py b/src/pyedb/grpc/rpc_session.py index 98e93cd3d5..984d446de9 100644 --- a/src/pyedb/grpc/rpc_session.py +++ b/src/pyedb/grpc/rpc_session.py @@ -21,17 +21,17 @@ # SOFTWARE. import os +from random import randint import sys import time -from random import randint -import psutil from ansys.edb.core.session import launch_session from ansys.edb.core.utility.io_manager import ( IOMangementType, end_managing, start_managing, ) +import psutil from pyedb import __version__ from pyedb.generic.general_methods import env_path, env_value, is_linux diff --git a/src/pyedb/misc/aedtlib_personalib_install.py b/src/pyedb/misc/aedtlib_personalib_install.py index 1cc3f25e8d..2c21a73984 100644 --- a/src/pyedb/misc/aedtlib_personalib_install.py +++ b/src/pyedb/misc/aedtlib_personalib_install.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import xml.etree.ElementTree as ET from xml.dom.minidom import parseString +import xml.etree.ElementTree as ET def write_pretty_xml(root, file_path): diff --git a/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py b/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py index aebaa7b0ce..c744ab6206 100644 --- a/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py +++ b/src/pyedb/misc/siw_feature_config/emc_rule_checker_settings.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import json from copy import deepcopy as copy +import json import numpy as np diff --git a/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py b/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py index 0c406e31fb..5317063d09 100644 --- a/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py +++ b/src/pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from enum import Enum import os import xml.etree as ET -from enum import Enum from pyedb.generic.general_methods import ET from pyedb.misc.siw_feature_config.xtalk_scan.fd_xtalk_scan_config import ( diff --git a/src/pyedb/modeler/geometry_operators.py b/src/pyedb/modeler/geometry_operators.py index 1eaf5b2d0e..60addce820 100644 --- a/src/pyedb/modeler/geometry_operators.py +++ b/src/pyedb/modeler/geometry_operators.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- +from collections import defaultdict import math import re import sys -from collections import defaultdict import numpy as np diff --git a/src/pyedb/siwave.py b/src/pyedb/siwave.py index ef8d53a708..18da4ccfe3 100644 --- a/src/pyedb/siwave.py +++ b/src/pyedb/siwave.py @@ -9,14 +9,14 @@ from __future__ import absolute_import # noreorder import os +from pathlib import Path import pkgutil import shutil import sys import tempfile import time -import warnings -from pathlib import Path from typing import Optional, Union +import warnings from pyedb import Edb from pyedb.dotnet.clr_module import _clr diff --git a/tests/conftest.py b/tests/conftest.py index d6fa767d7a..70806140fb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,11 +24,11 @@ import json import os +from pathlib import Path import random import shutil import string import tempfile -from pathlib import Path import pytest diff --git a/tests/system/test_edb_configuration_2p0.py b/tests/system/test_edb_configuration_2p0.py index f7c9013a6b..bed9f5d9af 100644 --- a/tests/system/test_edb_configuration_2p0.py +++ b/tests/system/test_edb_configuration_2p0.py @@ -19,8 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import json from collections import Counter +import json from pathlib import Path import pytest diff --git a/tests/test_warnings.py b/tests/test_warnings.py index fffbb3c944..9e1e36630d 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -21,8 +21,8 @@ # SOFTWARE. import sys -import warnings from unittest.mock import patch +import warnings from pyedb import LATEST_DEPRECATED_PYTHON_VERSION, deprecation_warning diff --git a/tests/unit/test_clr_module.py b/tests/unit/test_clr_module.py index 7d6ec147e6..cbb300d69c 100644 --- a/tests/unit/test_clr_module.py +++ b/tests/unit/test_clr_module.py @@ -1,6 +1,6 @@ import os -import sys from pathlib import Path +import sys from unittest.mock import MagicMock, patch import pytest diff --git a/tests/unit/test_edb.py b/tests/unit/test_edb.py index 7b94bba21f..ae945a6272 100644 --- a/tests/unit/test_edb.py +++ b/tests/unit/test_edb.py @@ -23,8 +23,8 @@ import os -import pytest from mock import MagicMock, PropertyMock, patch +import pytest from pyedb import Edb from tests.conftest import desktop_version diff --git a/tests/unit/test_edbsiwave.py b/tests/unit/test_edbsiwave.py index 301d3a08ba..28bd21beed 100644 --- a/tests/unit/test_edbsiwave.py +++ b/tests/unit/test_edbsiwave.py @@ -22,8 +22,8 @@ import os -import pytest from mock import Mock +import pytest from pyedb.dotnet.database.siwave import EdbSiwave diff --git a/tests/unit/test_materials.py b/tests/unit/test_materials.py index ea9aacf2de..dd17079f9b 100644 --- a/tests/unit/test_materials.py +++ b/tests/unit/test_materials.py @@ -23,8 +23,8 @@ import builtins from unittest.mock import mock_open -import pytest from mock import MagicMock, PropertyMock, patch +import pytest from pyedb.dotnet.database.materials import Materials diff --git a/tests/unit/test_padstack.py b/tests/unit/test_padstack.py index 4ae8152040..8aa4ac5cb2 100644 --- a/tests/unit/test_padstack.py +++ b/tests/unit/test_padstack.py @@ -21,8 +21,8 @@ # SOFTWARE. -import pytest from mock import MagicMock, PropertyMock, patch +import pytest from pyedb.dotnet.database.padstack import EdbPadstacks diff --git a/tests/unit/test_stackup.py b/tests/unit/test_stackup.py index d38804f98f..a33b438136 100644 --- a/tests/unit/test_stackup.py +++ b/tests/unit/test_stackup.py @@ -20,8 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import pytest from mock import MagicMock, PropertyMock, patch +import pytest from pyedb.dotnet.database.stackup import Stackup From 2251ccc7e9442ec86b0441e0d22bee08e726df59 Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Wed, 27 Aug 2025 18:45:54 +0200 Subject: [PATCH 7/9] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- .../dotnet/database/edb_data/raptor_x_simulation_setup_data.py | 2 +- src/pyedb/dotnet/database/sim_setup_data/io/siwave.py | 2 +- src/pyedb/dotnet/edb.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py b/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py index eb50089663..f09a82c824 100644 --- a/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py +++ b/src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py @@ -276,7 +276,7 @@ def use_accelerate_via_extraction(self, value): self._advanced_settings.UseAccelerateViaExtraction = value else: self.logger.error( - f"RaptorX setup use_accelerate_via_extraction setter input must be boolean.Provided value {value}" + f"RaptorX setup use_accelerate_via_extraction setter input must be boolean. Provided value {value}" ) @property diff --git a/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py b/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py index 2c8519df3a..3586858b8f 100644 --- a/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py +++ b/src/pyedb/dotnet/database/sim_setup_data/io/siwave.py @@ -349,7 +349,7 @@ def automatic_mesh(self): ``True`` if automatic mesh is used, ``False`` otherwise. """ warnings.warn( - "`automatic_mesh` is deprecated.Use `mesh_automatic` instead.", + "`automatic_mesh` is deprecated. Use `mesh_automatic` instead.", DeprecationWarning, ) return self.sim_setup_info.simulation_settings.AdvancedSettings.MeshAutoMatic diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index 1b6f781361..75ddd36b26 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -4707,7 +4707,7 @@ def create_model_for_arbitrary_wave_ports( if not void_padstacks: raise RuntimeWarning( - "No padstack instances found inside evaluated voids during model creation for arbitrarywaveports" + "No padstack instances found inside evaluated voids during model creation for arbitrary waveports" ) cloned_edb = Edb(edbpath=output_edb) From c881dac82f02c10d0f51dab99fc334eeb1f76074 Mon Sep 17 00:00:00 2001 From: Edouard Coussoux Date: Thu, 28 Aug 2025 15:20:30 +0200 Subject: [PATCH 8/9] chore: Rework improper formatting of some code examples inside docstrings --- src/pyedb/generic/design_types.py | 35 ++-------- src/pyedb/grpc/database/control_file.py | 51 +++----------- src/pyedb/grpc/database/nets.py | 26 ++----- src/pyedb/grpc/database/source_excitations.py | 69 +++++-------------- src/pyedb/grpc/edb.py | 2 +- 5 files changed, 40 insertions(+), 143 deletions(-) diff --git a/src/pyedb/generic/design_types.py b/src/pyedb/generic/design_types.py index 3edbde359f..c698a07bad 100644 --- a/src/pyedb/generic/design_types.py +++ b/src/pyedb/generic/design_types.py @@ -152,17 +152,10 @@ def Edb( 4. Simulation Setup # Create SIwave SYZ setup - >>> syz_setup = edb.create_siwave_syz_setup( - >>> name = ("GHz_Setup",) - >>> start_freq = ("1GHz",) - >>> stop_freq = "10GHz" - >>> ) + >>> syz_setup = edb.create_siwave_syz_setup(name="GHz_Setup", start_freq="1GHz", stop_freq="10GHz") # Create SIwave DC setup - >>> dc_setup = edb.create_siwave_dc_setup( - >>> name = ("DC_Analysis",) - >>> use_dc_point = True - >>> ) + >>> dc_setup = edb.create_siwave_dc_setup(name="DC_Analysis", use_dc_point=True) # Solve with SIwave >>> edb.solve_siwave() @@ -193,17 +186,10 @@ def Edb( 7. Port Creation # Create wave port between two pins - >>> wave_port = edb.source_excitation.create_port( - >>> positive_terminal = (pin1,) - >>> negative_terminal = (pin2,) - >>> port_type = "Wave" - >>> ) + >>> wave_port = edb.source_excitation.create_port(positive_terminal=pin1, negative_terminal=pin2, port_type="Wave") # Create lumped port - >>> lumped_port = edb.source_excitation.create_port( - >>> positive_terminal = (via_terminal,) - >>> port_type = "Lumped" - >>> ) + >>> lumped_port = edb.source_excitation.create_port(positive_terminal=via_terminal, port_type="Lumped") 8. Component Management @@ -216,12 +202,7 @@ def Edb( 9. Parametrization # Auto-parametrize design elements - >>> params = edb.auto_parametrize_design( - >>> traces = (True,) - >>> pads = (True,) - >>> antipads = (True,) - >>> use_relative_variables = True - >>> ) + >>> params = edb.auto_parametrize_design(traces=True, pads=True, antipads=True, use_relative_variables=True) >>> print("Created parameters:", params) 10. Design Statistics @@ -240,11 +221,7 @@ def Edb( 12. Differential Pairs # Create differential pair - >>> edb.differential_pairs.create( - >>> positive_net = ("USB_P",) - >>> negative_net = ("USB_N",) - >>> name = "USB_DP" - >>> ) + >>> edb.differential_pairs.create(positive_net="USB_P", negative_net="USB_N", name="USB_DP") 13. Workflow Automation diff --git a/src/pyedb/grpc/database/control_file.py b/src/pyedb/grpc/database/control_file.py index 1a36dc6973..8e8d683057 100644 --- a/src/pyedb/grpc/database/control_file.py +++ b/src/pyedb/grpc/database/control_file.py @@ -58,40 +58,26 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): ------- # Example 1: Converting a technology file to control file >>> converted_file = convert_technology_file( - >>> tech_file = ("/path/to/tech.t",) - >>> edbversion = ("2025.2",) - >>> control_file = "/path/to/output.xml" - >>> ) + ... tech_file="/path/to/tech.t", edbversion="2025.2", control_file="/path/to/output.xml" + ... ) >>> if converted_file: >>> print(f"Converted to: {converted_file}") # Example 2: Creating a material >>> from pyedb import ControlFileMaterial - >>> material = ControlFileMaterial( - >>> ("Copper",) - >>> {"Permittivity": 1.0, "Conductivity": 5.8e7} - >>> ) + >>> material = ControlFileMaterial("Copper", {"Permittivity": 1.0, "Conductivity": 5.8e7}) # Example 3: Creating a dielectric layer >>> from pyedb import ControlFileDielectric - >>> dielectric = ControlFileDielectric( - >>> ("Core",) - >>> {"Thickness": "0.2mm", "Material": "FR4"} - >>> ) + >>> dielectric = ControlFileDielectric("Core", {"Thickness": "0.2mm", "Material": "FR4"}) # Example 4: Creating a signal layer >>> from pyedb import ControlFileLayer - >>> signal_layer = ControlFileLayer( - >>> ("TopLayer",) - >>> {"Type": "signal", "Material": "Copper", "Thickness": "0.035mm"} - >>> ) + >>> signal_layer = ControlFileLayer("TopLayer", {"Type": "signal", "Material": "Copper", "Thickness": "0.035mm"}) # Example 5: Creating a via layer >>> from pyedb import ControlFileVia - >>> via_layer = ControlFileVia( - >>> ("Via1",) - >>> {"StartLayer": "TopLayer", "StopLayer": "BottomLayer"} - >>> ) + >>> via_layer = ControlFileVia("Via1", {"StartLayer": "TopLayer", "StopLayer": "BottomLayer"}) >>> via_layer.create_via_group = True >>> via_layer.tolerance = "0.1mm" @@ -111,11 +97,7 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): # Example 8: Setting up simulation extents >>> from pyedb import ControlExtent - >>> extent = ControlExtent( - >>> type = ("Conforming",) - >>> diel_hactor = (0.3,) - >>> airbox_hfactor = 0.5 - >>> ) + >>> extent = ControlExtent(type="Conforming", diel_hactor=0.3, airbox_hfactor=0.5) # Example 9: Creating circuit ports >>> from pyedb import ControlCircuitPt @@ -142,26 +124,11 @@ def convert_technology_file(tech_file, edbversion=None, control_file=None): # Example 13: Frequency sweep configuration >>> from pyedb import ControlFileSweep - >>> sweep = ControlFileSweep( - >>> ( - ... "Sweep1", - ... "1GHz", - ... "10GHz", - ... "0.1GHz", - ... ) - >>> "Interpolating", "LinearStep", True - >>> ) + >>> sweep = ControlFileSweep("Sweep1", "1GHz", "10GHz", "0.1GHz", "Interpolating", "LinearStep", True) # Example 14: Mesh operation setup >>> from pyedb import ControlFileMeshOp - >>> mesh_op = ControlFileMeshOp( - >>> ( - ... "FineMesh", - ... "Region1", - ... "MeshOperationSkinDepth", - ... ) - >>> {"Net1": "TopLayer"} - >>> ) + >>> mesh_op = ControlFileMeshOp("FineMesh", "Region1", "MeshOperationSkinDepth", {"Net1": "TopLayer"}) >>> mesh_op.skin_depth = "1um" # Example 15: Simulation setup configuration diff --git a/src/pyedb/grpc/database/nets.py b/src/pyedb/grpc/database/nets.py index 2c7161f646..fa36c43463 100644 --- a/src/pyedb/grpc/database/nets.py +++ b/src/pyedb/grpc/database/nets.py @@ -95,34 +95,21 @@ class Nets(CommonNets): >>> print("Eligible power nets:", [net.name for net in eligible_pwr]) >>> # Generate extended nets (deprecated) - >>> nets.generate_extended_nets( - >>> resistor_below = (5,) - >>>inductor_below=0.5, - >>> capacitor_above = 0.1 - >>> ) + >>> nets.generate_extended_nets(resistor_below=5, inductor_below=0.5, capacitor_above=0.1) >>> # Classify nets - >>> nets.classify_nets( - >>> power_nets = (["VDD_CPU", "VDD_MEM"],) - >>> signal_nets = ["PCIe_TX", "ETH_RX"] - >>> ) + >>> nets.classify_nets(power_nets=["VDD_CPU", "VDD_MEM"], signal_nets=["PCIe_TX", "ETH_RX"]) >>> # Check power/ground status >>> is_power = nets.is_power_gound_net(["VDD_CPU", "PCIe_TX"]) >>> print("Is power net:", is_power) >>> # Get DC-connected nets - >>> dc_connected = nets.get_dcconnected_net_list( - >>> ground_nets = (["GND"],) - >>> res_value = 0.002 - >>> ) + >>> dc_connected = nets.get_dcconnected_net_list(ground_nets=["GND"], res_value=0.002) print("DC-connected nets:", dc_connected) >>> # Get power tree - >>> comp_list, columns, net_group = nets.get_powertree( - >>> power_net_name = ("VDD_CPU",) - >>> ground_nets = ["GND"] - >>> ) + >>> comp_list, columns, net_group = nets.get_powertree(power_net_name="VDD_CPU", ground_nets=["GND"]) >>> print("Power tree components:", comp_list) >>> # Find net by name @@ -142,10 +129,7 @@ class Nets(CommonNets): >>> print("Net in component:", in_component) >>> # Find and fix disjoint nets (deprecated) - >>> fixed_nets = nets.find_and_fix_disjoint_nets( - >>> net_list = (["PCIe_TX"],) - >>> clean_disjoints_less_than = 1e-6 - >>> ) + >>> fixed_nets = nets.find_and_fix_disjoint_nets(net_list=["PCIe_TX"], clean_disjoints_less_than=1e-6) >>> print("Fixed nets:", fixed_nets) >>> # Merge net polygons diff --git a/src/pyedb/grpc/database/source_excitations.py b/src/pyedb/grpc/database/source_excitations.py index fe7cf83114..f69191749b 100644 --- a/src/pyedb/grpc/database/source_excitations.py +++ b/src/pyedb/grpc/database/source_excitations.py @@ -65,14 +65,14 @@ class SourceExcitation: >>> # Create voltage source on component pins >>> from pyedb.grpc.database.utility.sources import Source, SourceType >>> source = Source( - >>> source_type = (SourceType.Vsource,) - >>> name = ("V1",) - >>> positive_node = (("U1", "VCC"),) - >>> negative_node = (("U1", "GND"),) - >>> amplitude = ("1V",) - >>> phase = ("0deg",) - >>> impedance = "50ohm" - >>> ) + ... source_type=SourceType.Vsource, + ... name="V1", + ... positive_node=("U1", "VCC"), + ... negative_node=("U1", "GND"), + ... amplitude="1V", + ... phase="0deg", + ... impedance="50ohm", + ... ) >>> source_excitations.create_source_on_component([source]) >>> # 2. create_port @@ -84,21 +84,14 @@ class SourceExcitation: >>> # 3. create_port_on_pins >>> # Create circuit port between component pins >>> port_term = source_excitations.create_port_on_pins( - >>> refdes = ("U1",) - >>> pins = ("Pin1",) - >>> reference_pins = (["GND_Pin1", "GND_Pin2"],) - >>> impedance = (50,) - >>> port_name = "Port1" - >>> ) + ... refdes="U1", pins="Pin1", reference_pins=["GND_Pin1", "GND_Pin2"], impedance=50, port_name="Port1" + ... ) >>> # 4. create_port_on_component >>> # Create coaxial ports on component nets >>> source_excitations.create_port_on_component( - >>> component="U1", - >>> net_list = (["PCIe_RX0", "PCIe_RX1"],) - >>> port_type = (SourceType.CoaxPort,) - >>> reference_net = "GND" - >>> ) + ... component="U1", net_list=["PCIe_RX0", "PCIe_RX1"], port_type=SourceType.CoaxPort, reference_net="GND" + ... ) >>> # 5. add_port_on_rlc_component >>> # Replace RLC component with circuit port @@ -152,44 +145,26 @@ class SourceExcitation: >>> # 16. create_coax_port_on_component >>> # Create coaxial ports on component >>> ports = source_excitations.create_coax_port_on_component( - >>> (["U1", "U2"],) - >>> (["PCIe_RX0", "PCIe_TX0"],) - >>> delete_existing_terminal = True - >>> ) + ... ["U1", "U2"], ["PCIe_RX0", "PCIe_TX0"], delete_existing_terminal=True + ... ) >>> # 17. create_differential_wave_port >>> # Create differential wave port >>> pos_prim = edb.modeler.primitives[0] >>> neg_prim = edb.modeler.primitives[1] >>> port_name, diff_port = source_excitations.create_differential_wave_port( - >>> ( - ... pos_prim.id, - ... [0, 0], + ... pos_prim.id, [0, 0], neg_prim.id, [0, 0.2], "DiffPort" ... ) - >>> ( - ... neg_prim.id, - ... [0, 0.2], - ... ) - >>> "DiffPort" - >>> ) >>> # 18. create_wave_port >>> # Create wave port - >>> port_name, wave_port = source_excitations.create_wave_port( - >>> ( - ... pos_prim.id, - ... [0, 0], - ... ) - >>> "WavePort" - >>> ) + >>> port_name, wave_port = source_excitations.create_wave_port(pos_prim.id, [0, 0], "WavePort") >>> # 19. create_bundle_wave_port >>> # Create bundle wave port >>> port_name, bundle_port = source_excitations.create_bundle_wave_port( - >>> ([pos_prim.id, neg_prim.id],) - >>> ([[0, 0], [0, 0.2]],) - >>> "BundlePort" - >>> ) + ... [pos_prim.id, neg_prim.id], [[0, 0], [0, 0.2]], "BundlePort" + ... ) >>> # 20. create_dc_terminal >>> # Create DC terminal @@ -202,14 +177,8 @@ class SourceExcitation: >>> # 22. place_voltage_probe >>> # Place voltage probe between points >>> source_excitations.place_voltage_probe( - >>> ("Probe1",) - >>> ( - ... "SignalNet", - ... [0, 0], - ... "TopLayer", + ... "Probe1", "SignalNet", [0, 0], "TopLayer", "GND", [0.1, 0.1], "BottomLayer" ... ) - >>> "GND", [0.1, 0.1], "BottomLayer" - >>> ) >>> # Save and close EDB >>> edb.save() diff --git a/src/pyedb/grpc/edb.py b/src/pyedb/grpc/edb.py index 560cfb22e7..1fbd443c4c 100644 --- a/src/pyedb/grpc/edb.py +++ b/src/pyedb/grpc/edb.py @@ -3765,7 +3765,7 @@ def create_model_for_arbitrary_wave_ports( if not void_padstacks: self.logger.error( - "No padstack instances found inside evaluated voids during model creation for arbitrarywaveports" + "No padstack instances found inside evaluated voids during model creation for arbitrary waveports" ) return False cloned_edb = Edb(edbpath=output_edb, edbversion=self.edbversion, restart_rpc_server=True) From 14152c59d2611ec726ea6a60106e449d33e8d03a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 07:25:10 +0000 Subject: [PATCH 9/9] MISC: Auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci --- src/pyedb/extensions/create_cell_array.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pyedb/extensions/create_cell_array.py b/src/pyedb/extensions/create_cell_array.py index ace19bb248..85f92f7ced 100644 --- a/src/pyedb/extensions/create_cell_array.py +++ b/src/pyedb/extensions/create_cell_array.py @@ -23,6 +23,7 @@ """ This module contains the array building feature from unit cell. """ + import itertools from typing import Optional, Union