Skip to content

Commit c526d6e

Browse files
authored
Deprecate renamed gasket_deformation operators (#2510)
1 parent 7db63f1 commit c526d6e

File tree

7 files changed

+2242
-13
lines changed

7 files changed

+2242
-13
lines changed

.ci/code_generation.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,36 @@
1111
core.set_default_server_context(core.AvailableServerContexts.premium)
1212
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
1313

14+
files_to_keep = {
15+
"operator.mustache": "",
16+
"build.py": "",
17+
"specification.py": "",
18+
"translator.py": "",
19+
# Deprecated operator scripting names
20+
"result": [
21+
"gasket_deformation.py",
22+
"gasket_deformation_X.py",
23+
"gasket_deformation_XY.py",
24+
"gasket_deformation_XZ.py",
25+
],
26+
}
27+
1428
local_dir = Path(__file__).parent
1529
TARGET_PATH = local_dir.parent / "src" / "ansys" / "dpf" / "core" / "operators"
1630
files = TARGET_PATH.glob("*")
1731
for file_path in files:
18-
if file_path.stem == "specification":
19-
continue
20-
if file_path.stem == "translator":
21-
continue
22-
if file_path.name == "build.py":
32+
if file_path.is_file() and (file_path.name in files_to_keep):
2333
continue
24-
if file_path.name == "operator.mustache":
25-
continue
26-
try:
27-
if file_path.is_dir():
28-
shutil.rmtree(file_path)
34+
if file_path.is_dir():
35+
shutil.rmtree(file_path / "__pycache__", ignore_errors=True)
36+
if file_path.name in files_to_keep:
37+
sub_files = file_path.glob("*")
38+
for sub_file in sub_files:
39+
if sub_file.name not in files_to_keep[file_path.name]:
40+
sub_file.unlink()
2941
else:
30-
file_path.unlink()
31-
except:
32-
pass
42+
shutil.rmtree(file_path)
43+
else:
44+
file_path.unlink()
3345

3446
build.build_operators()

src/ansys/dpf/core/operators/result/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@
126126
from .euler_load_buckling import euler_load_buckling
127127
from .euler_nodes import euler_nodes
128128
from .fluid_velocity import fluid_velocity
129+
from .gasket_deformation import gasket_deformation
130+
from .gasket_deformation_X import gasket_deformation_X
131+
from .gasket_deformation_XY import gasket_deformation_XY
132+
from .gasket_deformation_XZ import gasket_deformation_XZ
129133
from .gasket_inelastic_closure import gasket_inelastic_closure
130134
from .gasket_inelastic_closure_X import gasket_inelastic_closure_X
131135
from .gasket_inelastic_closure_XY import gasket_inelastic_closure_XY

src/ansys/dpf/core/operators/result/gasket_deformation.py

Lines changed: 645 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)