pyedb 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyedb might be problematic. Click here for more details.

Files changed (128) hide show
  1. pyedb/__init__.py +17 -0
  2. pyedb/dotnet/__init__.py +0 -0
  3. pyedb/dotnet/application/Variables.py +2261 -0
  4. pyedb/dotnet/application/__init__.py +0 -0
  5. pyedb/dotnet/clr_module.py +103 -0
  6. pyedb/dotnet/edb.py +4237 -0
  7. pyedb/dotnet/edb_core/__init__.py +1 -0
  8. pyedb/dotnet/edb_core/cell/__init__.py +0 -0
  9. pyedb/dotnet/edb_core/cell/hierarchy/__init__.py +0 -0
  10. pyedb/dotnet/edb_core/cell/hierarchy/model.py +66 -0
  11. pyedb/dotnet/edb_core/components.py +2669 -0
  12. pyedb/dotnet/edb_core/configuration.py +423 -0
  13. pyedb/dotnet/edb_core/definition/__init__.py +0 -0
  14. pyedb/dotnet/edb_core/definition/component_def.py +166 -0
  15. pyedb/dotnet/edb_core/definition/component_model.py +30 -0
  16. pyedb/dotnet/edb_core/definition/definition_obj.py +18 -0
  17. pyedb/dotnet/edb_core/definition/definitions.py +12 -0
  18. pyedb/dotnet/edb_core/dotnet/__init__.py +0 -0
  19. pyedb/dotnet/edb_core/dotnet/database.py +1218 -0
  20. pyedb/dotnet/edb_core/dotnet/layout.py +238 -0
  21. pyedb/dotnet/edb_core/dotnet/primitive.py +1517 -0
  22. pyedb/dotnet/edb_core/edb_data/__init__.py +0 -0
  23. pyedb/dotnet/edb_core/edb_data/components_data.py +938 -0
  24. pyedb/dotnet/edb_core/edb_data/connectable.py +113 -0
  25. pyedb/dotnet/edb_core/edb_data/control_file.py +1268 -0
  26. pyedb/dotnet/edb_core/edb_data/design_options.py +35 -0
  27. pyedb/dotnet/edb_core/edb_data/edbvalue.py +45 -0
  28. pyedb/dotnet/edb_core/edb_data/hfss_extent_info.py +330 -0
  29. pyedb/dotnet/edb_core/edb_data/hfss_simulation_setup_data.py +1607 -0
  30. pyedb/dotnet/edb_core/edb_data/layer_data.py +576 -0
  31. pyedb/dotnet/edb_core/edb_data/nets_data.py +281 -0
  32. pyedb/dotnet/edb_core/edb_data/obj_base.py +19 -0
  33. pyedb/dotnet/edb_core/edb_data/padstacks_data.py +2080 -0
  34. pyedb/dotnet/edb_core/edb_data/ports.py +287 -0
  35. pyedb/dotnet/edb_core/edb_data/primitives_data.py +1397 -0
  36. pyedb/dotnet/edb_core/edb_data/simulation_configuration.py +2914 -0
  37. pyedb/dotnet/edb_core/edb_data/simulation_setup.py +716 -0
  38. pyedb/dotnet/edb_core/edb_data/siwave_simulation_setup_data.py +1205 -0
  39. pyedb/dotnet/edb_core/edb_data/sources.py +514 -0
  40. pyedb/dotnet/edb_core/edb_data/terminals.py +632 -0
  41. pyedb/dotnet/edb_core/edb_data/utilities.py +148 -0
  42. pyedb/dotnet/edb_core/edb_data/variables.py +91 -0
  43. pyedb/dotnet/edb_core/general.py +181 -0
  44. pyedb/dotnet/edb_core/hfss.py +1646 -0
  45. pyedb/dotnet/edb_core/layout.py +1244 -0
  46. pyedb/dotnet/edb_core/layout_validation.py +272 -0
  47. pyedb/dotnet/edb_core/materials.py +939 -0
  48. pyedb/dotnet/edb_core/net_class.py +335 -0
  49. pyedb/dotnet/edb_core/nets.py +1215 -0
  50. pyedb/dotnet/edb_core/padstack.py +1389 -0
  51. pyedb/dotnet/edb_core/siwave.py +1427 -0
  52. pyedb/dotnet/edb_core/stackup.py +2703 -0
  53. pyedb/edb_logger.py +396 -0
  54. pyedb/generic/__init__.py +0 -0
  55. pyedb/generic/constants.py +1063 -0
  56. pyedb/generic/data_handlers.py +320 -0
  57. pyedb/generic/design_types.py +104 -0
  58. pyedb/generic/filesystem.py +150 -0
  59. pyedb/generic/general_methods.py +1535 -0
  60. pyedb/generic/plot.py +1840 -0
  61. pyedb/generic/process.py +285 -0
  62. pyedb/generic/settings.py +224 -0
  63. pyedb/ipc2581/__init__.py +0 -0
  64. pyedb/ipc2581/bom/__init__.py +0 -0
  65. pyedb/ipc2581/bom/bom.py +21 -0
  66. pyedb/ipc2581/bom/bom_item.py +32 -0
  67. pyedb/ipc2581/bom/characteristics.py +37 -0
  68. pyedb/ipc2581/bom/refdes.py +16 -0
  69. pyedb/ipc2581/content/__init__.py +0 -0
  70. pyedb/ipc2581/content/color.py +38 -0
  71. pyedb/ipc2581/content/content.py +55 -0
  72. pyedb/ipc2581/content/dictionary_color.py +29 -0
  73. pyedb/ipc2581/content/dictionary_fill.py +28 -0
  74. pyedb/ipc2581/content/dictionary_line.py +30 -0
  75. pyedb/ipc2581/content/entry_color.py +13 -0
  76. pyedb/ipc2581/content/entry_line.py +14 -0
  77. pyedb/ipc2581/content/fill.py +15 -0
  78. pyedb/ipc2581/content/layer_ref.py +10 -0
  79. pyedb/ipc2581/content/standard_geometries_dictionary.py +72 -0
  80. pyedb/ipc2581/ecad/__init__.py +0 -0
  81. pyedb/ipc2581/ecad/cad_data/__init__.py +0 -0
  82. pyedb/ipc2581/ecad/cad_data/assembly_drawing.py +26 -0
  83. pyedb/ipc2581/ecad/cad_data/cad_data.py +37 -0
  84. pyedb/ipc2581/ecad/cad_data/component.py +41 -0
  85. pyedb/ipc2581/ecad/cad_data/drill.py +30 -0
  86. pyedb/ipc2581/ecad/cad_data/feature.py +54 -0
  87. pyedb/ipc2581/ecad/cad_data/layer.py +41 -0
  88. pyedb/ipc2581/ecad/cad_data/layer_feature.py +151 -0
  89. pyedb/ipc2581/ecad/cad_data/logical_net.py +32 -0
  90. pyedb/ipc2581/ecad/cad_data/outline.py +25 -0
  91. pyedb/ipc2581/ecad/cad_data/package.py +104 -0
  92. pyedb/ipc2581/ecad/cad_data/padstack_def.py +38 -0
  93. pyedb/ipc2581/ecad/cad_data/padstack_hole_def.py +24 -0
  94. pyedb/ipc2581/ecad/cad_data/padstack_instance.py +62 -0
  95. pyedb/ipc2581/ecad/cad_data/padstack_pad_def.py +26 -0
  96. pyedb/ipc2581/ecad/cad_data/path.py +89 -0
  97. pyedb/ipc2581/ecad/cad_data/phy_net.py +80 -0
  98. pyedb/ipc2581/ecad/cad_data/pin.py +31 -0
  99. pyedb/ipc2581/ecad/cad_data/polygon.py +169 -0
  100. pyedb/ipc2581/ecad/cad_data/profile.py +40 -0
  101. pyedb/ipc2581/ecad/cad_data/stackup.py +31 -0
  102. pyedb/ipc2581/ecad/cad_data/stackup_group.py +42 -0
  103. pyedb/ipc2581/ecad/cad_data/stackup_layer.py +21 -0
  104. pyedb/ipc2581/ecad/cad_data/step.py +275 -0
  105. pyedb/ipc2581/ecad/cad_header.py +33 -0
  106. pyedb/ipc2581/ecad/ecad.py +19 -0
  107. pyedb/ipc2581/ecad/spec.py +46 -0
  108. pyedb/ipc2581/history_record.py +37 -0
  109. pyedb/ipc2581/ipc2581.py +387 -0
  110. pyedb/ipc2581/logistic_header.py +25 -0
  111. pyedb/misc/__init__.py +0 -0
  112. pyedb/misc/aedtlib_personalib_install.py +14 -0
  113. pyedb/misc/downloads.py +322 -0
  114. pyedb/misc/misc.py +67 -0
  115. pyedb/misc/pyedb.runtimeconfig.json +13 -0
  116. pyedb/misc/siw_feature_config/__init__.py +0 -0
  117. pyedb/misc/siw_feature_config/emc/__init__.py +0 -0
  118. pyedb/misc/siw_feature_config/emc/component_tags.py +46 -0
  119. pyedb/misc/siw_feature_config/emc/net_tags.py +37 -0
  120. pyedb/misc/siw_feature_config/emc/tag_library.py +62 -0
  121. pyedb/misc/siw_feature_config/emc/xml_generic.py +78 -0
  122. pyedb/misc/siw_feature_config/emc_rule_checker_settings.py +179 -0
  123. pyedb/misc/utilities.py +27 -0
  124. pyedb/modeler/geometry_operators.py +2082 -0
  125. pyedb-0.2.0.dist-info/LICENSE +21 -0
  126. pyedb-0.2.0.dist-info/METADATA +208 -0
  127. pyedb-0.2.0.dist-info/RECORD +128 -0
  128. pyedb-0.2.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,322 @@
1
+ """Download example datasets from https://github.com/pyansys/example-data"""
2
+ import os
3
+ import shutil
4
+ import tempfile
5
+ import zipfile
6
+
7
+ from pyedb.generic.general_methods import is_ironpython, is_linux, settings
8
+ from pyedb.misc.misc import list_installed_ansysem
9
+
10
+ if is_ironpython:
11
+ import urllib
12
+ else:
13
+ import urllib.request
14
+
15
+ tmpfold = tempfile.gettempdir()
16
+ EXAMPLE_REPO = "https://github.com/ansys/example-data/raw/master/"
17
+ EXAMPLES_PATH = os.path.join(tmpfold, "PyAEDTExamples")
18
+
19
+
20
+ def delete_downloads():
21
+ """Delete all downloaded examples to free space or update the files."""
22
+ shutil.rmtree(EXAMPLES_PATH, ignore_errors=True)
23
+
24
+
25
+ def _get_file_url(directory, filename=None):
26
+ if not filename:
27
+ return EXAMPLE_REPO + "/".join([directory])
28
+ else:
29
+ return EXAMPLE_REPO + "/".join([directory, filename])
30
+
31
+
32
+ def _retrieve_file(url, filename, directory, destination=None, local_paths=[]): # pragma: no cover
33
+ """Download a file from a url"""
34
+ # First check if file has already been downloaded
35
+ if not destination:
36
+ destination = EXAMPLES_PATH
37
+ local_path = os.path.join(destination, directory, os.path.basename(filename))
38
+ local_path_no_zip = local_path.replace(".zip", "")
39
+ if os.path.isfile(local_path_no_zip) or os.path.isdir(local_path_no_zip):
40
+ local_paths.append(local_path_no_zip)
41
+
42
+ # grab the correct url retriever
43
+ if not is_ironpython:
44
+ urlretrieve = urllib.request.urlretrieve
45
+ destination_dir = os.path.join(destination, directory)
46
+ if not os.path.isdir(destination_dir):
47
+ os.makedirs(destination_dir)
48
+ # Perform download
49
+ if is_linux:
50
+ command = "wget {} -O {}".format(url, local_path)
51
+ os.system(command)
52
+ elif is_ironpython:
53
+ versions = list_installed_ansysem()
54
+ if versions:
55
+ cpython = os.listdir(os.path.join(os.getenv(versions[0]), "commonfiles", "CPython"))
56
+ command = (
57
+ '"'
58
+ + os.path.join(
59
+ os.getenv(versions[0]),
60
+ "commonfiles",
61
+ "CPython",
62
+ cpython[0],
63
+ "winx64",
64
+ "Release",
65
+ "python",
66
+ "python.exe",
67
+ )
68
+ + '"'
69
+ )
70
+ commandargs = os.path.join(os.path.dirname(local_path), "download.py")
71
+ command += ' "' + commandargs + '"'
72
+ with open(os.path.join(os.path.dirname(local_path), "download.py"), "w") as f:
73
+ f.write("import urllib.request\n")
74
+ f.write("urlretrieve = urllib.request.urlretrieve\n")
75
+ f.write("import urllib.request\n")
76
+ f.write('url = r"{}"\n'.format(url))
77
+ f.write('local_path = r"{}"\n'.format(local_path))
78
+ f.write("urlretrieve(url, local_path)\n")
79
+ print(command)
80
+ os.system(command)
81
+ else:
82
+ _, resp = urlretrieve(url, local_path)
83
+ local_paths.append(local_path)
84
+
85
+
86
+ def _retrieve_folder(url, directory, destination=None, local_paths=[]): # pragma: no cover
87
+ """Download a folder from a url"""
88
+ # First check if folder exists
89
+ import json
90
+ import re
91
+
92
+ if not destination:
93
+ destination = EXAMPLES_PATH
94
+ if directory.startswith("pyaedt/"):
95
+ local_path = os.path.join(destination, directory[7:])
96
+ else:
97
+ local_path = os.path.join(destination, directory)
98
+
99
+ if is_ironpython:
100
+ return False
101
+ _get_dir = _get_file_url(directory)
102
+ with urllib.request.urlopen(_get_dir) as response: # nosec
103
+ data = response.read().decode("utf-8").split("\n")
104
+
105
+ if not os.path.isdir(local_path):
106
+ try:
107
+ os.mkdir(local_path)
108
+ except FileNotFoundError:
109
+ os.makedirs(local_path)
110
+
111
+ try:
112
+ tree = [i for i in data if '"payload"' in i][0]
113
+ b = re.search(r'>({"payload".+)</script>', tree)
114
+ itemsfromjson = json.loads(b.group(1))
115
+ items = itemsfromjson["payload"]["tree"]["items"]
116
+ for item in items:
117
+ if item["contentType"] == "directory":
118
+ _retrieve_folder(url, item["path"], destination, local_paths)
119
+ else:
120
+ dir_folder = os.path.split(item["path"])
121
+ _download_file(dir_folder[0], dir_folder[1], destination, local_paths)
122
+ except:
123
+ return False
124
+
125
+
126
+ def _download_file(directory, filename=None, destination=None, local_paths=[]): # pragma: no cover
127
+ if not filename:
128
+ if not directory.startswith("pyaedt/"):
129
+ directory = "pyaedt/" + directory
130
+ _retrieve_folder(EXAMPLE_REPO, directory, destination, local_paths)
131
+ else:
132
+ if directory.startswith("pyaedt/"):
133
+ url = _get_file_url(directory, filename)
134
+ directory = directory[7:]
135
+ else:
136
+ url = _get_file_url("pyaedt/" + directory, filename)
137
+ _retrieve_file(url, filename, directory, destination, local_paths)
138
+ if settings.remote_rpc_session:
139
+ remote_path = os.path.join(settings.remote_rpc_session_temp_folder, os.path.split(local_paths[-1])[-1])
140
+ if not settings.remote_rpc_session.filemanager.pathexists(settings.remote_rpc_session_temp_folder):
141
+ settings.remote_rpc_session.filemanager.makedirs(settings.remote_rpc_session_temp_folder)
142
+ settings.remote_rpc_session.filemanager.upload(local_paths[-1], remote_path)
143
+ local_paths[-1] = remote_path
144
+ return local_paths[-1]
145
+
146
+
147
+ ###############################################################################
148
+ # front-facing functions
149
+
150
+
151
+ def download_aedb(destination=None): # pragma: no cover
152
+ """Download an example of AEDB File and return the def path.
153
+
154
+ Examples files are downloaded to a persistent cache to avoid
155
+ re-downloading the same file twice.
156
+
157
+ Parameters
158
+ ----------
159
+ destination : str, optional
160
+ Path for downloading files. The default is the user's temp folder.
161
+
162
+ Returns
163
+ -------
164
+ str
165
+ Path to the example file.
166
+
167
+ Examples
168
+ --------
169
+ Download an example result file and return the path of the file.
170
+ >>> import pyedb.misc.downloads
171
+ >>> path = pyedb.misc.downloads.download_aedb()
172
+ >>> path
173
+ 'C:/Users/user/AppData/local/temp/Galileo.aedb'
174
+ """
175
+ local_paths = []
176
+ _download_file("pyaedt/edb/Galileo.aedb", "GRM32ER72A225KA35_25C_0V.sp", destination, local_paths)
177
+ _download_file("pyaedt/edb/Galileo.aedb", "edb.def", destination, local_paths)
178
+ return local_paths[-1]
179
+
180
+
181
+ def download_edb_merge_utility(force_download=False, destination=None): # pragma: no cover
182
+ """Download an example of WPF Project which allows to merge 2aedb files.
183
+
184
+ Examples files are downloaded to a persistent cache to avoid
185
+ re-downloading the same file twice.
186
+
187
+ Parameters
188
+ ----------
189
+ force_download : bool
190
+ Force to delete cache and download files again.
191
+ destination : str, optional
192
+ Path for downloading files. The default is the user's temp folder.
193
+
194
+ Returns
195
+ -------
196
+ str
197
+ Path to the example file.
198
+
199
+ Examples
200
+ --------
201
+ Download an example result file and return the path of the file.
202
+ >>> import pyedb.misc.downloads
203
+ >>> path = pyedb.misc.downloads.download_edb_merge_utility(force_download=True)
204
+ >>> path
205
+ 'C:/Users/user/AppData/local/temp/wpf_edb_merge/merge_wizard.py'
206
+ """
207
+ if not destination:
208
+ destination = EXAMPLES_PATH
209
+ if force_download:
210
+ local_path = os.path.join(destination, "wpf_edb_merge")
211
+ if os.path.exists(local_path):
212
+ shutil.rmtree(local_path, ignore_errors=True)
213
+ local_paths = []
214
+ _download_file("pyaedt/wpf_edb_merge/board.aedb", "edb.def", destination, local_paths)
215
+ _download_file("pyaedt/wpf_edb_merge/package.aedb", "edb.def", destination, local_paths)
216
+ _download_file("pyaedt/wpf_edb_merge", "merge_wizard_settings.json", destination, local_paths)
217
+
218
+ _download_file("pyaedt/wpf_edb_merge", "merge_wizard.py", destination, local_paths)
219
+ return local_paths[0]
220
+
221
+
222
+ def download_via_wizard(destination=None): # pragma: no cover
223
+ """Download an example of Hfss Via Wizard and return the def path.
224
+
225
+ Examples files are downloaded to a persistent cache to avoid
226
+ re-downloading the same file twice.
227
+
228
+ Parameters
229
+ ----------
230
+ destination : str, optional
231
+ Path for downloading files. The default is the user's temp folder.
232
+
233
+ Returns
234
+ -------
235
+ str
236
+ Path to the example file.
237
+
238
+ Examples
239
+ --------
240
+ Download an example result file and return the path of the file.
241
+
242
+ >>> import pyedb.misc.downloads
243
+ >>> path = pyedb.misc.downloads.download_via_wizard()
244
+ >>> path
245
+ 'C:/Users/user/AppData/local/temp/pyaedtexamples/Graphic_Card.aedt'
246
+ """
247
+
248
+ return _download_file("pyaedt/via_wizard", "viawizard_vacuum_FR4.aedt", destination)
249
+
250
+
251
+ def download_touchstone(destination=None): # pragma: no cover
252
+ """Download an example of touchstone File and return the def path.
253
+
254
+ Examples files are downloaded to a persistent cache to avoid
255
+ re-downloading the same file twice.
256
+
257
+ Parameters
258
+ ----------
259
+ destination : str, optional
260
+ Path for downloading files. The default is the user's temp folder.
261
+
262
+ Returns
263
+ -------
264
+ str
265
+ Path to the example file.
266
+
267
+ Examples
268
+ --------
269
+ Download an example result file and return the path of the file.
270
+ >>> import pyedb.misc.downloads
271
+ >>> path = pyedb.misc.downloads.download_touchstone()
272
+ >>> path
273
+ 'C:/Users/user/AppData/local/temp/pyaedtexamples/ssn_ssn.s6p'
274
+ """
275
+ local_paths = []
276
+ _download_file("pyaedt/touchstone", "SSN_ssn.s6p", destination, local_paths)
277
+ return local_paths[0]
278
+
279
+
280
+ def download_file(directory, filename=None, destination=None): # pragma: no cover
281
+ """
282
+ Download file from directory.
283
+
284
+ Files are downloaded to a destination. If filename is not specified, the full directory will be downloaded.
285
+
286
+ Parameters
287
+ ----------
288
+ directory : str
289
+ Directory name.
290
+ filename : str, optional
291
+ File name to download. The default is all files inside directory.
292
+ destination : str, optional
293
+ Path where files will be downloaded. Default is user temp folder.
294
+
295
+ Returns
296
+ -------
297
+ str
298
+ Path to the example file.
299
+
300
+ Examples
301
+ --------
302
+ Download an example result file and return the path of the file.
303
+
304
+ >>> import pyedb.misc.downloads
305
+ >>> path = pyedb.misc.downloads.download_file("motorcad", "IPM_Vweb_Hairpin.mot")
306
+ >>> path
307
+ 'C:/Users/user/AppData/local/temp/PyAEDTExamples/motorcad'
308
+ """
309
+ local_paths = []
310
+ _download_file(directory, filename, destination, local_paths)
311
+ if filename:
312
+ return list(set(local_paths))[0]
313
+ else:
314
+ if not destination:
315
+ destination = EXAMPLES_PATH
316
+ destination_dir = os.path.join(destination, directory)
317
+ return destination_dir
318
+
319
+
320
+ def unzip(source_filename, dest_dir):
321
+ with zipfile.ZipFile(source_filename) as zf:
322
+ zf.extractall(dest_dir)
pyedb/misc/misc.py ADDED
@@ -0,0 +1,67 @@
1
+ """Miscellaneous Methods for PyEDB."""
2
+ import os
3
+ import warnings
4
+
5
+
6
+ def list_installed_ansysem():
7
+ """Return a list of installed AEDT versions on ``ANSYSEM_ROOT``."""
8
+ aedt_env_var_prefix = "ANSYSEM_ROOT"
9
+ version_list = sorted([x for x in os.environ if x.startswith(aedt_env_var_prefix)], reverse=True)
10
+ aedt_env_var_sv_prefix = "ANSYSEMSV_ROOT"
11
+ version_list += sorted([x for x in os.environ if x.startswith(aedt_env_var_sv_prefix)], reverse=True)
12
+
13
+ if not version_list:
14
+ warnings.warn(
15
+ "No installed versions of AEDT are found in the system environment variables ``ANSYSEM_ROOTxxx``."
16
+ )
17
+
18
+ return version_list
19
+
20
+
21
+ def installed_versions():
22
+ """Get the installed AEDT versions.
23
+
24
+ This method returns a dictionary, with version as the key and installation path
25
+ as the value."""
26
+
27
+ return_dict = {}
28
+ version_list = list_installed_ansysem()
29
+ for version_env_var in version_list:
30
+ if "ANSYSEMSV_ROOT" in version_env_var:
31
+ current_version_id = version_env_var.replace("ANSYSEMSV_ROOT", "")
32
+ student = True
33
+ else:
34
+ current_version_id = version_env_var.replace("ANSYSEM_ROOT", "")
35
+ student = False
36
+ try:
37
+ version = int(current_version_id[0:2])
38
+ release = int(current_version_id[2])
39
+ if version < 20:
40
+ if release < 3:
41
+ version -= 1
42
+ else:
43
+ release -= 2
44
+ if student:
45
+ v_key = "20{0}.{1}SV".format(version, release)
46
+ else:
47
+ v_key = "20{0}.{1}".format(version, release)
48
+ return_dict[v_key] = os.environ[version_env_var]
49
+ except: # pragma: no cover
50
+ pass
51
+ return return_dict
52
+
53
+
54
+ def current_version():
55
+ """Get the current AEDT version."""
56
+ try:
57
+ return list(installed_versions().keys())[0]
58
+ except (NameError, IndexError):
59
+ return ""
60
+
61
+
62
+ def current_student_version():
63
+ """Get the current AEDT student version."""
64
+ for version_key in installed_versions():
65
+ if "SV" in version_key:
66
+ return version_key
67
+ return ""
@@ -0,0 +1,13 @@
1
+ {
2
+ "runtimeOptions": {
3
+ "tfm": "net3.1",
4
+ "framework": {
5
+ "name": "Microsoft.NETCore.App",
6
+ "version": "3.1.23"
7
+ },
8
+ "rollForward": "LatestPatch",
9
+ "configProperties": {
10
+ "System.Reflection.Metadata.MetadataUpdater.IsSupported": false
11
+ }
12
+ }
13
+ }
File without changes
File without changes
@@ -0,0 +1,46 @@
1
+ from pyedb.misc.siw_feature_config.emc.xml_generic import \
2
+ XmlGeneric
3
+
4
+
5
+ class Comp(XmlGeneric):
6
+ """Manages component tags."""
7
+
8
+ def __init__(self, element):
9
+ super().__init__(element)
10
+ if element is not None:
11
+ self.CompName = self._element.attrib["CompName"]
12
+ self.CompValue = self._element.attrib["CompValue"]
13
+ self.DeviceName = self._element.attrib["DeviceName"]
14
+ self.capType = self._element.attrib["capType"] if "capType" in self._element.attrib else None
15
+ self.isClockDriver = self._element.attrib["isClockDriver"]
16
+ self.isHighSpeed = self._element.attrib["isHighSpeed"]
17
+ self.isIC = self._element.attrib["isIC"]
18
+ self.isOscillator = self._element.attrib["isOscillator"]
19
+ self.xLoc = self._element.attrib["xLoc"]
20
+ self.yLoc = self._element.attrib["yLoc"]
21
+ else:
22
+ self.CompName = None
23
+ self.CompValue = None
24
+ self.DeviceName = None
25
+ self.capType = None
26
+ self.isClockDriver = None
27
+ self.isHighSpeed = None
28
+ self.isIC = None
29
+ self.isOscillator = None
30
+ self.xLoc = None
31
+ self.yLoc = None
32
+
33
+
34
+ class ComponentTags(XmlGeneric):
35
+ """Manages component tags."""
36
+ CLS_MAPPING = {
37
+ "Comp": Comp
38
+ }
39
+
40
+ def __init__(self, element):
41
+ super().__init__(element)
42
+
43
+ if element:
44
+ for el in self._element.findall("Comp"):
45
+ comp = Comp(el)
46
+ self.sub_elements.append(comp)
@@ -0,0 +1,37 @@
1
+ from pyedb.misc.siw_feature_config.emc.xml_generic import XmlGeneric
2
+
3
+
4
+ class Net(XmlGeneric):
5
+ """Manages net."""
6
+
7
+ def __init__(self, element=None):
8
+ super().__init__(element)
9
+
10
+ if element is not None:
11
+ self.isBus = self._element.attrib["isBus"]
12
+ self.isClock = self._element.attrib["isClock"]
13
+ self.isCritical = self._element.attrib["isCritical"]
14
+ self.name = self._element.attrib["name"]
15
+ self.type = self._element.attrib["type"] if "type" in self._element.attrib else None
16
+ else:
17
+ self.isBus = None
18
+ self.isClock = None
19
+ self.isCritical = None
20
+ self.name = None
21
+ self.type = None
22
+
23
+
24
+ class NetTags(XmlGeneric):
25
+ """Manages net tag."""
26
+
27
+ CLS_MAPPING = {
28
+ "Net": Net
29
+ }
30
+
31
+ def __init__(self, element):
32
+ super().__init__(element)
33
+
34
+ if element:
35
+ for el in self._element.findall("Net"):
36
+ net = Net(el)
37
+ self.sub_elements.append(net)
@@ -0,0 +1,62 @@
1
+ from pyedb.misc.siw_feature_config.emc.xml_generic import XmlGeneric
2
+
3
+
4
+ class TagType(XmlGeneric):
5
+ """Manages tag type."""
6
+ def __init__(self, element):
7
+ super().__init__(element)
8
+
9
+ if element is not None:
10
+ self.name = self._element.attrib["name"]
11
+ else:
12
+ self.name = None
13
+
14
+
15
+ class TagConfig(XmlGeneric):
16
+ """Manages tag config."""
17
+ def __init__(self, element):
18
+ super().__init__(element)
19
+
20
+
21
+ class Tag(XmlGeneric):
22
+ """Manages tag."""
23
+ CLS_MAPPING = {
24
+ "TagType": TagType,
25
+ "TagConfig": TagConfig
26
+ }
27
+
28
+ def __init__(self, element):
29
+ super().__init__(element)
30
+
31
+ if element is not None:
32
+ self.label = self._element.attrib["label"]
33
+ self.name = self._element.attrib["name"]
34
+ self.sub_elements = []
35
+
36
+ for el in self._element.findall("TagType"):
37
+ temp = TagType(el)
38
+ self.sub_elements.append(temp)
39
+
40
+ for el in self._element.findall("TagConfig"):
41
+ temp = TagConfig(el)
42
+ self.sub_elements.append(temp)
43
+ else:
44
+ self.label = None
45
+ self.name = None
46
+ self.sub_elements = []
47
+
48
+
49
+ class TagLibrary(XmlGeneric):
50
+ """Manages tag library."""
51
+ CLS_MAPPING = {
52
+ "Tag": Tag,
53
+ }
54
+
55
+ def __init__(self, element):
56
+ super().__init__(element)
57
+ self._element = element
58
+
59
+ if element:
60
+ for el in self._element.findall("Tag"):
61
+ tag = Tag(el)
62
+ self.sub_elements.append(tag)
@@ -0,0 +1,78 @@
1
+ import re
2
+ from pyedb.generic.general_methods import ET
3
+
4
+
5
+ class XmlGeneric:
6
+ DEBUG = False
7
+ CLS_MAPPING = {}
8
+
9
+ def __init__(self, element):
10
+ self._element = element
11
+ self._cls_sub_element = None
12
+ self.sub_elements = []
13
+
14
+ def add_sub_element(self, kwargs, elem_type):
15
+ self._cls_sub_element = self.CLS_MAPPING[elem_type]
16
+ obj = self._cls_sub_element(None)
17
+ self.sub_elements.append(obj.create(kwargs))
18
+
19
+ def create(self, kwargs):
20
+ for attrib, value in kwargs.items():
21
+ if attrib in self.__dict__.keys():
22
+ if not isinstance(value, list):
23
+ self.__setattr__(attrib, value)
24
+ else:
25
+ for i in value:
26
+ kwargs = list(i.values())[0]
27
+ item_type = list(i.keys())[0]
28
+ self.add_sub_element(kwargs, item_type)
29
+ return self
30
+
31
+ def write_xml(self, parent):
32
+ elem = ET.SubElement(parent, self.__class__.__name__)
33
+ for attrib, value in self.__dict__.items():
34
+ if attrib.startswith("_"):
35
+ continue
36
+ elif attrib.isupper():
37
+ continue
38
+ elif value is None:
39
+ continue
40
+ elif isinstance(value, list):
41
+ if len(value) == 0:
42
+ continue
43
+ for i in value:
44
+ i.write_xml(elem)
45
+ elif isinstance(value, str):
46
+ elem.set(attrib, value)
47
+ else:
48
+ raise Exception(f"{value} is Illegal")
49
+ return parent
50
+
51
+ def write_dict(self, parent):
52
+ temp = {}
53
+ for attrib, value in self.__dict__.items():
54
+ if attrib.startswith("_"):
55
+ continue
56
+ elif value is None:
57
+ continue
58
+
59
+ if isinstance(value, list):
60
+ if len(value) == 0:
61
+ continue
62
+ new_list = []
63
+ for i in value:
64
+ parent_2 = {}
65
+ i.write_dict(parent_2)
66
+ new_list.append(parent_2)
67
+ temp[attrib] = new_list
68
+ else:
69
+ temp[attrib] = value
70
+
71
+ parent[self.__class__.__name__] = temp
72
+
73
+ def read_dict(self, data):
74
+ for i in data["sub_elements"]:
75
+ elem_type = list(i.keys())[0]
76
+ kwargs = list(i.values())[0]
77
+ obj = self.CLS_MAPPING[elem_type](None)
78
+ self.sub_elements.append(obj.create(kwargs))