Skip to content

Commit f78e1a6

Browse files
jacobrkerstetterpyansys-ci-botpre-commit-ci[bot]
authored
chore: remove grpc ids (#2295)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 830c6d3 commit f78e1a6

File tree

7 files changed

+35
-58
lines changed

7 files changed

+35
-58
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove grpc ids

src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
geometry issues, such as split edges, extra edges, duplicate faces etc.
2727
"""
2828

29+
from google.protobuf.wrappers_pb2 import Int32Value
2930
import grpc
3031

3132
from ansys.geometry.core.errors import protect_grpc
@@ -542,7 +543,9 @@ def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102
542543

543544
# Create the request - assumes all inputs are valid and of the proper type
544545
request = FixDuplicateFacesRequest(
545-
duplicate_face_problem_area_id=kwargs["duplicate_face_problem_area_id"],
546+
duplicate_face_problem_area_id=Int32Value(
547+
value=int(kwargs["duplicate_face_problem_area_id"])
548+
),
546549
)
547550

548551
# Call the gRPC service
@@ -564,7 +567,9 @@ def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102
564567

565568
# Create the request - assumes all inputs are valid and of the proper type
566569
request = FixMissingFacesRequest(
567-
missing_face_problem_area_id=kwargs["missing_face_problem_area_id"],
570+
missing_face_problem_area_id=Int32Value(
571+
value=int(kwargs["missing_face_problem_area_id"])
572+
),
568573
)
569574

570575
# Call the gRPC service
@@ -586,7 +591,9 @@ def fix_inexact_edges(self, **kwargs) -> dict: # noqa: D102
586591

587592
# Create the request - assumes all inputs are valid and of the proper type
588593
request = FixInexactEdgesRequest(
589-
inexact_edge_problem_area_id=kwargs["inexact_edge_problem_area_id"],
594+
inexact_edge_problem_area_id=Int32Value(
595+
value=int(kwargs["inexact_edge_problem_area_id"])
596+
),
590597
)
591598

592599
# Call the gRPC service
@@ -608,7 +615,7 @@ def fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
608615

609616
# Create the request - assumes all inputs are valid and of the proper type
610617
request = FixExtraEdgesRequest(
611-
extra_edge_problem_area_id=kwargs["extra_edge_problem_area_id"],
618+
extra_edge_problem_area_id=Int32Value(value=int(kwargs["extra_edge_problem_area_id"])),
612619
)
613620

614621
# Call the gRPC service
@@ -630,7 +637,7 @@ def fix_short_edges(self, **kwargs) -> dict: # noqa: D102
630637

631638
# Create the request - assumes all inputs are valid and of the proper type
632639
request = FixShortEdgesRequest(
633-
short_edge_problem_area_id=kwargs["short_edge_problem_area_id"],
640+
short_edge_problem_area_id=Int32Value(value=int(kwargs["short_edge_problem_area_id"])),
634641
)
635642

636643
# Call the gRPC service
@@ -652,7 +659,7 @@ def fix_small_faces(self, **kwargs) -> dict: # noqa: D102
652659

653660
# Create the request - assumes all inputs are valid and of the proper type
654661
request = FixSmallFacesRequest(
655-
small_face_problem_area_id=kwargs["small_face_problem_area_id"],
662+
small_face_problem_area_id=Int32Value(value=int(kwargs["small_face_problem_area_id"])),
656663
)
657664

658665
# Call the gRPC service
@@ -674,7 +681,7 @@ def fix_split_edges(self, **kwargs) -> dict: # noqa: D102
674681

675682
# Create the request - assumes all inputs are valid and of the proper type
676683
request = FixSplitEdgesRequest(
677-
split_edge_problem_area_id=kwargs["split_edge_problem_area_id"],
684+
split_edge_problem_area_id=Int32Value(value=int(kwargs["split_edge_problem_area_id"])),
678685
)
679686

680687
# Call the gRPC service
@@ -696,7 +703,9 @@ def fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
696703

697704
# Create the request - assumes all inputs are valid and of the proper type
698705
request = FixStitchFacesRequest(
699-
stitch_face_problem_area_id=kwargs["stitch_face_problem_area_id"],
706+
stitch_face_problem_area_id=Int32Value(
707+
value=int(kwargs["stitch_face_problem_area_id"])
708+
),
700709
)
701710

702711
# Call the gRPC service
@@ -718,7 +727,9 @@ def fix_unsimplified_faces(self, **kwargs) -> dict: # noqa: D102
718727

719728
# Create the request - assumes all inputs are valid and of the proper type
720729
request = FixAdjustSimplifyRequest(
721-
adjust_simplify_problem_area_id=kwargs["adjust_simplify_problem_area_id"],
730+
adjust_simplify_problem_area_id=Int32Value(
731+
value=int(kwargs["adjust_simplify_problem_area_id"])
732+
),
722733
)
723734

724735
# Call the gRPC service
@@ -740,7 +751,9 @@ def fix_interference(self, **kwargs) -> dict: # noqa: D102
740751

741752
# Create the request - assumes all inputs are valid and of the proper type
742753
request = FixInterferenceRequest(
743-
interference_problem_area_id=kwargs["interference_problem_area_id"],
754+
interference_problem_area_id=Int32Value(
755+
value=int(kwargs["interference_problem_area_id"])
756+
),
744757
)
745758

746759
# Call the gRPC service

src/ansys/geometry/core/designer/body.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
from abc import ABC, abstractmethod
2525
from collections.abc import Iterable
2626
from enum import Enum, unique
27-
from functools import cached_property, wraps
27+
from functools import wraps
2828
from typing import TYPE_CHECKING, Union
2929

30-
from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
3130
from beartype import beartype as check_input_types
3231
import matplotlib.colors as mcolors
3332
from pint import Quantity
@@ -120,11 +119,6 @@ def id(self) -> str:
120119
"""Get the ID of the body as a string."""
121120
return
122121

123-
@abstractmethod
124-
def _grpc_id(self) -> EntityIdentifier:
125-
"""Entity identifier of this body on the server side."""
126-
return
127-
128122
@abstractmethod
129123
def name(self) -> str:
130124
"""Get the name of the body."""
@@ -890,10 +884,6 @@ def wrapper(self: "MasterBody", *args, **kwargs):
890884
def id(self) -> str: # noqa: D102
891885
return self._id
892886

893-
@cached_property
894-
def _grpc_id(self) -> EntityIdentifier: # noqa: D102
895-
return EntityIdentifier(id=self._id)
896-
897887
@property
898888
def name(self) -> str: # noqa: D102
899889
return self._name
@@ -1468,10 +1458,6 @@ def _reset_tessellation_cache(self): # noqa: N805
14681458
def id(self) -> str: # noqa: D102
14691459
return self._id
14701460

1471-
@cached_property
1472-
def _grpc_id(self) -> EntityIdentifier: # noqa: D102
1473-
return EntityIdentifier(id=self._id)
1474-
14751461
@property
14761462
def name(self) -> str: # noqa: D102
14771463
return self._template.name

src/ansys/geometry/core/designer/component.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from typing import TYPE_CHECKING, Any, Optional, Union
2828
import uuid
2929

30-
from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
3130
from beartype import beartype as check_input_types
3231
from pint import Quantity
3332

@@ -276,11 +275,6 @@ def id(self) -> str:
276275
"""ID of the component."""
277276
return self._id
278277

279-
@property
280-
def _grpc_id(self) -> EntityIdentifier:
281-
"""ID of the component in gRPC format."""
282-
return EntityIdentifier(id=self.id)
283-
284278
@property
285279
def name(self) -> str:
286280
"""Name of the component."""

src/ansys/geometry/core/designer/edge.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from enum import Enum, unique
2525
from typing import TYPE_CHECKING
2626

27-
from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
2827
from pint import Quantity
2928

3029
from ansys.geometry.core.connection.client import GrpcClient
@@ -93,11 +92,6 @@ def id(self) -> str:
9392
"""ID of the edge."""
9493
return self._id
9594

96-
@property
97-
def _grpc_id(self) -> EntityIdentifier:
98-
"""Entity ID of this edge on the server side."""
99-
return EntityIdentifier(id=self._id)
100-
10195
@property
10296
def body(self) -> "Body":
10397
"""Body of the edge."""

src/ansys/geometry/core/designer/face.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from enum import Enum, unique
2525
from typing import TYPE_CHECKING
2626

27-
from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
2827
from beartype import beartype as check_input_types
2928
import matplotlib.colors as mcolors
3029
from pint import Quantity
@@ -185,11 +184,6 @@ def id(self) -> str:
185184
"""Face ID."""
186185
return self._id
187186

188-
@property
189-
def _grpc_id(self) -> EntityIdentifier:
190-
"""Entity ID of this face on the server side."""
191-
return EntityIdentifier(id=self._id)
192-
193187
@property
194188
def is_reversed(self) -> bool:
195189
"""Flag indicating if the face is reversed."""

src/ansys/geometry/core/tools/problem_areas.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
from abc import abstractmethod
2525
from typing import TYPE_CHECKING
2626

27-
from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub
28-
from google.protobuf.wrappers_pb2 import Int32Value
29-
3027
import ansys.geometry.core as pyansys_geom
3128
from ansys.geometry.core.connection import GrpcClient
3229
from ansys.geometry.core.misc.auxiliary import (
@@ -57,8 +54,6 @@ class ProblemArea:
5754
def __init__(self, id: str, grpc_client: GrpcClient):
5855
"""Initialize a new instance of a problem area class."""
5956
self._id = id
60-
self._grpc_id = Int32Value(value=int(id))
61-
self._repair_stub = RepairToolsStub(grpc_client.channel)
6257
self._grpc_client = grpc_client
6358

6459
@property
@@ -138,7 +133,7 @@ def fix(self) -> RepairToolMessage:
138133

139134
parent_design = get_design_from_face(self.faces[0])
140135
response = self._grpc_client.services.repair_tools.fix_duplicate_faces(
141-
duplicate_face_problem_area_id=self._grpc_id
136+
duplicate_face_problem_area_id=self.id
142137
)
143138

144139
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -192,7 +187,7 @@ def fix(self) -> RepairToolMessage:
192187

193188
parent_design = get_design_from_edge(self.edges[0])
194189
response = self._grpc_client.services.repair_tools.fix_missing_faces(
195-
missing_face_problem_area_id=self._grpc_id
190+
missing_face_problem_area_id=self.id
196191
)
197192

198193
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -247,7 +242,7 @@ def fix(self) -> RepairToolMessage:
247242
parent_design = get_design_from_edge(self.edges[0])
248243

249244
response = self._grpc_client.services.repair_tools.fix_inexact_edges(
250-
inexact_edge_problem_area_id=self._grpc_id
245+
inexact_edge_problem_area_id=self.id
251246
)
252247

253248
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -301,7 +296,7 @@ def fix(self) -> RepairToolMessage:
301296

302297
parent_design = get_design_from_edge(self.edges[0])
303298
response = self._grpc_client.services.repair_tools.fix_extra_edges(
304-
extra_edge_problem_area_id=self._grpc_id
299+
extra_edge_problem_area_id=self.id
305300
)
306301

307302
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -355,7 +350,7 @@ def fix(self) -> RepairToolMessage:
355350

356351
parent_design = get_design_from_edge(self.edges[0])
357352
response = self._grpc_client.services.repair_tools.fix_short_edges(
358-
short_edge_problem_area_id=self._grpc_id
353+
short_edge_problem_area_id=self.id
359354
)
360355

361356
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -409,7 +404,7 @@ def fix(self) -> RepairToolMessage:
409404

410405
parent_design = get_design_from_face(self.faces[0])
411406
response = self._grpc_client.services.repair_tools.fix_small_faces(
412-
small_face_problem_area_id=self._grpc_id
407+
small_face_problem_area_id=self.id
413408
)
414409

415410
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -463,7 +458,7 @@ def fix(self) -> RepairToolMessage:
463458

464459
parent_design = get_design_from_edge(self.edges[0])
465460
response = self._grpc_client.services.repair_tools.fix_split_edges(
466-
split_edge_problem_area_id=self._grpc_id
461+
split_edge_problem_area_id=self.id
467462
)
468463

469464
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -517,7 +512,7 @@ def fix(self) -> RepairToolMessage:
517512

518513
parent_design = get_design_from_body(self.bodies[0])
519514
response = self._grpc_client.services.repair_tools.fix_stitch_faces(
520-
stitch_face_problem_area_id=self._grpc_id
515+
stitch_face_problem_area_id=self.id
521516
)
522517

523518
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -566,7 +561,7 @@ def fix(self) -> RepairToolMessage:
566561

567562
parent_design = get_design_from_face(self.faces[0])
568563
response = self._grpc_client.services.repair_tools.fix_unsimplified_faces(
569-
adjust_simplify_problem_area_id=self._grpc_id
564+
adjust_simplify_problem_area_id=self.id
570565
)
571566

572567
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
@@ -620,7 +615,7 @@ def fix(self) -> RepairToolMessage:
620615

621616
parent_design = get_design_from_body(self.bodies[0])
622617
response = self._grpc_client.services.repair_tools.fix_interference(
623-
interference_problem_area_id=self._grpc_id
618+
interference_problem_area_id=self.id
624619
)
625620

626621
if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:

0 commit comments

Comments
 (0)