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 53fc10bec4..bfe9c75356 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,33 +10,17 @@ 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.12.10 hooks: - - id: black - args: - - --line-length=120 + - id: ruff-check + - id: ruff-format - 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] - -- 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/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 0efb88b354..542f78ef43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,14 +88,133 @@ 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 +fix = true + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +docstring-code-format = true + +[tool.ruff.lint] +select = [ + "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 + "E712", # true-false-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 + "N816", # mixed-case-variable-in-global-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 +] + +[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/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index 81d93af5f8..e383795df4 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -51,8 +51,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 510d051047..22b5e36a25 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 @@ -493,13 +495,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) @@ -1009,8 +1011,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. @@ -1708,7 +1715,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) @@ -1760,9 +1767,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) 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/cell/primitive/primitive.py b/src/pyedb/dotnet/database/cell/primitive/primitive.py index 61c15d9a70..dddcb072c5 100644 --- a/src/pyedb/dotnet/database/cell/primitive/primitive.py +++ b/src/pyedb/dotnet/database/cell/primitive/primitive.py @@ -39,8 +39,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 bf81cfe0aa..3193c6c86c 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] @@ -1270,7 +1270,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) @@ -1750,9 +1750,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: @@ -2152,9 +2152,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 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/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 8b86880960..b77ddc9c9c 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..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 @@ -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 85290c3d69..299ad19d68 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 64fa6d2d37..7381405e2a 100644 --- a/src/pyedb/dotnet/database/layout_validation.py +++ b/src/pyedb/dotnet/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"]) """ if not net_list: diff --git a/src/pyedb/dotnet/database/materials.py b/src/pyedb/dotnet/database/materials.py index 0e4e078943..1af27a54c3 100644 --- a/src/pyedb/dotnet/database/materials.py +++ b/src/pyedb/dotnet/database/materials.py @@ -243,9 +243,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 c654df3d0a..2f6d228731 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 @@ -383,7 +384,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 335178c071..63247639c5 100644 --- a/src/pyedb/dotnet/database/nets.py +++ b/src/pyedb/dotnet/database/nets.py @@ -575,7 +575,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) @@ -596,7 +596,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] @@ -733,7 +733,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 b7796784cb..6c60b26e91 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. """ + from collections import defaultdict import math from typing import Dict, List @@ -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..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/database/siwave.py b/src/pyedb/dotnet/database/siwave.py index bb5e22015e..6a721d7ea6 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 @@ -483,8 +484,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.net_name @@ -625,7 +626,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 1967ca10fa..7e9ee74cf2 100644 --- a/src/pyedb/dotnet/database/stackup.py +++ b/src/pyedb/dotnet/database/stackup.py @@ -1137,7 +1137,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() @@ -1356,22 +1356,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() @@ -1453,13 +1459,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 @@ -1592,13 +1603,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 @@ -1736,11 +1752,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) @@ -1795,7 +1816,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 b8a19d5409..c7e4a51b03 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 994effc10d..a67e7dfd31 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("`add_frequency_sweep` 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 7e34d5da12..f5e1b9fd0a 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 datetime import datetime from itertools import combinations import os @@ -43,7 +44,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 +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 arbitrary waveports" ) cloned_edb = Edb(edbpath=output_edb) 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/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 diff --git a/src/pyedb/generic/data_handlers.py b/src/pyedb/generic/data_handlers.py index 637a120f18..69ba98f8ec 100644 --- a/src/pyedb/generic/data_handlers.py +++ b/src/pyedb/generic/data_handlers.py @@ -142,28 +142,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 2486792cd0..2ec5b45e7c 100644 --- a/src/pyedb/generic/design_types.py +++ b/src/pyedb/generic/design_types.py @@ -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 @@ -167,17 +164,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() @@ -208,17 +198,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 @@ -231,12 +214,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 @@ -255,11 +233,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/components.py b/src/pyedb/grpc/database/components.py index d028d792f2..211ce8b109 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 @@ -31,8 +30,7 @@ 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, ) @@ -996,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) @@ -2228,7 +2225,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..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,17 +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/definition/materials.py b/src/pyedb/grpc/database/definition/materials.py index 71b22f8205..135fe4904c 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 822b928a15..0b537f2bf6 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 1b9155b27b..c33bf14d49 100644 --- a/src/pyedb/grpc/database/definition/padstack_def.py +++ b/src/pyedb/grpc/database/definition/padstack_def.py @@ -26,15 +26,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 pyedb.generic.general_methods import generate_unique_name @@ -127,7 +124,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 @@ -771,7 +768,7 @@ def convert_to_3d_microvias( 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 135723d86c..feb75df3a4 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 @@ -1259,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 a211ca5631..7fa1cdb427 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 ( @@ -1102,7 +1101,7 @@ def assign_s_param_model(self, file_path, name=None, reference_net=None) -> Grpc 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/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 711c09016b..e16a9fcbb1 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 Dict, List, Union from ansys.edb.core.layout.layout import Layout as GrpcLayout diff --git a/src/pyedb/grpc/database/modeler.py b/src/pyedb/grpc/database/modeler.py index b4bbd6f843..d151991b51 100644 --- a/src/pyedb/grpc/database/modeler.py +++ b/src/pyedb/grpc/database/modeler.py @@ -23,20 +23,20 @@ """ 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, 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, ) @@ -1268,7 +1268,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..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 @@ -422,11 +406,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 +467,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 +528,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 +585,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 +671,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 +829,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 40559c2f7e..b1dc1494b7 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. """ + from collections import defaultdict import math from typing import Any, Dict, List, Optional, Tuple, Union @@ -30,20 +31,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 import numpy as np @@ -334,7 +327,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 +373,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 +1289,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..465fd11edf 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 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..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, ) @@ -144,7 +143,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 +178,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/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/primitive.py b/src/pyedb/grpc/database/primitive/primitive.py index 3b7e8413aa..4204d7a58a 100644 --- a/src/pyedb/grpc/database/primitive/primitive.py +++ b/src/pyedb/grpc/database/primitive/primitive.py @@ -39,8 +39,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/primitive/rectangle.py b/src/pyedb/grpc/database/primitive/rectangle.py index 920eaa6cd2..fe5b7ef40c 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 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 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 e27cea9615..10e0e66c39 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 from typing import Any, Dict, Optional, Union import warnings @@ -31,11 +32,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.grpc.database.simulation_setup.siwave_cpa_simulation_setup import ( SIWaveCPASimulationSetup, @@ -335,7 +334,7 @@ def _check_gnd(self, component_name): Use :func:`pyedb.grpc.core.excitations._check_gnd` instead. """ 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) @@ -563,9 +562,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) @@ -644,17 +641,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 df92f1fa88..0e71da756b 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 @@ -66,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 @@ -85,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 @@ -153,35 +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], - >>> neg_prim.id, [0, 0.2], - >>> "DiffPort" - >>> ) + ... 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], - >>> "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 @@ -194,10 +177,8 @@ class SourceExcitation: >>> # 22. place_voltage_probe >>> # Place voltage probe between points >>> source_excitations.place_voltage_probe( - >>> "Probe1", - >>> "SignalNet", [0, 0], "TopLayer", - >>> "GND", [0.1, 0.1], "BottomLayer" - >>> ) + ... "Probe1", "SignalNet", [0, 0], "TopLayer", "GND", [0.1, 0.1], "BottomLayer" + ... ) >>> # Save and close EDB >>> edb.save() @@ -1656,8 +1637,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 +1700,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 +1844,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 +1918,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 +1986,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 +2058,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 +2329,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 +2432,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 +2550,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)) @@ -3081,8 +3060,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..5db83a4bdd 100644 --- a/src/pyedb/grpc/database/stackup.py +++ b/src/pyedb/grpc/database/stackup.py @@ -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 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 @@ -128,8 +127,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 +167,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 +1331,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 +1425,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 +1690,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..40b3772c4f 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 pyedb.grpc.database.hierarchy.component import Component from pyedb.grpc.database.layers.layer import Layer 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/heat_sink.py b/src/pyedb/grpc/database/utility/heat_sink.py index 8b161927a1..825295c432 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/hfss_extent_info.py b/src/pyedb/grpc/database/utility/hfss_extent_info.py index 546f17d974..5c5b52f0cb 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 5367145d76..38416a6ef8 100644 --- a/src/pyedb/grpc/edb.py +++ b/src/pyedb/grpc/edb.py @@ -658,8 +658,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 @@ -1191,7 +1190,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 @@ -1399,7 +1398,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}"', ] @@ -1734,7 +1733,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: @@ -3009,7 +3008,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( @@ -3757,8 +3756,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 = [] @@ -3771,7 +3769,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 arbitrary waveports" ) 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 6baf3ff89f..783a346c20 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/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/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 4025fe8f64..133518a364 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 40dbd9d5c3..ad3bd364fe 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 """ @@ -1588,6 +1588,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/conftest.py b/tests/conftest.py index b46e584edc..32bcd07ac4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,8 +20,8 @@ # 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 diff --git a/tests/system/test_edb_components.py b/tests/system/test_edb_components.py index bb4fa0ddc6..cd5dc118b9 100644 --- a/tests/system/test_edb_components.py +++ b/tests/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/system/test_edb_definition.py b/tests/system/test_edb_definition.py index d7dc354363..8065f0d396 100644 --- a/tests/system/test_edb_definition.py +++ b/tests/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/system/test_edb_differential_pairs.py b/tests/system/test_edb_differential_pairs.py index a3c4b55225..92f3cd0188 100644 --- a/tests/system/test_edb_differential_pairs.py +++ b/tests/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/system/test_edb_extended_nets.py b/tests/system/test_edb_extended_nets.py index dd2520d5aa..cc81625bf1 100644 --- a/tests/system/test_edb_extended_nets.py +++ b/tests/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/system/test_edb_future_features_242.py b/tests/system/test_edb_future_features_242.py index 70fc9cd878..86897ab2d3 100644 --- a/tests/system/test_edb_future_features_242.py +++ b/tests/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/system/test_edb_ipc.py b/tests/system/test_edb_ipc.py index 9f878f6f3f..45e258d8eb 100644 --- a/tests/system/test_edb_ipc.py +++ b/tests/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/system/test_edb_materials.py b/tests/system/test_edb_materials.py index f6be251301..5c3cdc0c57 100644 --- a/tests/system/test_edb_materials.py +++ b/tests/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/system/test_edb_modeler.py b/tests/system/test_edb_modeler.py index cec3c39558..4553b7629a 100644 --- a/tests/system/test_edb_modeler.py +++ b/tests/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/system/test_edb_net_classes.py b/tests/system/test_edb_net_classes.py index b1f5fa7e09..1061340604 100644 --- a/tests/system/test_edb_net_classes.py +++ b/tests/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/system/test_edb_nets.py b/tests/system/test_edb_nets.py index c72b28e521..1fa1d23dd4 100644 --- a/tests/system/test_edb_nets.py +++ b/tests/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/system/test_edb_padstacks.py b/tests/system/test_edb_padstacks.py index a01fd4f465..cf272ff3e5 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 @@ -607,6 +608,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/system/test_emi_scanner.py b/tests/system/test_emi_scanner.py index 8ecd1b0953..83aa21a090 100644 --- a/tests/system/test_emi_scanner.py +++ b/tests/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/system/test_siwave_features.py b/tests/system/test_siwave_features.py index 2453feaab1..c1186cdc74 100644 --- a/tests/system/test_siwave_features.py +++ b/tests/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/unit/conftest.py b/tests/unit/conftest.py index ac7a90eac0..ab3eb4327b 100644 --- a/tests/unit/conftest.py +++ b/tests/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