Skip to content

Commit e0c0848

Browse files
feat: grpc reachitecture - several modules (#1988)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 5200e80 commit e0c0848

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2088
-462
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
1010
rev: v0.11.10
1111
hooks:
12-
- id: ruff
12+
- id: ruff-check
1313
- id: ruff-format
1414

1515
- repo: https://github.com/codespell-project/codespell

doc/changelog.d/1988.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
grpc reachitecture - several modules

src/ansys/geometry/core/_grpc/_services/_service.py

Lines changed: 210 additions & 70 deletions
Large diffs are not rendered by default.

src/ansys/geometry/core/_grpc/_services/base/admin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import grpc
2727

2828

29-
class GRPCAdminService(ABC):
29+
class GRPCAdminService(ABC): # pragma: no cover
3030
"""Admin service for gRPC communication with the Geometry server.
3131
3232
Parameters
@@ -37,19 +37,19 @@ class GRPCAdminService(ABC):
3737

3838
def __init__(self, channel: grpc.Channel):
3939
"""Initialize the GRPCAdminService class."""
40-
pass # pragma: no cover
40+
pass
4141

4242
@abstractmethod
4343
def get_backend(self, **kwargs) -> dict:
4444
"""Get server information."""
45-
pass # pragma: no cover
45+
pass
4646

4747
@abstractmethod
4848
def get_logs(self, **kwargs) -> dict:
4949
"""Get server logs."""
50-
pass # pragma: no cover
50+
pass
5151

5252
@abstractmethod
5353
def get_service_status(self, **kwargs) -> dict:
5454
"""Get server status (i.e. healthy or not)."""
55-
pass # pragma: no cover
55+
pass

src/ansys/geometry/core/_grpc/_services/base/bodies.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import grpc
2727

2828

29-
class GRPCBodyService(ABC):
29+
class GRPCBodyService(ABC): # pragma: no cover
3030
"""Body service for gRPC communication with the Geometry server.
3131
3232
Parameters
@@ -37,169 +37,169 @@ class GRPCBodyService(ABC):
3737

3838
def __init__(self, channel: grpc.Channel):
3939
"""Initialize the GRPCBodyService class."""
40-
pass # pragma: no cover
40+
pass
4141

4242
@abstractmethod
4343
def create_sphere_body(self, **kwargs) -> dict:
4444
"""Create a sphere body."""
45-
pass # pragma: no cover
45+
pass
4646

4747
@abstractmethod
4848
def create_extruded_body(self, **kwargs) -> dict:
4949
"""Create an extruded body."""
50-
pass # pragma: no cover
50+
pass
5151

5252
@abstractmethod
5353
def create_sweeping_profile_body(self, **kwargs) -> dict:
5454
"""Create a sweeping profile body."""
55-
pass # pragma: no cover
55+
pass
5656

5757
@abstractmethod
5858
def create_sweeping_chain(self, **kwargs) -> dict:
5959
"""Create a sweeping chain."""
60-
pass # pragma: no cover
60+
pass
6161

6262
@abstractmethod
6363
def create_extruded_body_from_face_profile(self, **kwargs) -> dict:
6464
"""Create an extruded body from a face profile."""
65-
pass # pragma: no cover
65+
pass
6666

6767
@abstractmethod
6868
def create_extruded_body_from_loft_profiles(self, **kwargs) -> dict:
6969
"""Create an extruded body from loft profiles."""
70-
pass # pragma: no cover
70+
pass
7171

7272
@abstractmethod
7373
def create_planar_body(self, **kwargs) -> dict:
7474
"""Create a planar body."""
75-
pass # pragma: no cover
75+
pass
7676

7777
@abstractmethod
7878
def create_body_from_face(self, **kwargs) -> dict:
7979
"""Create a body from a face."""
80-
pass # pragma: no cover
80+
pass
8181

8282
@abstractmethod
8383
def create_surface_body(self, **kwargs) -> dict:
8484
"""Create a surface body."""
85-
pass # pragma: no cover
85+
pass
8686

8787
@abstractmethod
8888
def create_surface_body_from_trimmed_curves(self, **kwargs) -> dict:
8989
"""Create a surface body from trimmed curves."""
90-
pass # pragma: no cover
90+
pass
9191

9292
@abstractmethod
9393
def translate(self, **kwargs) -> dict:
9494
"""Translate a body."""
95-
pass # pragma: no cover
95+
pass
9696

9797
@abstractmethod
9898
def delete(self, **kwargs) -> dict:
9999
"""Delete a body."""
100-
pass # pragma: no cover
100+
pass
101101

102102
@abstractmethod
103103
def is_suppressed(self, **kwargs) -> dict:
104104
"""Check if a body is suppressed."""
105-
pass # pragma: no cover
105+
pass
106106

107107
@abstractmethod
108108
def get_color(self, **kwargs) -> dict:
109109
"""Get the color of a body."""
110-
pass # pragma: no cover
110+
pass
111111

112112
@abstractmethod
113113
def get_faces(self, **kwargs) -> dict:
114114
"""Get the faces of a body."""
115-
pass # pragma: no cover
115+
pass
116116

117117
@abstractmethod
118118
def get_edges(self, **kwargs) -> dict:
119119
"""Get the edges of a body."""
120-
pass # pragma: no cover
120+
pass
121121

122122
@abstractmethod
123123
def get_volume(self, **kwargs) -> dict:
124124
"""Get the volume of a body."""
125-
pass # pragma: no cover
125+
pass
126126

127127
@abstractmethod
128128
def get_bounding_box(self, **kwargs) -> dict:
129129
"""Get the bounding box of a body."""
130-
pass # pragma: no cover
130+
pass
131131

132132
@abstractmethod
133133
def set_assigned_material(self, **kwargs) -> dict:
134134
"""Set the assigned material of a body."""
135-
pass # pragma: no cover
135+
pass
136136

137137
@abstractmethod
138138
def get_assigned_material(self, **kwargs) -> dict:
139139
"""Get the assigned material of a body."""
140-
pass # pragma: no cover
140+
pass
141141

142142
@abstractmethod
143143
def set_name(self, **kwargs) -> dict:
144144
"""Set the name of a body."""
145-
pass # pragma: no cover
145+
pass
146146

147147
@abstractmethod
148148
def set_fill_style(self, **kwargs) -> dict:
149149
"""Set the fill style of a body."""
150-
pass # pragma: no cover
150+
pass
151151

152152
@abstractmethod
153153
def set_suppressed(self, **kwargs) -> dict:
154154
"""Set the suppressed state of a body."""
155-
pass # pragma: no cover
155+
pass
156156

157157
@abstractmethod
158158
def set_color(self, **kwargs) -> dict:
159159
"""Set the color of a body."""
160-
pass # pragma: no cover
160+
pass
161161

162162
@abstractmethod
163163
def rotate(self, **kwargs) -> dict:
164164
"""Rotate a body."""
165-
pass # pragma: no cover
165+
pass
166166

167167
@abstractmethod
168168
def scale(self, **kwargs) -> dict:
169169
"""Scale a body."""
170-
pass # pragma: no cover
170+
pass
171171

172172
@abstractmethod
173173
def mirror(self, **kwargs) -> dict:
174174
"""Mirror a body."""
175-
pass # pragma: no cover
175+
pass
176176

177177
@abstractmethod
178178
def map(self, **kwargs) -> dict:
179179
"""Map a body."""
180-
pass # pragma: no cover
180+
pass
181181

182182
@abstractmethod
183183
def get_collision(self, **kwargs) -> dict:
184184
"""Get the collision of a body."""
185-
pass # pragma: no cover
185+
pass
186186

187187
@abstractmethod
188188
def copy(self, **kwargs) -> dict:
189189
"""Copy a body."""
190-
pass # pragma: no cover
190+
pass
191191

192192
@abstractmethod
193193
def get_tesellation(self, **kwargs) -> dict:
194194
"""Get the tessellation of a body."""
195-
pass # pragma: no cover
195+
pass
196196

197197
@abstractmethod
198198
def get_tesellation_with_options(self, **kwargs) -> dict:
199199
"""Get the tessellation of a body with options."""
200-
pass # pragma: no cover
200+
pass
201201

202202
@abstractmethod
203203
def boolean(self, **kwargs) -> dict:
204204
"""Boolean operation."""
205-
pass # pragma: no cover
205+
pass

src/ansys/geometry/core/_grpc/_services/base/conversions.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# SOFTWARE.
2222
"""Module containing server-version agnostic conversions."""
2323

24+
from pint import Quantity
25+
2426
from ansys.geometry.core.misc.measurements import DEFAULT_UNITS, Distance, Measurement
2527

2628

@@ -75,3 +77,24 @@ def to_distance(value: float | int) -> Distance:
7577
The value should represent a length in the server's unit system.
7678
"""
7779
return Distance(value, DEFAULT_UNITS.SERVER_LENGTH)
80+
81+
82+
def to_area(value: float | int) -> Quantity:
83+
"""Convert a server value to an area object.
84+
85+
Parameters
86+
----------
87+
value : float | int
88+
Value to convert.
89+
90+
Returns
91+
-------
92+
Quantity
93+
Converted area.
94+
95+
Notes
96+
-----
97+
The value is converted to a Quantity object using the default server area unit.
98+
The value should represent an area in the server's unit system.
99+
"""
100+
return Quantity(value, DEFAULT_UNITS.SERVER_AREA)

src/ansys/geometry/core/_grpc/_services/base/coordinate_systems.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import grpc
2727

2828

29-
class GRPCCoordinateSystemService(ABC):
29+
class GRPCCoordinateSystemService(ABC): # pragma: no cover
3030
"""Coordinate systems service for gRPC communication with the Geometry server.
3131
3232
Parameters
@@ -37,9 +37,9 @@ class GRPCCoordinateSystemService(ABC):
3737

3838
def __init__(self, channel: grpc.Channel):
3939
"""Initialize the GRPCCoordinateSystemService class."""
40-
pass # pragma: no cover
40+
pass
4141

4242
@abstractmethod
4343
def create(self, **kwargs) -> dict:
4444
"""Create a coordinate system."""
45-
pass # pragma: no cover
45+
pass

src/ansys/geometry/core/_grpc/_services/base/dbuapplication.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import grpc
2727

2828

29-
class GRPCDbuApplicationService(ABC):
29+
class GRPCDbuApplicationService(ABC): # pragma: no cover
3030
"""DBU Application service for gRPC communication with the Geometry server.
3131
3232
Parameters
@@ -37,9 +37,9 @@ class GRPCDbuApplicationService(ABC):
3737

3838
def __init__(self, channel: grpc.Channel):
3939
"""Initialize the GRPCDbuApplicationService class."""
40-
pass # pragma: no cover
40+
pass
4141

4242
@abstractmethod
4343
def run_script(self, **kwargs) -> dict:
4444
"""Run a Scripting API script."""
45-
pass # pragma: no cover
45+
pass

0 commit comments

Comments
 (0)