Skip to content

Commit 1ddf2cd

Browse files
DOC: Fix up top level core modules
1 parent a55c8e5 commit 1ddf2cd

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

src/ansys/edb/core/database.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Database."""
22
from __future__ import annotations
33

4-
from typing import TYPE_CHECKING, List, Tuple, Union
4+
from typing import TYPE_CHECKING, List, Tuple
55

66
if TYPE_CHECKING:
77
from ansys.edb.core.inner.messages import EDBObjMessage
@@ -263,15 +263,15 @@ def get_product_property_ids(self, prod_id: ProductIdType) -> List[int]:
263263
return [attr_id for attr_id in attr_ids]
264264

265265
def import_material_from_control_file(
266-
self, control_file: str, schema_dir: Union[str, None] = None, append: bool = True
266+
self, control_file: str, schema_dir: str | None = None, append: bool = True
267267
):
268268
"""Import materials from a control file.
269269
270270
Parameters
271271
----------
272272
control_file : str
273273
Full path to the control file.
274-
schema_dir : Union[str, None], default: None
274+
schema_dir : str or None, default: None
275275
Path to the schema directory.
276276
append : bool, default: True
277277
Whether to keep existing materials in the database. If ``False``, the

src/ansys/edb/core/session.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from struct import pack, unpack
1313
import subprocess
1414
from sys import modules
15-
from typing import List, Union
15+
from typing import List
1616

1717
from ansys.api.edb.v1.arc_data_pb2_grpc import ArcDataServiceStub
1818
from ansys.api.edb.v1.board_bend_def_pb2_grpc import BoardBendDefServiceStub
@@ -233,7 +233,7 @@ def server_url(self) -> str:
233233
return "{}:{}".format(self.ip_address, self.port_num)
234234

235235
@property
236-
def server_executable(self) -> Union[str, None]:
236+
def server_executable(self) -> str | None:
237237
if self.is_launch():
238238
return which(cmd="EDB_RPC_Server", path=self.ansys_em_root)
239239
else:
@@ -479,13 +479,13 @@ class StubType(Enum):
479479

480480

481481
def attach_session(
482-
ip_address: Union[str, None] = None, port_num: int = 50051, dump_traffic_log: bool = False
482+
ip_address: str | None = None, port_num: int = 50051, dump_traffic_log: bool = False
483483
):
484484
"""Attach a session to a port running the EDB API server.
485485
486486
Parameters
487487
----------
488-
ip_address : Union[str, None], default: None
488+
ip_address : str or None, default: None
489489
IP address of the machine that is running the server. The default is ``None``,
490490
in which case localhost is used.
491491
port_num : int, default: 50051
@@ -498,9 +498,7 @@ def attach_session(
498498
return MOD.current_session
499499

500500

501-
def launch_session(
502-
ansys_em_root: str, port_num: Union[int, None] = None, dump_traffic_log: bool = False
503-
):
501+
def launch_session(ansys_em_root: str, port_num: int | None = None, dump_traffic_log: bool = False):
504502
r"""Launch a local session to an EDB API server.
505503
506504
The session must be manually disconnected after use by calling session.disconnect()
@@ -509,7 +507,7 @@ def launch_session(
509507
----------
510508
ansys_em_root : str
511509
Directory where the ``EDB_RPC_Server.exe`` file is installed.
512-
port_num : Union[int, None], default: None
510+
port_num : int or None, default: None
513511
Port number to listen on. The default is ``None``, in which case a port in [50051, 60000]
514512
is selected.
515513
dump_traffic_log : bool, default: False
@@ -537,8 +535,8 @@ def launch_session(
537535
@contextmanager
538536
def session(
539537
ansys_em_root: str,
540-
port_num: Union[int, None] = None,
541-
ip_address: Union[str, None] = None,
538+
port_num: int | None = None,
539+
ip_address: str | None = None,
542540
dump_traffic_log: bool = False,
543541
):
544542
r"""Launch a local session to an EDB API server in a context manager.
@@ -547,10 +545,10 @@ def session(
547545
----------
548546
ansys_em_root : str
549547
Directory where the ``EDB_RPC_Server.exe`` file is installed.
550-
port_num : Union[int, None], default: None
548+
port_num : int or None, default: None
551549
Port number to listen on. The default is ``None``, in which case a port in [50051, 60000]
552550
is selected.
553-
ip_address : Union[str, None], default: None
551+
ip_address : str or None, default: None
554552
IP address where the server executable file is running. The default is ``None``, in which
555553
case localhost is used.
556554
@@ -619,7 +617,7 @@ def get_variable_server_stub() -> VariableServerServiceStub:
619617

620618

621619
def _ensure_session(
622-
ansys_em_root: str, port_num: int, ip_address: Union[str, None], dump_traffic_log: bool
620+
ansys_em_root: str, port_num: int, ip_address: str | None, dump_traffic_log: bool
623621
):
624622
"""Check for a running local session and create one if it doesn't exist.
625623
@@ -629,7 +627,7 @@ def _ensure_session(
629627
Directory where the ``EDB_RPC_Server.exe`` file is installed.
630628
port_num : int
631629
Port number to listen on.
632-
ip_address : Union[str, None]
630+
ip_address : str or None
633631
IP address where the server executable file is running.
634632
dump_traffic_log : bool
635633
Flag indicating if the network traffic log should be dumped when the session is disconnected.

0 commit comments

Comments
 (0)