Skip to content

Commit 7a51ec8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 55b2faf commit 7a51ec8

File tree

7 files changed

+17
-36
lines changed

7 files changed

+17
-36
lines changed

src/ansys/tools/common/launcher/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
"""Local product launcher."""
2424

25-
from . import config, helpers, interface, product_instance, grpc_transport
25+
from . import config, grpc_transport, helpers, interface, product_instance
2626
from .launch import launch_product
2727

2828
__all__ = [

src/ansys/tools/common/launcher/_cli.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
22
# SPDX-License-Identifier: MIT
33
#
44
#
@@ -44,7 +44,7 @@ def format_prompt(*, field_name: str, description: str | None) -> str:
4444
"""Get the formatted prompt string from its field name and description."""
4545
prompt = f"\n{field_name}:"
4646
if description is not None:
47-
prompt += f"\n" + textwrap.indent(description, " " * 4)
47+
prompt += "\n" + textwrap.indent(description, " " * 4)
4848
prompt += "\n"
4949
return prompt
5050

@@ -64,9 +64,7 @@ def get_subcommands_from_plugins(
6464
for launch_mode, launcher_kls in launch_mode_configs.items():
6565
launcher_config_kls = launcher_kls.CONFIG_MODEL
6666

67-
_config_writer_callback = config_writer_callback_factory(
68-
launcher_config_kls, product_name, launch_mode
69-
)
67+
_config_writer_callback = config_writer_callback_factory(launcher_config_kls, product_name, launch_mode)
7068
launch_mode_command = click.Command(launch_mode, callback=_config_writer_callback)
7169
for field in dataclasses.fields(launcher_config_kls):
7270
option = get_option_from_field(field)
@@ -253,9 +251,7 @@ def show_config() -> None:
253251

254252
if not is_configured(product_name=product_name, launch_mode=launch_mode):
255253
try:
256-
config = get_config_for(
257-
product_name=product_name, launch_mode=launch_mode
258-
)
254+
config = get_config_for(product_name=product_name, launch_mode=launch_mode)
259255
click.echo(" No configuration is set (uses defaults).")
260256
except (KeyError, RuntimeError):
261257
click.echo(" No configuration is set (no defaults available).")

src/ansys/tools/common/launcher/grpc_transport.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
22
# SPDX-License-Identifier: MIT
33
#
44
#
@@ -57,7 +57,6 @@ class StrEnum(str, enum.Enum):
5757
try:
5858
from enum import StrEnum
5959
except ImportError:
60-
6160
import enum
6261

6362
class StrEnum(str, enum.Enum):
@@ -152,9 +151,7 @@ class MTLSOptions(TransportOptionsBase):
152151
def _to_cyberchannel_kwargs(self) -> dict[str, Any]:
153152
if not self.allow_remote_host:
154153
if self.host not in ("localhost", "127.0.0.1"):
155-
raise ValueError(
156-
f"Remote host '{self.host}' specified without setting 'allow_remote_host=True'."
157-
)
154+
raise ValueError(f"Remote host '{self.host}' specified without setting 'allow_remote_host=True'.")
158155
res = asdict(self)
159156
res.pop("allow_remote_host", None)
160157
return res | {"transport_mode": self.mode.value}
@@ -173,9 +170,7 @@ class InsecureOptions(TransportOptionsBase):
173170
def _to_cyberchannel_kwargs(self) -> dict[str, Any]:
174171
if not self.allow_remote_host:
175172
if self.host not in ("localhost", "127.0.0.1"):
176-
raise ValueError(
177-
f"Remote host '{self.host}' specified without setting 'allow_remote_host=True'."
178-
)
173+
raise ValueError(f"Remote host '{self.host}' specified without setting 'allow_remote_host=True'.")
179174
res = asdict(self)
180175
res.pop("allow_remote_host", None)
181176
return res | {"transport_mode": self.mode.value}

src/ansys/tools/common/launcher/product_instance.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
22
# SPDX-License-Identifier: MIT
33
#
44
#
@@ -93,8 +93,7 @@ def start(self: Self) -> None:
9393
elif server_type == ServerType.GENERIC:
9494
if key not in urls:
9595
raise RuntimeError(
96-
f"The URL for the generic server with key '{key}' was not provided "
97-
"by the launcher."
96+
f"The URL for the generic server with key '{key}' was not provided by the launcher."
9897
)
9998
else:
10099
raise RuntimeError(f"Unsupported server type: {server_type}")

tests/launcher/integration/simple_test_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
22
# SPDX-License-Identifier: MIT
33
#
44
#

tests/launcher/integration/simple_test_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
22
# SPDX-License-Identifier: MIT
33
#
44
#

tests/launcher/integration/test_simple_launcher.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
22
# SPDX-License-Identifier: MIT
33
#
44
#
@@ -44,17 +44,12 @@ def monkeypatch_entrypoints(monkeypatch_entrypoints_from_plugins):
4444

4545

4646
def check_uds_file_removed(server):
47-
uds_file = (
48-
pathlib.Path(server._launcher.transport_options["main"].uds_dir)
49-
/ "simple_test_service.sock"
50-
)
47+
uds_file = pathlib.Path(server._launcher.transport_options["main"].uds_dir) / "simple_test_service.sock"
5148
assert not pathlib.Path(uds_file).exists()
5249

5350

5451
def test_default_config():
55-
config.set_config_for(
56-
product_name=PRODUCT_NAME, launch_mode=LAUNCH_MODE, config=SimpleLauncherConfig()
57-
)
52+
config.set_config_for(product_name=PRODUCT_NAME, launch_mode=LAUNCH_MODE, config=SimpleLauncherConfig())
5853
server = launch_product(PRODUCT_NAME)
5954
server.wait(timeout=10)
6055
server.stop()
@@ -80,9 +75,7 @@ def test_stop_with_timeout():
8075

8176
def test_invalid_launch_mode_raises():
8277
with pytest.raises(KeyError):
83-
launch_product(
84-
PRODUCT_NAME, launch_mode="invalid_launch_mode", config=SimpleLauncherConfig()
85-
)
78+
launch_product(PRODUCT_NAME, launch_mode="invalid_launch_mode", config=SimpleLauncherConfig())
8679

8780

8881
def test_invalid_config_raises():
@@ -91,9 +84,7 @@ def test_invalid_config_raises():
9184

9285

9386
def test_contextmanager():
94-
with launch_product(
95-
PRODUCT_NAME, launch_mode=LAUNCH_MODE, config=SimpleLauncherConfig()
96-
) as server:
87+
with launch_product(PRODUCT_NAME, launch_mode=LAUNCH_MODE, config=SimpleLauncherConfig()) as server:
9788
server.wait(timeout=10)
9889
assert server.check()
9990
assert not server.check()

0 commit comments

Comments
 (0)