Skip to content

Commit

Permalink
feat: Adding version check to all API methods (#440)
Browse files Browse the repository at this point in the history
Co-authored-by: pyansys-ci-bot <[email protected]>
  • Loading branch information
anskhanson and pyansys-ci-bot authored Nov 8, 2024
1 parent f3901cd commit 6559568
Show file tree
Hide file tree
Showing 27 changed files with 613 additions and 152 deletions.
1 change: 1 addition & 0 deletions doc/changelog.d/440.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: Adding version check to all API methods
2 changes: 1 addition & 1 deletion src/ansys/sherlock/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Ease import statements
# ------------------------------------------------------------------------------

from ansys.sherlock.core.logging import Logger
from ansys.sherlock.core.pysherlock_logging import Logger

LOG = Logger("sherlock")
"""PySherlock logger."""
57 changes: 54 additions & 3 deletions src/ansys/sherlock/core/analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2023 ANSYS, Inc. All rights reserved.
# Copyright (C) 2023-2024 ANSYS, Inc. and/or its affiliates.

"""Module containing all analysis capabilities."""

Expand All @@ -25,14 +25,15 @@
SherlockUpdateSolderFatiguePropsError,
)
from ansys.sherlock.core.grpc_stub import GrpcStub
from ansys.sherlock.core.utils.version_check import require_version


class Analysis(GrpcStub):
"""Contains all analysis capabilities."""

def __init__(self, channel):
def __init__(self, channel, server_version):
"""Initialize a gRPC stub for the Sherlock Analysis service."""
super().__init__(channel)
super().__init__(channel, server_version)
self.stub = SherlockAnalysisService_pb2_grpc.SherlockAnalysisServiceStub(channel)
self.FIELD_NAMES = {
"analysisTemp": "analysis_temp",
Expand Down Expand Up @@ -88,6 +89,7 @@ def _add_analyses(request, analyses):
event = phase.events.add()
event.name = e

@require_version()
def run_analysis(
self,
project,
Expand All @@ -96,6 +98,8 @@ def run_analysis(
):
"""Run one or more Sherlock analyses.
Available Since: 2021R1
Parameters
----------
project : str
Expand Down Expand Up @@ -184,9 +188,12 @@ def run_analysis(
LOG.error(str(e))
raise e

@require_version()
def get_harmonic_vibe_input_fields(self, model_source=None):
"""Get harmonic vibe property fields based on the user configuration.
Available Since: 2024R1
Parameters
----------
model_source : ModelSource, optional
Expand Down Expand Up @@ -228,13 +235,16 @@ def get_harmonic_vibe_input_fields(self, model_source=None):

return fields

@require_version()
def update_harmonic_vibe_props(
self,
project,
harmonic_vibe_properties,
):
"""Update properties for a harmonic vibe analysis.
Available Since: 2024R1
Parameters
----------
project : str
Expand Down Expand Up @@ -490,9 +500,12 @@ def update_harmonic_vibe_props(
LOG.error(str(e))
raise e

@require_version(241)
def get_ict_analysis_input_fields(self):
"""Get ICT analysis property fields based on the user configuration.
Available Since: 2024R1
Parameters
----------
None
Expand Down Expand Up @@ -520,13 +533,16 @@ def get_ict_analysis_input_fields(self):

return fields

@require_version(241)
def update_ict_analysis_props(
self,
project,
ict_analysis_properties,
):
"""Update properties for an ICT analysis.
Available Since: 2024R1
Parameters
----------
project : str
Expand Down Expand Up @@ -667,9 +683,12 @@ def update_ict_analysis_props(
LOG.error(str(e))
raise e

@require_version(241)
def get_mechanical_shock_input_fields(self, model_source=None):
"""Get mechanical shock property fields based on the user configuration.
Available Since: 2024R1
Parameters
----------
model_source : ModelSource, optional
Expand Down Expand Up @@ -711,13 +730,16 @@ def get_mechanical_shock_input_fields(self, model_source=None):

return fields

@require_version(241)
def update_mechanical_shock_props(
self,
project,
mechanical_shock_properties,
):
"""Update properties for a mechanical shock analysis.
Available Since: 2024R1
Parameters
----------
project : str
Expand Down Expand Up @@ -915,9 +937,12 @@ def update_mechanical_shock_props(
LOG.error(str(e))
raise e

@require_version(241)
def get_solder_fatigue_input_fields(self):
"""Get solder fatigue property fields based on the user configuration.
Available Since: 2024R1
Returns
-------
list
Expand Down Expand Up @@ -950,13 +975,16 @@ def get_solder_fatigue_input_fields(self):

return fields

@require_version(241)
def update_solder_fatigue_props(
self,
project,
solder_fatigue_properties,
):
"""Update properties for a solder fatigue analysis.
Available Since: 2024R1
Parameters
----------
project : str
Expand Down Expand Up @@ -1087,9 +1115,12 @@ def update_solder_fatigue_props(
LOG.error(str(e))
raise e

@require_version()
def get_random_vibe_input_fields(self, model_source=None):
"""Get random vibe property fields based on the user configuration.
Available Since: 2023R2
Parameters
----------
model_source : ModelSource, optional
Expand Down Expand Up @@ -1130,6 +1161,7 @@ def get_random_vibe_input_fields(self, model_source=None):

return fields

@require_version()
def update_random_vibe_props(
self,
project,
Expand All @@ -1151,6 +1183,8 @@ def update_random_vibe_props(
):
"""Update properties for a random vibe analysis.
Available Since: 2024R1
Parameters
----------
project : str
Expand Down Expand Up @@ -1282,9 +1316,12 @@ def update_random_vibe_props(
LOG.error(str(e))
raise e

@require_version()
def get_natural_frequency_input_fields(self):
"""Get natural frequency property fields based on the user configuration.
Available Since: 2023R2
Returns
-------
list
Expand Down Expand Up @@ -1317,6 +1354,7 @@ def get_natural_frequency_input_fields(self):

return fields

@require_version()
def update_natural_frequency_props(
self,
project: str,
Expand All @@ -1333,6 +1371,8 @@ def update_natural_frequency_props(
):
"""Update properties for a natural frequency analysis.
Available Since:2023R2
Parameters
----------
project : str
Expand Down Expand Up @@ -1432,6 +1472,7 @@ def update_natural_frequency_props(
LOG.error(str(e))
raise e

@require_version()
def run_strain_map_analysis(
self,
project,
Expand All @@ -1440,6 +1481,8 @@ def run_strain_map_analysis(
):
"""Run one or more strain map analyses.
Available Since: 2023R2
Parameters
----------
project : str
Expand Down Expand Up @@ -1586,9 +1629,12 @@ def run_strain_map_analysis(
LOG.error(str(e))
raise e

@require_version()
def update_pcb_modeling_props(self, project, cca_names, analyses):
"""Update FEA PCB Modeling properties for one or more CCAs.
Available Since: 2023R2
Parameters
----------
project : str
Expand Down Expand Up @@ -1702,9 +1748,12 @@ def update_pcb_modeling_props(self, project, cca_names, analyses):
LOG.error(str(e))
raise e

@require_version(241)
def update_part_modeling_props(self, project, part_modeling_props):
"""Update part modeling properties for a given project's CCA.
Available Since: 2024R1
Parameters
----------
project : str
Expand Down Expand Up @@ -1832,6 +1881,7 @@ def update_part_modeling_props(self, project, part_modeling_props):
LOG.error(str(e))
raise e

@require_version(251)
def update_part_list_validation_analysis_props(
self,
project,
Expand Down Expand Up @@ -1972,6 +2022,7 @@ def update_part_list_validation_analysis_props(
LOG.error(str(e))
raise e

@require_version(251)
def get_parts_list_validation_analysis_props(
self,
project: str,
Expand Down
Loading

0 comments on commit 6559568

Please sign in to comment.