Skip to content

Commit

Permalink
Add missing versionadded directives (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy-Grigg authored Apr 5, 2024
1 parent c3cfb96 commit 3ff0bfa
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

* [Issue #466](https://github.com/ansys/grantami-bomanalytics/issues/466),
[Pull request #467](https://github.com/ansys/grantami-bomanalytics/pull/467): Tidy up bulleted lists in API documentation.
* [Issue #464](https://github.com/ansys/grantami-bomanalytics/issues/466),
[Pull request #467](https://github.com/ansys/grantami-bomanalytics/pull/467): Add `versionadded` directives to API documentation.

### Contributors

Expand Down
1 change: 1 addition & 0 deletions doc/source/api/bom_builder/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ BoM object model
elements. It is still possible to deserialize an XML BoM that uses these elements, but these elements cannot be
converted to Python objects.

.. versionadded:: 2.0

.. _ref_grantami_bomanalytics_api_billofmaterials:
.. autoclass:: ansys.grantami.bomanalytics.bom_types._bom_types.BillOfMaterials
Expand Down
2 changes: 2 additions & 0 deletions doc/source/api/bom_builder/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Serialization and Deserialization of BoM objects can be performed using the :cla
This exposes methods to read a BoM from a string or a file, and to write to a string or a file. The resulting BoM can be
passed to either a Sustainability or a Compliance query.

.. versionadded:: 2.0

.. toctree::
:maxdepth: 2

Expand Down
2 changes: 2 additions & 0 deletions doc/source/api/sustainability/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ section of the online documentation.
:class:`~ansys.grantami.bomanalytics.LicensingException` will be raised if the feature is not
available.

.. versionadded:: 2.0

.. toctree::
:maxdepth: 3

Expand Down
2 changes: 2 additions & 0 deletions src/ansys/grantami/bomanalytics/_bom_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
class BoMHandler:
"""
Handler for XML formatted BoMs, supports reading from files and strings, and serializing to string format.
.. versionadded:: 2.0
"""

_schema_path: Path = bom_schema_2301
Expand Down
6 changes: 6 additions & 0 deletions src/ansys/grantami/bomanalytics/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ def maximum_spec_link_depth(self) -> Optional[int]:
Supported with Restricted Substances Reports 2023 R2 and newer, with older reports this parameter has
no effect, all specification-to-specification links will be followed.
.. versionadded:: 1.2
.. note::
This limit applies to each branch of the BoM individually. This is not a global limit on the number of
specification-to-specification links that will be traversed across the entire BoM, instead it is a limit on
Expand Down Expand Up @@ -330,10 +332,14 @@ def set_database_details(
location_table_name : str, optional
Name of the table that implements the ``Location`` schema. The default
is ``None``, in which case ``Location`` is used.
.. versionadded:: 2.0
transport_table_name : str, optional
Name of the table that implements the ``Transport`` schema. The default
is ``None``, in which case ``Transport`` is used.
.. versionadded:: 2.0
Notes
-----
The database key and table names are configurable, but they only need to be specified if they have been modified
Expand Down
10 changes: 8 additions & 2 deletions src/ansys/grantami/bomanalytics/_item_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,21 @@ class CoatingReferenceWithIdentifier(IdentifierMixin, CoatingReference):
class ProcessReference(RecordReference):
# Because of ProcessSummaryResult, this is publicly documented.
# Extends RecordReference without changes, to re-define the class name, because it appears in the repr.
"""Represents a reference to a Process record."""
"""Represents a reference to a Process record.
.. versionadded:: 2.0
"""


class ProcessReferenceWithIdentifiers(CommonIdentifiersMixin, ProcessReference):
pass


class TransportReference(RecordReference):
"""Represents a reference to a Transport record."""
"""Represents a reference to a Transport record.
.. versionadded:: 2.0
"""

# Extends RecordReference without changes, to re-define the class name, because it appears in the repr

Expand Down
32 changes: 29 additions & 3 deletions src/ansys/grantami/bomanalytics/_item_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,10 @@ def __init__(self, percentage_amount: Optional[float], **kwargs: Any) -> None:

@property
def percentage_amount(self) -> Optional[float]:
"""Percentage amount of this substance in the parent item."""
"""Percentage amount of this substance in the parent item.
.. versionadded:: 2.1
"""
return self._percentage_amount


Expand Down Expand Up @@ -1324,7 +1327,10 @@ class CoatingWithComplianceResult(


class ValueWithUnit:
"""Describes a value obtained from the API."""
"""Describes a value obtained from the API.
.. versionadded:: 2.0
"""

def __init__(
self,
Expand Down Expand Up @@ -1619,6 +1625,8 @@ class MaterialWithSustainabilityResult(
* The reference to the material in Granta MI
* The sustainability information for this material
* Any process objects that are a child of this material object
.. versionadded:: 2.0
"""


Expand All @@ -1636,6 +1644,8 @@ class PartWithSustainabilityResult(
* The reference to the part in Granta MI (if the part references a record)
* The sustainability information for this part
* Any part, material, or process objects which are a child of this part object
.. versionadded:: 2.0
"""


Expand All @@ -1648,6 +1658,8 @@ class ProcessWithSustainabilityResult(
* The reference to the process record in Granta MI
* The sustainability information for this process
.. versionadded:: 2.0
"""


Expand All @@ -1660,6 +1672,8 @@ class TransportWithSustainabilityResult(
* The reference to the transport record in Granta MI
* The sustainability information for this transport stage
.. versionadded:: 2.0
"""

def __init__(
Expand Down Expand Up @@ -1748,6 +1762,7 @@ class SustainabilityPhaseSummaryResult(SustainabilitySummaryBase):
* ``Processes``
* ``Transport``
.. versionadded:: 2.0
"""

def __init__(
Expand All @@ -1773,6 +1788,8 @@ def __repr__(self) -> str:
class TransportSummaryResult(SustainabilitySummaryBase):
"""
Sustainability summary for a transport stage.
.. versionadded:: 2.0
"""

def __init__(
Expand Down Expand Up @@ -1816,6 +1833,8 @@ class ContributingComponentResult:
Describes a Part item of the BoM.
Listed as :attr:`~.MaterialSummaryResult.contributors` of a :class:`~.MaterialSummaryResult`.
.. versionadded:: 2.0
"""

def __init__(
Expand Down Expand Up @@ -1870,6 +1889,8 @@ class MaterialSummaryResult(SustainabilitySummaryBase):
Aggregated sustainability summary for a material.
Describes the environmental footprint of a unique material, accounting for all occurrences of the material in BoM.
.. versionadded:: 2.0
"""

def __init__(
Expand Down Expand Up @@ -1936,6 +1957,8 @@ class ProcessSummaryResult(SustainabilitySummaryBase):
Describes the environmental footprint of a process, accounting for all occurrences of the process-material pair
found in the BoM.
.. versionadded:: 2.0
"""

def __init__(
Expand Down Expand Up @@ -1992,7 +2015,10 @@ def __repr__(self) -> str:


class Licensing:
"""Granta MI BomAnalytics Services licensing information."""
"""Granta MI BomAnalytics Services licensing information.
.. versionadded:: 2.0
"""

def __init__(self, restricted_substances: bool, sustainability: bool):
self._restricted_substances: bool = restricted_substances
Expand Down
10 changes: 8 additions & 2 deletions src/ansys/grantami/bomanalytics/_query_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,10 @@ def compliance_by_part_and_indicator(self) -> List["PartWithComplianceResult"]:

@QueryResultFactory.register(models.GetSustainabilityForBom2301Response)
class BomSustainabilityQueryResult(ResultBaseClass):
"""Describes the result of running a :class:`~ansys.grantami.bomanalytics.queries.BomSustainabilityQuery`."""
"""Describes the result of running a :class:`~ansys.grantami.bomanalytics.queries.BomSustainabilityQuery`.
.. versionadded:: 2.0
"""

def __init__(
self,
Expand Down Expand Up @@ -788,7 +791,10 @@ def __repr__(self) -> str:

@QueryResultFactory.register(models.GetSustainabilitySummaryForBom2301Response)
class BomSustainabilitySummaryQueryResult(ResultBaseClass):
"""Describes the result of running a :class:`~ansys.grantami.bomanalytics.queries.BomSustainabilitySummaryQuery`."""
"""Describes the result of running a :class:`~ansys.grantami.bomanalytics.queries.BomSustainabilitySummaryQuery`.
.. versionadded:: 2.0
"""

def __init__(
self,
Expand Down
4 changes: 4 additions & 0 deletions src/ansys/grantami/bomanalytics/bom_types/_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class AttributeReferenceBuilder:
"""
Create a MI Attribute Reference with a valid combination of properties.
.. versionadded:: 2.0
Parameters
----------
db_key : str
Expand Down Expand Up @@ -158,6 +160,8 @@ class RecordReferenceBuilder:
"""
Create a MIRecordReference with a valid combination of properties.
.. versionadded:: 2.0
Parameters
----------
db_key : str
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/grantami/bomanalytics/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,11 @@ class RoHSIndicator(_Indicator):
name : str
Name of the indicator that is to identify the indicator in the query result.
legislation_ids : list[str]
.. versionadded:: 2.0
Legislations against which compliance will be determined. Legislations are identified based
on their ``Legislation ID`` attribute value.
.. versionadded:: 2.0
.. important::
This argument replaces ``legislation_names``, which has been removed in version **2.0**.
Expand Down Expand Up @@ -471,11 +471,11 @@ class WatchListIndicator(_Indicator):
name : str
Name of the indicator that is used to identify the indicator in the query result.
legislation_ids : list[str]
.. versionadded:: 2.0
Legislations against which compliance will be determined. Legislations are identified based
on their ``Legislation ID`` attribute value.
.. versionadded:: 2.0
.. important::
This argument replaces ``legislation_names``, which has been removed in version **2.0**.
Expand Down
4 changes: 4 additions & 0 deletions src/ansys/grantami/bomanalytics/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,8 @@ class BomSustainabilityQuery(_SustainabilityMixin, _BomQueryBuilder):
:meth:`~ansys.grantami.bomanalytics._connection.BomAnalyticsClient.run` method to return a result of type
:class:`~ansys.grantami.bomanalytics._query_results.BomSustainabilityQueryResult`.
.. versionadded:: 2.0
Examples
--------
>>> cxn = Connection("http://my_mi_server/mi_servicelayer").with_autologon().connect()
Expand Down Expand Up @@ -1867,6 +1869,8 @@ class BomSustainabilitySummaryQuery(_SustainabilityMixin, _BomQueryBuilder):
:meth:`~ansys.grantami.bomanalytics._connection.BomAnalyticsClient.run` method to return a result of type
:class:`~ansys.grantami.bomanalytics._query_results.BomSustainabilitySummaryQueryResult`.
.. versionadded:: 2.0
Examples
--------
>>> cxn = Connection("http://my_mi_server/mi_servicelayer").with_autologon().connect()
Expand Down
10 changes: 8 additions & 2 deletions src/ansys/grantami/bomanalytics/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
_schemas_dir = Path(__file__).parent

bom_schema_1711: Path = _schemas_dir / "BillOfMaterialsEco1711.xsd"
"""Path to the Ansys Granta 17/11 BoM XML Schema definition."""
"""Path to the Ansys Granta 17/11 BoM XML Schema definition.
.. versionadded:: 2.0
"""

bom_schema_2301: Path = _schemas_dir / "BillOfMaterialsEco2301.xsd"
"""Path to the Ansys Granta 23/01 BoM XML Schema definition."""
"""Path to the Ansys Granta 23/01 BoM XML Schema definition.
.. versionadded:: 2.0
"""

0 comments on commit 3ff0bfa

Please sign in to comment.