diff --git a/README.rst b/README.rst index ee04e23ff8e..06f15860fc0 100644 --- a/README.rst +++ b/README.rst @@ -104,12 +104,12 @@ 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 . @@ -117,8 +117,7 @@ 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 diff --git a/src/ansys/mapdl/core/commands.py b/src/ansys/mapdl/core/commands.py index af292c120e9..32e71628794 100644 --- a/src/ansys/mapdl/core/commands.py +++ b/src/ansys/mapdl/core/commands.py @@ -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__() diff --git a/src/ansys/mapdl/core/mapdl.py b/src/ansys/mapdl/core/mapdl.py index 0d0c4f2c0ef..be53b5becde 100644 --- a/src/ansys/mapdl/core/mapdl.py +++ b/src/ansys/mapdl/core/mapdl.py @@ -24,6 +24,7 @@ BoundaryConditionsListingOutput, CommandListingOutput, Commands, + StringWithLiteralRepr, inject_docs, ) from ansys.mapdl.core.errors import MapdlInvalidRoutineError, MapdlRuntimeError @@ -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 diff --git a/tests/test_commands.py b/tests/test_commands.py index 737cd2edfd8..e8fabecd252 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -11,6 +11,7 @@ CommandListingOutput, CommandOutput, Commands, + StringWithLiteralRepr, ) try: @@ -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