Skip to content

Commit bbc9ffa

Browse files
maint: Deprecated new APIs and removed previous deprecated APIs (#664)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 74eeb99 commit bbc9ffa

File tree

8 files changed

+7
-209
lines changed

8 files changed

+7
-209
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Maint: Deprecated new APIs and removed previous deprecated APIs

doc/source/api/parts_types.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ Constants
1818

1919
Classes
2020
-------
21-
.. autoclass:: PartLocation
22-
:members:
2321
.. autoclass:: GetPartsListPropertiesRequest
2422
:members:

src/ansys/sherlock/core/errors.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -533,18 +533,6 @@ def __str__(self):
533533
return f"Enable lead modeling error: {self.message}"
534534

535535

536-
class SherlockGetPartLocationError(Exception):
537-
"""Contains the error raised when getting part location results in an error."""
538-
539-
def __init__(self, message: str):
540-
"""Initialize error message."""
541-
self.message = message
542-
543-
def __str__(self):
544-
"""Format error message."""
545-
return f"Get part location error: {self.message}"
546-
547-
548536
class SherlockLoadThermalProfileError(Exception):
549537
"""Contains the error raised when loading thermal profile."""
550538

src/ansys/sherlock/core/lifecycle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def _init_harmonic_profile_types(self):
105105
def _init_ampl_units(self):
106106
"""Initialize the list for amplitude units.
107107
108-
Available Since: 2021R1
108+
.. deprecated:: 2026 R1
109+
109110
"""
110111
if self._is_connection_up():
111112
ampl_unit_request = SherlockLifeCycleService_pb2.ListAmplUnitsRequest()
@@ -127,7 +128,8 @@ def _init_cycle_states(self):
127128
def _init_load_units(self):
128129
"""Initialize the list for load units.
129130
130-
Available Since: 2021R1
131+
.. deprecated:: 2026 R1
132+
131133
"""
132134
if self._is_connection_up():
133135
load_unit_request = SherlockLifeCycleService_pb2.ListShockLoadUnitsRequest()

src/ansys/sherlock/core/parts.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
SherlockEnableLeadModelingError,
1616
SherlockExportNetListError,
1717
SherlockExportPartsListError,
18-
SherlockGetPartLocationError,
1918
SherlockImportPartsListError,
2019
SherlockNoGrpcConnectionException,
2120
SherlockUpdatePartsFromAVLError,
@@ -32,7 +31,6 @@
3231
DeletePartsFromPartsListRequest,
3332
GetPartsListPropertiesRequest,
3433
ImportPartsToAVLRequest,
35-
PartLocation,
3634
PartsListSearchDuplicationMode,
3735
UpdatePadPropertiesRequest,
3836
)
@@ -654,83 +652,6 @@ def enable_lead_modeling(self, project: str, cca_name: str):
654652
LOG.error(str(e))
655653
raise e
656654

657-
@require_version()
658-
def get_part_location(
659-
self, project: str, cca_name: str, ref_des: str, location_units: str
660-
) -> list[PartLocation]:
661-
"""Return the location properties for one or more part.
662-
663-
Available Since: 2022R1
664-
665-
Parameters
666-
----------
667-
project: str
668-
Name of the Sherlock project.
669-
cca_name: str
670-
Name of the CCA.
671-
ref_des: str
672-
Comma separated list of reference designators of parts to retrieve locations for.
673-
location_units: str
674-
Valid units for a part's location.
675-
676-
Returns
677-
-------
678-
list[PartLocation]
679-
PartLocation for each part that corresponds to the reference designators.
680-
681-
Examples
682-
--------
683-
>>> from ansys.sherlock.core.launcher import launch_sherlock
684-
>>> sherlock = launch_sherlock()
685-
>>> sherlock.project.import_odb_archive(
686-
"ODB++ Tutorial.tgz",
687-
True,
688-
True,
689-
True,
690-
True,
691-
project="Test",
692-
cca_name="Card",
693-
)
694-
>>> part_locations = sherlock.parts.get_part_location(
695-
project="Test",
696-
cca_name="Card",
697-
ref_des="C1,C2",
698-
location_units="in",
699-
)
700-
>>> print(f"{part_locations}")
701-
"""
702-
try:
703-
if project == "":
704-
raise SherlockGetPartLocationError(message="Project name is invalid.")
705-
if cca_name == "":
706-
raise SherlockGetPartLocationError(message="CCA name is invalid.")
707-
if ref_des == "":
708-
raise SherlockGetPartLocationError(message="Ref Des is invalid.")
709-
if location_units == "":
710-
raise SherlockGetPartLocationError(message="Location unit is invalid.")
711-
if not self._is_connection_up():
712-
raise SherlockNoGrpcConnectionException()
713-
714-
request = SherlockPartsService_pb2.GetPartLocationRequest(
715-
project=project,
716-
ccaName=cca_name,
717-
refDes=ref_des,
718-
locationUnits=location_units,
719-
)
720-
response = self.stub.getPartLocation(request)
721-
return_code = response.returnCode
722-
723-
if return_code.value == -1:
724-
raise SherlockGetPartLocationError(return_code.message)
725-
726-
locations = []
727-
for location in response.locationData:
728-
locations.append(PartLocation(location))
729-
return locations
730-
except SherlockGetPartLocationError as e:
731-
LOG.error(str(e))
732-
raise e
733-
734655
@require_version(252)
735656
def get_parts_list_properties(
736657
self, request: GetPartsListPropertiesRequest

src/ansys/sherlock/core/stackup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def __init__(self, channel: Channel, server_version: int):
5050
def _init_laminate_thickness_units(self):
5151
"""Initialize the list of units for the laminate thickness.
5252
53-
Available Since: 2021R1
53+
.. deprecated:: 2026 R1
54+
5455
"""
5556
if self._is_connection_up():
5657
laminate_thickness_unit_request = (

src/ansys/sherlock/core/types/parts_types.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,6 @@ class AVLDescription:
7171
"""DoNotChangeDescription"""
7272

7373

74-
class PartLocation:
75-
"""Part Location property values."""
76-
77-
def __init__(self, location):
78-
"""Initialize members from the location."""
79-
self.x = location.x
80-
"""X coordinate"""
81-
self.y = location.y
82-
"""Y coordinate"""
83-
self.rotation = location.rotation
84-
"""Rotation (in degrees)"""
85-
self.location_units = location.locationUnits
86-
"""Units for location coordinates"""
87-
self.board_side = location.boardSide
88-
"""Board side - ``"TOP"`` or ``"BOTTOM"`` """
89-
self.mirrored = location.mirrored
90-
"""Mirrored - ``True`` or ``False`` """
91-
self.ref_des = location.refDes
92-
"""Reference designator"""
93-
94-
9574
class GetPartsListPropertiesRequest(BaseModel):
9675
"""Request for getting properties of parts in the parts list of a CCA."""
9776

tests/test_parts.py

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
SherlockEnableLeadModelingError,
1313
SherlockExportNetListError,
1414
SherlockExportPartsListError,
15-
SherlockGetPartLocationError,
1615
SherlockImportPartsListError,
1716
SherlockNoGrpcConnectionException,
1817
SherlockUpdatePartsFromAVLError,
@@ -52,7 +51,6 @@ def test_all():
5251
helper_test_export_parts_list(parts)
5352
helper_test_export_net_list(parts)
5453
helper_test_enable_lead_modeling(parts)
55-
helper_test_get_part_location(parts)
5654
helper_test_get_parts_list_properties(parts)
5755
helper_test_update_pad_properties(parts)
5856
helper_test_import_parts_to_avl(parts)
@@ -602,96 +600,6 @@ def helper_test_enable_lead_modeling(parts: Parts):
602600
assert str(e) == "Enable lead modeling error: CCA name is invalid."
603601

604602

605-
def helper_test_get_part_location(parts: Parts):
606-
"""Test get_part_location API"""
607-
608-
if parts._is_connection_up():
609-
try:
610-
parts.get_part_location(
611-
"Tutorial Project",
612-
"Invalid CCA",
613-
"C1",
614-
"in",
615-
)
616-
pytest.fail("No exception raised when using an invalid parameter")
617-
except Exception as e:
618-
assert type(e) == SherlockGetPartLocationError
619-
620-
try:
621-
locations = parts.get_part_location(
622-
"Tutorial Project",
623-
"Main Board",
624-
"C1, C3",
625-
"in",
626-
)
627-
628-
assert len(locations) == 2, "Incorrect number of locations"
629-
location_c1 = locations[0]
630-
assert location_c1.ref_des == "C1", "Incorrect refDes"
631-
assert location_c1.x == -2.7, "Incorrect X coordinate for C1"
632-
assert location_c1.y == -1.65, "Incorrect Y coordinate for C1"
633-
assert location_c1.rotation == 0, "Incorrect rotation for C1"
634-
assert location_c1.location_units == "in", "Incorrect location units for C1"
635-
assert location_c1.board_side == "TOP", "Incorrect board side for C1"
636-
assert location_c1.mirrored is False, "Incorrect mirrored for C1"
637-
638-
location_c3 = locations[1]
639-
assert location_c3.ref_des == "C3", "Incorrect refDes"
640-
assert location_c3.x == -2.4, "Incorrect X coordinate for C3"
641-
assert location_c3.y == -1.9, "Incorrect Y coordinate for C3"
642-
assert location_c3.rotation == 180, "Incorrect rotation for C3"
643-
assert location_c3.location_units == "in", "Incorrect location units for C3"
644-
assert location_c3.board_side == "TOP", "Incorrect board side for C3"
645-
assert location_c3.mirrored is False, "Incorrect mirrored for C3"
646-
647-
except SherlockGetPartLocationError as e:
648-
pytest.fail(e.message)
649-
650-
try:
651-
parts.get_part_location(
652-
"",
653-
"Card",
654-
"C1",
655-
"in",
656-
)
657-
pytest.fail("No exception raised when using an invalid parameter")
658-
except SherlockGetPartLocationError as e:
659-
assert str(e) == "Get part location error: Project name is invalid."
660-
661-
try:
662-
parts.get_part_location(
663-
"Test",
664-
"",
665-
"C1",
666-
"in",
667-
)
668-
pytest.fail("No exception raised when using an invalid parameter")
669-
except SherlockGetPartLocationError as e:
670-
assert str(e) == "Get part location error: CCA name is invalid."
671-
672-
try:
673-
parts.get_part_location(
674-
"Test",
675-
"Card",
676-
"",
677-
"in",
678-
)
679-
pytest.fail("No exception raised when using an invalid parameter")
680-
except SherlockGetPartLocationError as e:
681-
assert str(e) == "Get part location error: Ref Des is invalid."
682-
683-
try:
684-
parts.get_part_location(
685-
"Test",
686-
"Card",
687-
"C1",
688-
"",
689-
)
690-
pytest.fail("No exception raised when using an invalid parameter")
691-
except SherlockGetPartLocationError as e:
692-
assert str(e) == "Get part location error: Location unit is invalid."
693-
694-
695603
def helper_test_get_parts_list_properties(parts: Parts):
696604
"""Test get_parts_list_properties API"""
697605
try:

0 commit comments

Comments
 (0)