Skip to content

Commit 78147eb

Browse files
committed
Suggestions
1 parent 9f8474c commit 78147eb

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

.ci/generate_operators_doc.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
from jinja2 import Template
66
from pathlib import Path
77

8-
def initialize_server(ansys_path=None):
8+
def initialize_server(ansys_path=None, include_composites=False, include_sound=False):
99
server = dpf.start_local_server(ansys_path=ansys_path)
1010
print(f"Ansys Path: {server.ansys_path}")
1111
print(f"Server Info: {server.info}")
1212
print(f"Server Context: {server.context}")
1313
print(f"Server Config: {server.config}")
1414
print(f"Server version: {dpf.global_server().version}")
15-
print("Loading Composites Plugin")
16-
load_library(
17-
Path(server.ansys_path) / "dpf" / "plugins" / "dpf_composites" / "composite_operators.dll"
18-
)
19-
print("Loading Acoustics Plugin")
20-
load_library(Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll")
15+
if include_composites:
16+
print("Loading Composites Plugin")
17+
load_library(
18+
Path(server.ansys_path) / "dpf" / "plugins" / "dpf_composites" / "composite_operators.dll"
19+
)
20+
if include_sound:
21+
print("Loading Acoustics Plugin")
22+
load_library(Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll")
2123
return server
2224

2325

@@ -59,30 +61,23 @@ def fetch_doc_info(server, operator_name):
5961
}
6062
)
6163
properties = spec.properties
62-
if "plugin" in properties:
63-
plugin = properties["plugin"]
64+
plugin = properties.pop("plugin", "N/A")
65+
66+
category = properties.pop("category", None)
67+
68+
scripting_name = properties.pop("scripting_name", None)
69+
if category and scripting_name:
70+
full_name = category + "." + scripting_name
6471
else:
65-
plugin = "N/A"
66-
try:
67-
scripting_name = properties["scripting_name"]
68-
full_name = properties["category"] + "." + properties["scripting_name"]
69-
except KeyError:
70-
scripting_name = None
7172
full_name = None
72-
try:
73-
user_name = properties["user_name"]
74-
except KeyError:
75-
user_name = operator_name
76-
try:
77-
category = properties["category"]
78-
op_friendly_name = category + ": " + user_name
79-
except KeyError:
80-
category = ""
81-
op_friendly_name = user_name
82-
try:
83-
license = properties["license"]
84-
except KeyError:
85-
license = "None"
73+
74+
user_name = properties.pop("user_name", operator_name)
75+
76+
op_friendly_name = user_name
77+
if category:
78+
op_friendly_name = category + ":" + op_friendly_name
79+
80+
license = properties.pop("license", "None")
8681
scripting_info = {
8782
"category": category,
8883
"plugin": plugin,
@@ -136,6 +131,8 @@ def main():
136131
"--ansys_path", default=None, help="Path to Ansys DPF Server installation directory"
137132
)
138133
parser.add_argument("--include_private", action="store_true", help="Include private operators")
134+
parser.add_argument("--include_composites", action="store_true", help="Include composites operators")
135+
parser.add_argument("--include_sound", action="store_true", help="Include sound operators")
139136
args = parser.parse_args()
140137
desired_plugin = args.plugin
141138

0 commit comments

Comments
 (0)