Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up sphinx warnings #263

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions doc/source/rest_api/ensight_rest_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ tags:
description: Generic Python interface.
externalDocs:
description: pyensight.Session
url: https://ensight.docs.pyansys.com/dev/_autosummary/pyensight.Session.html
url: https://ensight.docs.pyansys.com/version/dev/_autosummary/pyensight.Session.html

- name: Native API
description: Interface to the EnSight "native" Python API. Created by converting command
language into Python.
externalDocs:
description: EnSight native command language API
url: https://ensight.docs.pyansys.com/dev/user_guide/cmdlang_native.html
url: https://ensight.docs.pyansys.com/version/dev/user_guide/cmdlang_native.html

- name: Object API
description: Interface to the EnSight Python object API
externalDocs:
description: EnSight Python Object API
url: https://ensight.docs.pyansys.com/dev/user_guide/index.html
url: https://ensight.docs.pyansys.com/version/dev/user_guide/index.html

paths:

Expand Down Expand Up @@ -102,7 +102,8 @@ paths:
application/json:
schema:
type: string
example: "ensight.objs.core.unit_system()"
example:
ensight.objs.core.unit_system()
responses:
'200':
description: Successful operation
Expand Down Expand Up @@ -181,9 +182,9 @@ paths:
schema:
type: string
example: |-
def funcname(app: SimpleNamespace, o: typing.Optional['ENSOBJ'] = None, s : str = 'VISIBLE') -> dict:
"def funcname(app: SimpleNamespace, o: typing.Optional['ENSOBJ'] = None, s : str = 'VISIBLE') -> dict:
v = o.getattr(s)
return dict(s=v)
return dict(s=v)"
responses:
'200':
description: Successful operation
Expand Down
4 changes: 0 additions & 4 deletions doc/source/rest_api/rest_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ If you supply tokens using both methods, the token in the header is used.
REST API reference
------------------

The REST API shown here is a bit simplistic, but you can access the
`OpenAPI YAML file <https://ensight.docs.pyansys.com/dev/_static/ensight_rest_v1.yaml>`_
for the API, which is appropriate for use with `Swagger <https://editor.swagger.io/>`_.

.. openapi:: ensight_rest_v1.yaml
:examples:

17 changes: 9 additions & 8 deletions src/ansys/pyensight/core/ensobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ def getattrs(self, attrid: Optional[list] = None, text: int = 0) -> dict:
values. If text is set to 1, the dictionary keys will be strings.
Return:

Returns
-------
Session CMD.

Examples
--------
To copy some attributes from one part to another.

>>> tmp = part0.getattrs(["VISIBLE", session.ensight.objs.enums.OPAQUENESS])
>>> part1.setattrs(tmp)

Returns
-------
Session CMD.

"""
if attrid is None:
cmd = f"{self._remote_obj()}.getattrs(text={text})"
Expand All @@ -134,16 +134,17 @@ def setattr(self, attrid: Any, value: Any) -> None:
value : Any
The value to set the attribute to.

Returns
-------
Session CMD.

Examples
--------
These commands are equivalent

>>> part.setattr("VISIBLE", True)
>>> part.getattr(session.ensight.objs.enums.VISIBLE, True)

Returns
-------
Session CMD.
"""
return self._session.cmd(
f"{self._remote_obj()}.setattr({attrid.__repr__()}, {value.__repr__()})"
Expand Down Expand Up @@ -222,7 +223,7 @@ def attrinfo(self, attrid: Optional[Any] = None) -> dict:
return self._session.cmd(f"{self._remote_obj()}.attrinfo({attrid.__repr__()})")

def populate_attr_list(self) -> List[str]:
"""populates a list with attributes.
"""Populates a list with attributes.

Returns
-------
Expand Down
10 changes: 4 additions & 6 deletions src/ansys/pyensight/core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class methods, but if the EnSight session is already running, an instance can be
----------
host : str, optional
Name of the host that the EnSight gRPC service is running on.
The default is``"127.0.0.1"``, which is the localhost.
The default is ``"127.0.0.1"``, which is the localhost.
install_path : str, optional
Path to the CEI directory to launch EnSight from.
The default is ``None``.
Expand Down Expand Up @@ -1179,16 +1179,14 @@ def add_callback(
Examples
--------
A string like this is printed when the dataset is loaded and the part list
changes::

Event :
grpc://f6f74dae-f0ed-11ec-aa58-381428170733/partlist?enum=PARTS&uid=221'
changes:

`` Event : grpc://f6f74dae-f0ed-11ec-aa58-381428170733/partlist?enum=PARTS&uid=221``

>>> from ansys.pyensight.core import LocalLauncher
>>> s = LocalLauncher().start()
>>> def cb(v: str):
>>> print("Event:", v)
>>> print("Event:", v)
>>> s.add_callback("ensight.objs.core", "partlist", ["PARTS"], cb)
>>> s.load_data(r"D:\ANSYSDev\data\CFX\HeatingCoil_001.res")
"""
Expand Down
Loading