Skip to content

Commit 1bebbf9

Browse files
committed
API edits and miscellanous format fixes
1 parent 9bd05ef commit 1bebbf9

28 files changed

+274
-286
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ The documentation has these sections:
4343
- `Getting started <https://ansys.tools.docs.pyansys.com/version/stable/getting_started/index.html>`_: Learn
4444
how to install Ansys Common Tools in user mode.
4545
- `User guide <https://ansys.tools.docs.pyansys.com/version/stable/user_guide/index.html>`_: Understand key
46-
concepts for implementing its tools in your workflows.
46+
concepts for implementing the tools in your workflows.
4747
- `API reference <https://ansys.tools.docs.pyansys.com/version/stable/api/index.html>`_: Understand how to
48-
use Python to interact programmatically with its tools.
48+
use Python to interact programmatically with the tools.
4949
- `Contribute <https://ansys.tools.docs.pyansys.com/version/stable/contributing.html>`_: Learn how to
5050
contribute to the Ansys Common Tools codebase or documentation.
5151

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Update docstrings.
1+
Update documentation strings.

doc/source/contributing.rst

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ Contribute
66
Overall guidance on contributing to a PyAnsys library appears in the
77
`Contributing <https://dev.docs.pyansys.com/how-to/contributing.html>`_ topic
88
in the *PyAnsys developer's guide*. Ensure that you are thoroughly familiar
9-
with this guide before attempting to contribute to the Ansys Common Tools repository.
9+
with this guide before attempting to contribute to Ansys Common Tools.
1010

11-
The following contribution information is specific to the Ansys Common Tools.
11+
The following contribution information is specific to Ansys Common Tools.
1212

1313
Install in developer mode
1414
-------------------------
1515

16-
Installing the Ansys tools in developer mode allows you to modify and enhance
17-
the source.
16+
Installing Ansys Common Tools in developer mode allows you to modify and enhance the source.
1817

19-
To clone and install the latest Ansys tools release in development mode, run
20-
these commands:
18+
To clone and install the latest Ansys Common Tools release in development mode, run these commands:
2119

2220
.. code::
2321
@@ -29,22 +27,20 @@ these commands:
2927
Run tests
3028
---------
3129

32-
Ansys tools common uses `pytest <https://docs.pytest.org/en/stable/>`_ for testing.
30+
Ansys Common Tools uses `pytest <https://docs.pytest.org/en/stable/>`_ for testing.
3331

34-
#. Prior to running tests, you must run this command to install
35-
test dependencies::
32+
#. Prior to running tests, you must run this command to install test dependencies::
3633

3734
pip install -e .[tests]
3835

39-
#. To then run the tests, navigate to the root directory of the repository and run this
40-
command::
36+
#. To then run the tests, navigate to the root directory of the repository and run this command::
4137

4238
pytest
4339

4440
Adhere to code style
4541
--------------------
4642

47-
The Ansys Common Tools follows the PEP8 standard as outlined in
43+
Ansys Common Tools follows the PEP8 standard as outlined in
4844
`PEP 8 <https://dev.docs.pyansys.com/coding-style/pep8.html>`_ in
4945
the *PyAnsys developer's guide* and implements style checking using
5046
`pre-commit <https://pre-commit.com/>`_.
@@ -76,7 +72,7 @@ This way, it's not possible for you to push code that fails the style checks::
7672
Build the documentation
7773
-----------------------
7874

79-
You can build the Ansys Common Tools documentation locally.
75+
You can build Ansys Common Tools documentation locally.
8076

8177
#. Prior to building the documentation, you must run this command to install
8278
documentation dependencies::
@@ -105,11 +101,10 @@ You can clean the documentation build by running this command::
105101
Post issues
106102
-----------
107103

108-
Use the `Ansys tools common Issues <https://github.com/ansys/ansys-tools-common/issues>`_
109-
page to report bugs and request new features. When possible, use the issue templates provided.
104+
Use the Ansys Common Tools `Issues <https://github.com/ansys/ansys-tools-common/issues>`_ page to report bugs and request new features. When possible, use the issue templates provided.
110105
If your issue does not fit into one of these templates, click the link for opening a blank issue.
111106

112107
If you have general questions about the PyAnsys ecosystem, email
113108
114-
question is specific to the Ansys Common Tools, ask your
109+
question is specific to Ansys Common Tools, ask your
115110
question in an issue as described in the previous paragraph.

doc/source/index.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Ansys Common Tools provides a collection of tools for the PyAnsys ecosystem.
2020
:link: user_guide/index
2121
:link-type: doc
2222

23-
Understand key concepts for implementing its tools
23+
Understand key concepts for implementing the tools
2424
in your workflows.
2525

2626

@@ -29,15 +29,14 @@ Ansys Common Tools provides a collection of tools for the PyAnsys ecosystem.
2929
:link: api/index
3030
:link-type: doc
3131

32-
Understand how to use Python to interact programmatically with
33-
its tools.
32+
Understand how to use Python to interact programmatically with the tools.
3433

3534
.. grid-item-card:: Contribute :material-regular:`group`
3635
:padding: 2 2 2 2
3736
:link: contributing
3837
:link-type: doc
3938

40-
Learn how to contribute to the Ansys tools codebase or documentation.
39+
Learn how to contribute to the Ansys Common Tools codebase or documentation.
4140

4241

4342

src/ansys/tools/common/abstractions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
22-
"""Init module for abstractions."""
22+
"""Initialization module for abstractions."""
2323

2424
from .connection import AbstractGRPCConnection # noqa F401
2525
from .launcher import LauncherProtocol # noqa F401

src/ansys/tools/common/abstractions/connection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class AbstractGRPCConnection(ABC):
3939
Parameters
4040
----------
4141
host : str
42-
The host where the gRPC server is running.
42+
Host where the gRPC server is running.
4343
port : str
44-
The port where the gRPC server is listening.
44+
Port where the gRPC server is listening.
4545
"""
4646

4747
@abstractmethod
@@ -62,12 +62,12 @@ def close(self) -> None:
6262
@property
6363
@abstractmethod
6464
def service(self):
65-
"""Return the gRPC stub for making requests."""
65+
"""GRPC stub for making requests."""
6666
pass # pragma: no cover
6767

6868
@property
6969
def _host(self) -> str:
70-
"""Return the host for the gRPC connection."""
70+
"""Host for the gRPC connection."""
7171
return self.__host
7272

7373
@_host.setter
@@ -92,12 +92,12 @@ def _channel(self, options: list = None) -> grpc.Channel:
9292

9393
@property
9494
def is_closed(self) -> bool:
95-
"""Check if the connection is closed.
95+
"""Flag indicating if the connection is closed.
9696
9797
Returns
9898
-------
9999
bool
100-
True if the connection is closed, False otherwise.
100+
``True`` if the connection is closed, ``False`` otherwise.
101101
"""
102102
try:
103103
return self._channel._connectivity_state != grpc.ChannelConnectivity.READY

src/ansys/tools/common/abstractions/launcher.py

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
"""Interface definitions for implementing a local product launcher.
2424
25-
A plugin for the Local Product Launcher must implement the :class:`LauncherProtocol`
26-
class and register it.
25+
A plugin for the local product launcher must implement the :class:`LauncherProtocol` class and register it.
2726
"""
2827

2928
from enum import Enum, auto
@@ -44,8 +43,7 @@ class and register it.
4443

4544
METADATA_KEY_NOPROMPT = "launcher_noprompt"
4645
"""
47-
Key used in the :py:class:`dataclasses.Field` ``metadata`` to skip prompting for
48-
the option by default.
46+
Key used in the :py:class:`dataclasses.Field` ``metadata`` to skip prompting for the option by default.
4947
"""
5048

5149
FALLBACK_LAUNCH_MODE_NAME = "__fallback__"
@@ -67,8 +65,7 @@ class ServerType(Enum):
6765
"""Defines which protocols the server supports.
6866
6967
The ``ServerType`` class is used as values in the :attr:`LauncherProtocol.SERVER_SPEC`
70-
attribute to define the capabilities of the servers started with a given product and
71-
launch method.
68+
attribute to define the capabilities of the servers started with a given product and launch method.
7269
"""
7370

7471
GENERIC = auto()
@@ -87,43 +84,41 @@ class ServerType(Enum):
8784

8885

8986
class LauncherProtocol(Protocol[LAUNCHER_CONFIG_T]):
90-
"""Interface for managing a local product instance.
87+
"""Provides the interface for managing a local product instance.
9188
92-
A plugin to the Local Product Launcher must implement the interface
93-
defined in this class.
89+
A plugin to the local product launcher must implement the interface defined in this class.
9490
95-
To check for compatibility, it is recommended to derive from this
96-
class, for example ``MyLauncher(LauncherProtocol[MyConfigModel])``, and
97-
check the resulting code with `mypy <https://mypy.readthedocs.io>`_.
91+
To check for compatibility, you should derive from this
92+
class. For example ``MyLauncher(LauncherProtocol[MyConfigModel])``.
93+
Check the resulting code with `Mypy <https://mypy.readthedocs.io>`_.
9894
9995
The ``__init__`` method should accept exactly one keyword-only
100-
parameter: ``config``. Note that this is `not enforced by mypy
101-
<https://bugs.python.org/issue44807>`_.
96+
parameter: ``config``. Note that this is `not enforced by
97+
Mypy <https://bugs.python.org/issue44807>`_.
10298
10399
Parameters
104100
----------
105101
config :
106-
Configuration options used to start the product. This parameter
107-
must be an instance of ``CONFIG_MODEL``.
102+
Configuration options used to start the product. This parameter must be an instance of ``CONFIG_MODEL``.
108103
"""
109104

110105
CONFIG_MODEL: type[LAUNCHER_CONFIG_T]
111106
"""Defines the configuration options for the launcher.
112107
113-
The configuration options which this launcher accepts, specified
114-
as a :py:func:`dataclass <dataclasses.dataclass>`. Note that the
115-
``default`` and ``metadata[METADATA_KEY_DOC]`` of the fields are
116-
used in the configuration CLI, if available.
108+
The configuration options that this launcher accepts, specified
109+
as a :py:func:`dataclass <dataclasses.dataclass>`. Note that
110+
the ``default`` and ``metadata[METADATA_KEY_DOC]`` of the
111+
fields are used in the configuration CLI, if available.
117112
"""
118113

119114
SERVER_SPEC: dict[str, ServerType]
120115
"""Defines the server types that are started.
121116
122117
Examples
123118
--------
124-
This code defines a server that is accessible via a URL at the
125-
``"MAIN"`` key and a server accessible via gRPC at the
126-
``"FILE_TRANSFER"`` key.
119+
This code defines a server that is accessible via a URL
120+
at the ``"MAIN"`` key and a server accessible via gRPC
121+
at the ``"FILE_TRANSFER"`` key.
127122
128123
.. code:: python
129124
@@ -149,8 +144,7 @@ def stop(self, *, timeout: float | None = None) -> None:
149144
timeout :
150145
Time after which the instance can be forcefully stopped.
151146
The timeout should be interpreted as a hint to the implementation.
152-
It is *not required* to trigger a force-shutdown, but the stop
153-
*must* return within a finite time.
147+
It is *not required* to trigger a force-shutdown, but the stop *must* return within a finite time.
154148
"""
155149

156150
def check(self, *, timeout: float | None = None) -> bool:
@@ -161,20 +155,21 @@ def check(self, *, timeout: float | None = None) -> bool:
161155
timeout :
162156
Timeout in seconds for the check.
163157
The timeout should be interpreted as a hint to the implementation.
164-
It is *not required* to return within the given time, but the
165-
check *must* return within a finite time, meaning it must not
166-
hang indefinitely.
158+
It is *not required* to return within the given time,
159+
but the check *must* return within a finite time,
160+
meaning it must not hang indefinitely.
167161
168162
Returns
169163
-------
170-
:
164+
bool
171165
Whether the product instance is responding.
172166
"""
173167

174168
@property
175169
def urls(self) -> dict[str, str]:
176170
"""Dictionary of URLs that the server is listening on.
177171
178-
The keys of the returned dictionary must correspond to the keys
179-
defined in the :attr:`.LauncherProtocol.SERVER_SPEC` attribute.
172+
The keys of the returned dictionary must correspond
173+
to the keys defined in the
174+
:attr:`.LauncherProtocol.SERVER_SPEC` attribute.
180175
"""

0 commit comments

Comments
 (0)