Skip to content
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
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,20 @@ Alternatively, install the latest from `PyMAPDL GitHub
pip install git+https://github.com/pyansys/pymapdl.git


For a local "development" version, install with:
For a local "development" version, install with (requires pip >= 22.0):

.. code::

git clone https://github.com/pyansys/pymapdl.git
cd mapdl
cd pymapdl
pip install -e .


Dependencies
------------
You will need a local licenced copy of ANSYS to run MAPDL prior and
including 2021R1. If you have the latest version of 2021R1 you do
not need MAPDL installed locally and can connect to a remote instance
via gRPC.
not need MAPDL installed locally and can connect to a remote instance.


Getting Started
Expand Down
5 changes: 5 additions & 0 deletions src/ansys/mapdl/core/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,8 @@ def to_dataframe(self):
df["IMAG"] = df["IMAG"].astype(np.float64, copy=False)

return df


class StringWithLiteralRepr(str):
def __repr__(self):
return self.__str__()
3 changes: 2 additions & 1 deletion src/ansys/mapdl/core/mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
BoundaryConditionsListingOutput,
CommandListingOutput,
Commands,
StringWithLiteralRepr,
inject_docs,
)
from ansys.mapdl.core.errors import MapdlInvalidRoutineError, MapdlRuntimeError
Expand Down Expand Up @@ -2349,7 +2350,7 @@ def run(self, command, write_to_log=True, mute=None, **kwargs) -> str:

text = text.replace("\\r\\n", "\n").replace("\\n", "\n")
if text:
self._response = text.strip()
self._response = StringWithLiteralRepr(text.strip())
self._log.info(self._response)
else:
self._response = None
Expand Down
9 changes: 9 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
CommandListingOutput,
CommandOutput,
Commands,
StringWithLiteralRepr,
)

try:
Expand Down Expand Up @@ -234,3 +235,11 @@ def test_docstring_injector(mapdl, method):
assert "``str.to_list()``" in docstring
assert "``str.to_array()``" in docstring
assert "``str.to_dataframe()``" in docstring


def test_string_with_literal():
base_ = "asdf\nasdf"
output = StringWithLiteralRepr(base_)
assert output.__repr__() == output
assert output.__repr__() == base_
assert len(output.split()) == 2