ansys-fluent-core 0.30.2__py3-none-any.whl → 0.30.4__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 ansys-fluent-core might be problematic. Click here for more details.

@@ -62,9 +62,9 @@ from ansys.fluent.core.utils import fldoc, get_examples_download_dir
62
62
  from ansys.fluent.core.utils.fluent_version import FluentVersion # noqa: F401
63
63
  from ansys.fluent.core.utils.setup_for_fluent import setup_for_fluent # noqa: F401
64
64
 
65
- __version__ = "0.30.2"
65
+ __version__ = "0.30.4"
66
66
 
67
- _VERSION_INFO = "Build date: March 18, 2025 18:36 UTC ShaID: d676e17"
67
+ _VERSION_INFO = "Build date: April 24, 2025 19:32 UTC ShaID: f49abf3"
68
68
  """
69
69
  Global variable indicating the version info of the PyFluent package.
70
70
  Build timestamp and commit hash are added to this variable during packaging.
@@ -45,12 +45,13 @@ from os.path import dirname
45
45
  from pathlib import Path
46
46
  from typing import Dict, List
47
47
 
48
- from defusedxml.ElementTree import parse
48
+ import defusedxml.ElementTree as ET
49
49
  import numpy as np
50
50
 
51
51
  from ansys.fluent.core.solver.error_message import allowed_name_error_message
52
52
 
53
53
  from . import lispy
54
+ from .pre_processor import remove_unsupported_xml_chars
54
55
 
55
56
  try:
56
57
  import h5py
@@ -731,15 +732,17 @@ def _get_processed_string(input_string: bytes) -> str:
731
732
 
732
733
 
733
734
  def _get_case_file_name_from_flprj(flprj_file):
734
- tree = parse(flprj_file)
735
- root = tree.getroot()
736
- folder_name = root.find("Metadata").find("CurrentSimulation").get("value")[5:-1]
737
- # If the project file name begins with a digit then the node to find will be prepended
738
- # with "_". Rather than making any assumptions that this is a hard rule, or what
739
- # the scope of the rule is, simply retry with the name prepended:
740
- folder_obj = (
741
- root.find(folder_name)
742
- if root.find(folder_name) and len(root.find(folder_name)) > 0
743
- else root.find("_" + folder_name)
744
- )
745
- return folder_obj.find("Input").find("Case").find("Target").get("value")
735
+ with open(flprj_file, "r") as file:
736
+ content = file.read()
737
+ content = remove_unsupported_xml_chars(content)
738
+ root = ET.fromstring(content)
739
+ folder_name = root.find("Metadata").find("CurrentSimulation").get("value")[5:-1]
740
+ # If the project file name begins with a digit then the node to find will be prepended
741
+ # with "_". Rather than making any assumptions that this is a hard rule, or what
742
+ # the scope of the rule is, simply retry with the name prepended:
743
+ folder_obj = (
744
+ root.find(folder_name)
745
+ if root.find(folder_name) and len(root.find(folder_name)) > 0
746
+ else root.find("_" + folder_name)
747
+ )
748
+ return folder_obj.find("Input").find("Case").find("Target").get("value")
@@ -39,10 +39,11 @@ import os
39
39
  from os.path import dirname
40
40
  from pathlib import Path
41
41
 
42
- from defusedxml.ElementTree import parse
42
+ import defusedxml.ElementTree as ET
43
43
  import numpy as np
44
44
 
45
45
  from . import lispy
46
+ from .pre_processor import remove_unsupported_xml_chars
46
47
 
47
48
  try:
48
49
  import h5py
@@ -224,7 +225,15 @@ class DataFile:
224
225
 
225
226
 
226
227
  def _get_data_file_name_from_flprj(flprj_file):
227
- tree = parse(flprj_file)
228
- root = tree.getroot()
229
- folder_name = root.find("Metadata").find("CurrentSimulation").get("value")[5:-1]
230
- return root.find(folder_name).find("Input").find("Case").find("Target").get("value")
228
+ with open(flprj_file, "r") as file:
229
+ content = file.read()
230
+ content = remove_unsupported_xml_chars(content)
231
+ root = ET.fromstring(content)
232
+ folder_name = root.find("Metadata").find("CurrentSimulation").get("value")[5:-1]
233
+ return (
234
+ root.find(folder_name)
235
+ .find("Input")
236
+ .find("Case")
237
+ .find("Target")
238
+ .get("value")
239
+ )
@@ -0,0 +1,35 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ """
24
+ Pre-processor for XML content from Fluent project files.
25
+ """
26
+
27
+ import re
28
+
29
+
30
+ def remove_unsupported_xml_chars(content: str):
31
+ """Remove unsupported XML characters from the content."""
32
+ # Replace double colons in tag names with double underscores
33
+ content = re.sub(r"</?([^> ]+)::", r"<\1__", content)
34
+
35
+ return content